]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
9 years agodoc: fix broken link in README
Ryan Seys [Thu, 19 Feb 2015 02:34:44 +0000 (21:34 -0500)]
doc: fix broken link in README

Change-Id: I73450aeb59571f3285ff59ae214739e1866c9aa0
Reviewed-on: https://go-review.googlesource.com/5270
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoimage/jpeg: support 16-bit quantization tables and Extended Sequential
Nigel Tao [Thu, 19 Feb 2015 03:00:16 +0000 (14:00 +1100)]
image/jpeg: support 16-bit quantization tables and Extended Sequential
frames.

Fixes #9888.

Change-Id: I60f1d843e72e1b7bc77ab984f149c9ddb5258a06
Reviewed-on: https://go-review.googlesource.com/5251
Reviewed-by: Rob Pike <r@golang.org>
9 years agoruntime: make gcDrainN take an int instead of uintptr
Austin Clements [Wed, 18 Feb 2015 21:40:31 +0000 (16:40 -0500)]
runtime: make gcDrainN take an int instead of uintptr

Nit.  There's no reason to take a uintptr and doing so just requires
casts in annoying places.

Change-Id: Ifeb9638c6d94eae619c490930cf724cc315680ba
Reviewed-on: https://go-review.googlesource.com/5230
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: fix accidentally exported OpenBSD constants
Matthew Dempsky [Mon, 16 Feb 2015 09:18:13 +0000 (18:18 +0900)]
runtime: fix accidentally exported OpenBSD constants

Change-Id: I2de63668a1c0152cc329df55c2d6d014e8183158
Reviewed-on: https://go-review.googlesource.com/4943
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoencoding/json: Fixed the comment specifying Marshal behavior for maps.
Aaron Jacobs [Wed, 18 Feb 2015 22:35:28 +0000 (09:35 +1100)]
encoding/json: Fixed the comment specifying Marshal behavior for maps.

The comment previously was reversed in sense (it appeared to be
describing unmarshaling). I've fixed that, and added the caveat that map
keys are subject to UTF-8 coercion like other strings.

Change-Id: Id08082aa71401a6e7530a42f979fbb50bd1f4e6a
Reviewed-on: https://go-review.googlesource.com/5221
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoimage: change Rectangle.Eq to return true for all empty rectangles, even
Nigel Tao [Tue, 17 Feb 2015 05:28:10 +0000 (16:28 +1100)]
image: change Rectangle.Eq to return true for all empty rectangles, even
if their nominal Min and Max points differ.

This is a behavior change, but arguably a bug fix, as Eq wasn't
previously consistent with In, and the concept of a rectangle being a
set of points. This is demonstrated by the new geom_test.go test.

It does mean that r.Eq(s) no longer implies that Inset'ting both r and s
with a negative inset results in two rectangles that are still Eq, but
that seems acceptable to me.

The previous behavior is still available as "r == s".

Also clarify the image.Rect doc comment when the inputs are
non-canonical.

Also simplify the Point and Rectangle Eq implementations dating from
before Go 1.0, when you couldn't compare structs via the == operator.

Change-Id: Ic39e628db31dc5fe5220f4b444e6d5000eeace5b
Reviewed-on: https://go-review.googlesource.com/5006
Reviewed-by: Rob Pike <r@golang.org>
9 years agodoc: add cgi change go1.5.txt
Brad Fitzpatrick [Wed, 18 Feb 2015 19:59:16 +0000 (11:59 -0800)]
doc: add cgi change go1.5.txt

Change-Id: I829529929906d4758c7ba10d356c251b44e35a8d
Reviewed-on: https://go-review.googlesource.com/5190
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http/cgi: fix REMOTE_ADDR, REMOTE_HOST, add REMOTE_PORT
Alex Sergeyev [Mon, 16 Feb 2015 14:29:37 +0000 (09:29 -0500)]
net/http/cgi: fix REMOTE_ADDR, REMOTE_HOST, add REMOTE_PORT

Env vars were incorrectly copying whole value of http.RemoteAddr
to REMOTE_ADDR and REMOTE_HOST. They contained IP:port pair which
instead should only have IP (RFC 3875, other sources).

Module also was not setting REMOTE_PORT variable which become de-facto
standard for passing TCP client port to CGI scripts (Apache mod_cgi,
IIS, and probably others)

Fixes #9861

Change-Id: Ia73e664c48539e3c7db4997d09d957884e98d8a5
Reviewed-on: https://go-review.googlesource.com/4933
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocrypto/x509: embed certificates on darwin/arm
David Crawshaw [Tue, 17 Feb 2015 20:17:46 +0000 (15:17 -0500)]
crypto/x509: embed certificates on darwin/arm

Change-Id: Ia6b06f19e5ac424f01a1b90b78b507363b0c4577
Reviewed-on: https://go-review.googlesource.com/5061
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years agocmd/gc: replace NULL by nil
David du Colombier [Wed, 18 Feb 2015 07:25:30 +0000 (08:25 +0100)]
cmd/gc: replace NULL by nil

In CL 3964, NULL was used instead of nil.
However, Plan 9 doesn't declare NULL.

Change-Id: Ied3850aca5c8bca5974105129a37d575df33f6ec
Reviewed-on: https://go-review.googlesource.com/5150
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/gc: generate simpler names for closures
Dmitry Vyukov [Thu, 5 Feb 2015 13:08:29 +0000 (16:08 +0300)]
cmd/gc: generate simpler names for closures

Fixes #8291

There were several complaints about closure names in the issue tracker.
The first problem is that you see names like net/http.func·001
in profiles, traces, etc. And there is no way to figure out what
is that function.
Another issue is non-US-ascii symbols. All programs out there
should accept UTF-8. But unfortunately it is not true in reality.
For example, less does not render middle dot properly.

This change prepends outer function name to closure name and
replaces middle dot with dot. Now names look like:

main.glob.func1
main.glob.func2
main.glob.func2.1
main.init.1
main.init.1.func1
main.init.1.func1.1
main.main.func1
main.main.func1.1

Change-Id: I725726af88f2ad3ced2e3450f0f06bf459fd91c0
Reviewed-on: https://go-review.googlesource.com/3964
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc: document Go 1.4.2
Andrew Gerrand [Wed, 18 Feb 2015 02:40:57 +0000 (13:40 +1100)]
doc: document Go 1.4.2

Change-Id: Ia87047cbc720fb03d2f67aec48abe18bce8dbf78
Reviewed-on: https://go-review.googlesource.com/5112
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoimage/draw: add CMYK fast path.
Nigel Tao [Tue, 17 Feb 2015 06:29:54 +0000 (17:29 +1100)]
image/draw: add CMYK fast path.

Change-Id: I9582aff7ca141a8aead5692af74b9c708b1700cc
Reviewed-on: https://go-review.googlesource.com/5020
Reviewed-by: Rob Pike <r@golang.org>
9 years agoruntime: fix runtime-gdb_test on arm
Austin Clements [Tue, 17 Feb 2015 20:01:43 +0000 (15:01 -0500)]
runtime: fix runtime-gdb_test on arm

Apparently when ARM stops at a GDB breakpoint, it appears to be in
syscall.Syscall.  The "info goroutines" test expected it to be in a
runtime function.  Since this isn't fundamental to the test, simply
tweak the test's regexp to make sure "info goroutines" prints some
running goroutine with an active M, but don't require it to be in any
particular function.

Change-Id: Iba2618b46d3dc49cef62ffb72484b83ea7b0317d
Reviewed-on: https://go-review.googlesource.com/5060
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agoruntime: rename gcwork.go to mgcwork.go
Austin Clements [Fri, 13 Feb 2015 22:30:16 +0000 (17:30 -0500)]
runtime: rename gcwork.go to mgcwork.go

All of the other memory-related source files start with "m".  Keep up
the tradition.

Change-Id: Idd88fdbf2a1453374fa12109b949b1c4d149a4f8
Reviewed-on: https://go-review.googlesource.com/4853
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime: in runtime-gdb.py, use SliceValue wrapper
Austin Clements [Tue, 17 Feb 2015 03:04:24 +0000 (22:04 -0500)]
runtime: in runtime-gdb.py, use SliceValue wrapper

Rather than reaching in to slices directly in the slice pretty
printer, use the newly introduced SliceValue wrapper.

Change-Id: Ibb25f8c618c2ffb3fe1a8dd044bb9a6a085df5b7
Reviewed-on: https://go-review.googlesource.com/4936
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime: fix GDB "info goroutines" for Go 1.5
Austin Clements [Tue, 17 Feb 2015 02:56:10 +0000 (21:56 -0500)]
runtime: fix GDB "info goroutines" for Go 1.5

"info goroutines" is failing because it hasn't kept up with changes in
the 1.5 runtime.  This fixes three issues preventing "info goroutines"
from working.  allg is no longer a linked list, so switch to using the
allgs slice.  The g struct's 'status' field is now called
'atomicstatus', so rename uses of 'status'.  Finally, this was trying
to parse str(pc) as an int, but str(pc) can return symbolic
information after the raw hex value; fix this by stripping everything
after the first space.

This also adds a test for "info goroutines" to runtime-gdb_test, which
was previously quite skeletal.

Change-Id: I8ad83ee8640891cdd88ecd28dad31ed9b5833b7a
Reviewed-on: https://go-review.googlesource.com/4935
Reviewed-by: Minux Ma <minux@golang.org>
9 years agomath: change Nextafter64 to Nextafter in the description of Nextafter
Ivan Ukhov [Tue, 17 Feb 2015 06:53:44 +0000 (07:53 +0100)]
math: change Nextafter64 to Nextafter in the description of Nextafter

Change-Id: I3419d6247fbff36aa1ed5451bb3cfb7502c3d07e
Reviewed-on: https://go-review.googlesource.com/5030
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agocmd/go: skip stat check when using -toolexec
David Crawshaw [Mon, 16 Feb 2015 19:22:22 +0000 (14:22 -0500)]
cmd/go: skip stat check when using -toolexec

Change-Id: Idc88b1ee950e33cfe757a27e9a3383d879793af7
Reviewed-on: https://go-review.googlesource.com/4934
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agosyscall: make mksyscall_windows.go to work even when output does not uses unsafe...
Alex Brainman [Tue, 17 Feb 2015 04:21:11 +0000 (15:21 +1100)]
syscall: make mksyscall_windows.go to work even when output does not uses unsafe package

Fixes #9900

Change-Id: I5dd401e8d2040e84ccb97c2fe9f5c5a28095b538
Reviewed-on: https://go-review.googlesource.com/5005
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoall: fix typo in doc
Yasuhiro Matsumoto [Tue, 17 Feb 2015 02:04:07 +0000 (11:04 +0900)]
all: fix typo in doc

Change-Id: I89fdda2914030dfea3183a8b4681dd4b33489729
Reviewed-on: https://go-review.googlesource.com/4996
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoimage: fix Rectangle.Overlaps and Rectangle.Union for empty rectangles.
Nigel Tao [Tue, 17 Feb 2015 00:15:06 +0000 (11:15 +1100)]
image: fix Rectangle.Overlaps and Rectangle.Union for empty rectangles.

Fixes #9895.

Change-Id: I37d78ced9ff8196e32d299504908a1c41ad4592d
Reviewed-on: https://go-review.googlesource.com/4990
Reviewed-by: Rob Pike <r@golang.org>
9 years agoos: fix typo in doc
mattn [Tue, 17 Feb 2015 00:16:06 +0000 (09:16 +0900)]
os: fix typo in doc

Change-Id: I9797b44dfa7c2c853b7a656f4f722df2c862824b
Reviewed-on: https://go-review.googlesource.com/4991
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoimage/draw: add CMYK test.
Nigel Tao [Mon, 16 Feb 2015 06:41:28 +0000 (17:41 +1100)]
image/draw: add CMYK test.

This just adds test cases. Optimizing CMYK draws will be a follow-up
change.

Change-Id: Ic0d6343d420cd021e21f88623ad7182e93017da9
Reviewed-on: https://go-review.googlesource.com/4941
Reviewed-by: Rob Pike <r@golang.org>
9 years agounicode: Fixed an out of date comment (MaxLatin1, not Latin1Max).
Aaron Jacobs [Mon, 16 Feb 2015 21:21:14 +0000 (08:21 +1100)]
unicode: Fixed an out of date comment (MaxLatin1, not Latin1Max).

Change-Id: I3ca878e9685f650a9ff02aaac0e2e3cca89634c6
Reviewed-on: https://go-review.googlesource.com/4970
Reviewed-by: Minux Ma <minux@golang.org>
9 years agodoc: Add reminder to go1.5.txt for os/signal changes
Michael MacInnis [Mon, 16 Feb 2015 21:27:20 +0000 (16:27 -0500)]
doc: Add reminder to go1.5.txt for os/signal changes

Document addition of Ignore and Reset: https://golang.org/cl/3580

Change-Id: I33aac149cd1921b87f887028c0365ba0ab9adb02
Reviewed-on: https://go-review.googlesource.com/4980
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/dist: don't use "uname -v" to recognize GOHOSTARCH
Mikio Hara [Mon, 16 Feb 2015 14:14:34 +0000 (23:14 +0900)]
cmd/dist: don't use "uname -v" to recognize GOHOSTARCH

We can use processor architecture or hardware platform as part of
hostname and it leads to misconfiguration of GOHOSARCH.

For example,

$ uname -m -v
FreeBSD 10.1-RELEASE-p5 #0: Tue Jan 27 08:52:50 UTC 2015 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC i386

Change-Id: I499efd98338beff6a27c03f03273331ecb6fd698
Reviewed-on: https://go-review.googlesource.com/4944
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoos/signal: add ability to ignore signals and restore initial signal handlers
Michael MacInnis [Fri, 30 Jan 2015 03:37:41 +0000 (22:37 -0500)]
os/signal: add ability to ignore signals and restore initial signal handlers

There is currently no way to ignore signals using the os/signal package.
It is possible to catch a signal and do nothing but this is not the same
as ignoring it. The new function Ignore allows a set of signals to be
ignored. The new function Reset allows the initial handlers for a set of
signals to be restored.

Fixes #5572

Change-Id: I5c0f07956971e3a9ff9b9d9631e6e3a08c20df15
Reviewed-on: https://go-review.googlesource.com/3580
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoimage/jpeg: remove the (temporary) dependency on image/draw.
Nigel Tao [Mon, 16 Feb 2015 04:10:50 +0000 (15:10 +1100)]
image/jpeg: remove the (temporary) dependency on image/draw.

Change-Id: Idd66f9c3c9eaa4ff1f950fb90e4800dc625dec08
Reviewed-on: https://go-review.googlesource.com/4916
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
9 years agoruntime: remove C-style strcmp and strncmp helpers
Matthew Dempsky [Fri, 13 Feb 2015 03:09:12 +0000 (12:09 +0900)]
runtime: remove C-style strcmp and strncmp helpers

Change-Id: I4aa23e3a0e765651c91907507a0194fd528b6223
Reviewed-on: https://go-review.googlesource.com/4662
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoimage/jpeg: support decoding CMYK and YCbCrK images.
Nigel Tao [Fri, 13 Feb 2015 07:09:21 +0000 (18:09 +1100)]
image/jpeg: support decoding CMYK and YCbCrK images.

The new testdata was created by:

convert video-001.png -colorspace cmyk video-001.cmyk.jpeg

video-001.cmyk.jpeg was then converted back to video-001.cmyk.png via
the GIMP. ImageMagick (convert) wasn't used for this second conversion
because IM's default color profiles complicates things.

Fixes #4500.

Change-Id: Ibf533f6a6c7e76883acc493ce3a4289d7875df3f
Reviewed-on: https://go-review.googlesource.com/4801
Reviewed-by: Rob Pike <r@golang.org>
9 years agoimage: add image.CMYK and color.CMYK types.
Nigel Tao [Fri, 13 Feb 2015 07:12:48 +0000 (18:12 +1100)]
image: add image.CMYK and color.CMYK types.

Change-Id: Icf212a4b890725c803b16e76e1a88294b8b62cb8
Reviewed-on: https://go-review.googlesource.com/4800
Reviewed-by: Rob Pike <r@golang.org>
9 years agomath/big: implement fast path in Float.SetRat if argument is integer
Robert Griesemer [Sun, 15 Feb 2015 05:29:37 +0000 (21:29 -0800)]
math/big: implement fast path in Float.SetRat if argument is integer

Change-Id: Ib82500e198b86e9fade278c7eea7a4b0c6b0b2e1
Reviewed-on: https://go-review.googlesource.com/4921
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/gc: fix noscan maps
Dmitry Vyukov [Sat, 14 Feb 2015 13:10:06 +0000 (16:10 +0300)]
cmd/gc: fix noscan maps

Change 85e7bee introduced a bug:
it marks map buckets as noscan when key and val do not contain pointers.
However, buckets with large/outline key or val do contain pointers.

This change takes key/val size into consideration when
marking buckets as noscan.

Change-Id: I7172a0df482657be39faa59e2579dd9f209cb54d
Reviewed-on: https://go-review.googlesource.com/4901
Reviewed-by: Keith Randall <khr@golang.org>
9 years agomath/big: always round after the sign is set
Robert Griesemer [Sat, 14 Feb 2015 05:47:10 +0000 (21:47 -0800)]
math/big: always round after the sign is set

Some rounding modes are affected by the sign of the value to
be rounded. Make sure the sign is set before round is called.
Added tests (that failed before the fix).

Change-Id: Idd09b8fcbab89894fede0b9bc922cda5ddc87930
Reviewed-on: https://go-review.googlesource.com/4876
Reviewed-by: Rob Pike <r@golang.org>
9 years agodoc/asm: document that assembly function must use short name
Shenghou Ma [Fri, 9 Jan 2015 02:43:47 +0000 (21:43 -0500)]
doc/asm: document that assembly function must use short name

e.g. ·Name instead of package·Name for automatic stack map to
be applied from its Go prototype.

The underlying reason is that liblink look up name with suffix
".args_stackmap" for the stackmap coming from its Go prototype,
but all the Go functions are named "".Name as this stage. Thus
an assembly function named package·Name will never find its
stackmap, which is named "".package.Name.args_stackmap.

Perhaps cmd/vet should give a warning for this.

Change-Id: I10d154a73ec969d574d20af877f747424350fbd1
Reviewed-on: https://go-review.googlesource.com/2588
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: remove script and script.txt
Shenghou Ma [Sat, 14 Feb 2015 05:40:21 +0000 (00:40 -0500)]
cmd/go: remove script and script.txt

Fixes #9824.

Change-Id: Id318c61b6884e4fd294f7b0946dcc306f746ee0a
Reviewed-on: https://go-review.googlesource.com/4891
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agotest: add test case for issue 4365
Ian Lance Taylor [Sat, 14 Feb 2015 02:31:30 +0000 (18:31 -0800)]
test: add test case for issue 4365

This is an update of http://golang.org/cl/151410043 by Tim Shen.

Change-Id: I43ab7fcedd785059c535f45a3c8cdb7b618c1499
Reviewed-on: https://go-review.googlesource.com/4873
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agomath/big: fix aliasing bug in Float.Quo
Robert Griesemer [Sat, 14 Feb 2015 04:15:40 +0000 (20:15 -0800)]
math/big: fix aliasing bug in Float.Quo

TBR r, adonovan

Change-Id: I1a38e2d724bf1147c7307a7e5ae855c42c60428c
Reviewed-on: https://go-review.googlesource.com/4875
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agomath/big: don't scan past a binary exponent if not accepted syntactically
Robert Griesemer [Thu, 12 Feb 2015 23:09:56 +0000 (15:09 -0800)]
math/big: don't scan past a binary exponent if not accepted syntactically

TBR adonovan

Change-Id: I842cbc855dbd560f65e76c9a557dff1a22c5d610
Reviewed-on: https://go-review.googlesource.com/4882
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agomath/big: only permit bases 2, 10, 16 when scanning number w/ "decimal" point
Robert Griesemer [Thu, 12 Feb 2015 22:52:46 +0000 (14:52 -0800)]
math/big: only permit bases 2, 10, 16 when scanning number w/ "decimal" point

TBR adonovan

Change-Id: I4fd694101c2cf1c0c39bf73d16cab18502742dd9
Reviewed-on: https://go-review.googlesource.com/4881
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agomath/big: remove Float.Round (not needed anymore), fix a bug in SetInt64
Robert Griesemer [Sat, 14 Feb 2015 00:30:21 +0000 (16:30 -0800)]
math/big: remove Float.Round (not needed anymore), fix a bug in SetInt64

TBR adonovan

Change-Id: I30020f39be9183b37275e10a4fd1e1a3b4c48c89
Reviewed-on: https://go-review.googlesource.com/4880
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agomath/big: implement/rename accessors for precision and rounding mode
Robert Griesemer [Fri, 13 Feb 2015 21:44:39 +0000 (13:44 -0800)]
math/big: implement/rename accessors for precision and rounding mode

Also: remove NewFloat - not needed anymore. Work-around for places
where has been used so far:

NewFloat(x, prec, mode) === new(Float).SetMode(mode).SetPrec(prec).SetFloat64(x)

However, if mode == ToNearestEven, SetMode is not needed. SetPrec
is needed if the default precision (53 after SetFloat64) is not
adequate.

TBR adonovan

Change-Id: Ifda12c479ba157f2dea306c32b47c7afbf31e759
Reviewed-on: https://go-review.googlesource.com/4842
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agomath/big: fix aliasing error in Add, Sub
Robert Griesemer [Fri, 13 Feb 2015 20:47:44 +0000 (12:47 -0800)]
math/big: fix aliasing error in Add, Sub

Also:
- make representation more flexible (no need to store trailing 0 digits to match precision)
- simplify rounding as a consequence
- minor related fixes

TBR adonovan

Change-Id: Ie91075990688b506d28371ec3b633b8267397ebb
Reviewed-on: https://go-review.googlesource.com/4841
Reviewed-by: Rob Pike <r@golang.org>
9 years agomath/big: use internal validation more consistently
Robert Griesemer [Fri, 13 Feb 2015 18:12:25 +0000 (10:12 -0800)]
math/big: use internal validation more consistently

TBR adonovan

Change-Id: If77afa6474af6cad6512f6866725e3ae5acf2e3f
Reviewed-on: https://go-review.googlesource.com/4840
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agotest: deflake init1.go test, tighten its bounds
Brad Fitzpatrick [Fri, 13 Feb 2015 16:06:36 +0000 (08:06 -0800)]
test: deflake init1.go test, tighten its bounds

Per the comment at top, this test is about whether the GC runs during
init, but it was testing more than that, and testing how much the GC
collected in a certain amount of time.

Instead, loosen this test to just see whether it ran at all and not
how well it did.

Fixes #9848

Change-Id: I31da7dd769140d7b49aa6c149a543fae6076aa5e
Reviewed-on: https://go-review.googlesource.com/4820
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/gc: replace NULL by nil
David du Colombier [Fri, 13 Feb 2015 21:24:41 +0000 (22:24 +0100)]
cmd/gc: replace NULL by nil

In CL 4050, NULL was used instead of nil.
However, Plan 9 doesn't declare NULL.

Change-Id: I8295a3102509a1ce417278f23a37cbf65938cce1
Reviewed-on: https://go-review.googlesource.com/4814
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/ld: always mark tlsg STLSBSS
David Crawshaw [Fri, 13 Feb 2015 19:52:07 +0000 (14:52 -0500)]
cmd/ld: always mark tlsg STLSBSS

Android apps build again.

Defining TLSG in runtime/tls_arm.s gives it the type SNOPTRBSS, so its
type was never being set when GOOS=android. I considered modifying the
if statement, but I no longer understand the intention of the original
change (in d738c6b0cad). We were always setting it before, what
platform is this not valid for?

Fixes #9829

Change-Id: I3eaa4a9590893eff67695797eb22547a170cdbcd
Reviewed-on: https://go-review.googlesource.com/4834
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: David Crawshaw <crawshaw@golang.org>

9 years agoandroidtest.bash: remove use of cp --preserve.
Hyang-Ah (Hana) Kim [Fri, 13 Feb 2015 20:31:00 +0000 (15:31 -0500)]
androidtest.bash: remove use of cp --preserve.

--preserve flag is not a valid flag for some versions of cp.

Change-Id: I57f5bf21cbe726057fdadcd55b040ef7ff5d7479
Reviewed-on: https://go-review.googlesource.com/4835
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agocmd/ld: set alignment for the .rel.plt section on 32-bit architectures
Shenghou Ma [Sat, 7 Feb 2015 19:06:02 +0000 (14:06 -0500)]
cmd/ld: set alignment for the .rel.plt section on 32-bit architectures

Fixes #9802.

Change-Id: I22c52a37bdb23a14cc4615c9519431bb14ca81ca
Reviewed-on: https://go-review.googlesource.com/4170
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/ld: make cmd/ld a real library
Russ Cox [Thu, 12 Feb 2015 03:27:49 +0000 (22:27 -0500)]
cmd/ld: make cmd/ld a real library

Make cmd/ld a real library invoked by the individual linkers.
There are no reverse symbol references anymore
(symbols referred to in cmd/ld but defined in cmd/5l etc).

This means that in principle we could do an automatic
conversion of these to Go, as a stopgap until cmd/link is done
or as a replacement for cmd/link.

Change-Id: I4a94570257a3a7acc31601bfe0fad9dea0aea054
Reviewed-on: https://go-review.googlesource.com/4649
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/dist: avoid trailing space in instruction name strings
Russ Cox [Thu, 12 Feb 2015 03:39:21 +0000 (22:39 -0500)]
cmd/dist: avoid trailing space in instruction name strings

Change-Id: I2db4db852492eaddaf09dd7bae2fbd49f916e78a
Reviewed-on: https://go-review.googlesource.com/4648
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/gc: minor adjustments for C to Go translation
Russ Cox [Thu, 5 Feb 2015 16:53:33 +0000 (11:53 -0500)]
cmd/gc: minor adjustments for C to Go translation

- remove a few uses of ? :
- rename variables named len
- rewrite a few gotos as nested switches
- move goto targets to scope allowed by Go
- use consistent return type of anyregalloc
  (was int or int32 in different places)
- remove unused nr variable in agen
- include proper headers in generated builtin1.c
- avoid strange sized %E formats (%-6E, %2E)
- change gengcmask argument from uint8[16] to uint8*
  (diagnosed by c2go; not an array in any real sense).
- replace #ifdef XXX with comment block in 5g/peep.c
- expand and remove FAIL macro from 5g
- expand and remove noimpl macro from 9g
- print regalloc errors to stdout in 8g
  (only use of fprint(2, ...) in all compilers)

Still producing bit-for-bit identical output.

Change-Id: Id46efcd2a89241082b234f63f375b66f2754d695
Reviewed-on: https://go-review.googlesource.com/4646
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/gc: eliminate some pointer arithmetic
Russ Cox [Thu, 5 Feb 2015 15:47:44 +0000 (10:47 -0500)]
cmd/gc: eliminate some pointer arithmetic

In mparith, all the a1-- are problematic. Rewrite it all without pointers.
It's clearer anyway.

In popt, v is problematic because it is used both as a fixed pointer
(v = byvar[i]) and as a moving pointer (v = var; v++) aka slice.
Eliminate pointer movement.

Tested that this still produces bit-for-bit output for 'go build -a std'
compared to d260756 (current master).

Change-Id: I1a1bed0f98b594c3864fe95075dd95f9b52113e0
Reviewed-on: https://go-review.googlesource.com/4645
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/gc: rename arch to thearch
Russ Cox [Thu, 5 Feb 2015 16:55:51 +0000 (11:55 -0500)]
cmd/gc: rename arch to thearch

Otherwise the exported variable collides with the type Arch.

While we're here, remove arch.dumpit (now in portable code)
and add arch.defframe (forgotten originally, somehow).

Change-Id: I1b3a7dd7e96c5f632dba7cd6c1217b42a2004d72
Reviewed-on: https://go-review.googlesource.com/4644
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/gc: add .y to error about missing x in x.y
Russ Cox [Thu, 5 Feb 2015 17:31:13 +0000 (12:31 -0500)]
cmd/gc: add .y to error about missing x in x.y

If the Go source says x.y, and x is undefined, today we get

undefined: x

Change to:

undefined: x in x.y

Change-Id: I8ea95503bd469ea933c6bcbd675b7122a5d454f3
Reviewed-on: https://go-review.googlesource.com/4643
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/gc: add debugging to liveness analysis
Russ Cox [Wed, 11 Feb 2015 00:27:49 +0000 (19:27 -0500)]
cmd/gc: add debugging to liveness analysis

Even with debugmerge = 1, the debugging output only happens
with the -v command-line flag. This is useful because it gets added
in automatically when debugging things like registerization with -R -v.

Change-Id: I9a5c7f562507b72e8e2fe2686fd07d069721345a
Reviewed-on: https://go-review.googlesource.com/4641
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/gc: correct errors in constant parsing
Russ Cox [Wed, 11 Feb 2015 04:49:26 +0000 (23:49 -0500)]
cmd/gc: correct errors in constant parsing

Change-Id: I36f77e7ac7f727d8f3b51133f4b3ef93c35b09f6
Reviewed-on: https://go-review.googlesource.com/4640
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/gc: avoid writing past end of region array
Russ Cox [Fri, 13 Feb 2015 16:54:15 +0000 (11:54 -0500)]
cmd/gc: avoid writing past end of region array

Noticed last week.
Just saw a strange build failure in the revised rcmp (called by qsort on region)
and this fixed it.

Submitting first to avoid finding out which of my pending CLs tickled the
problem.

Change-Id: I4cafd611e2bf8e813e57ad0025e48bde5ae54359
Reviewed-on: https://go-review.googlesource.com/4830
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/yacc: adjust expansion of $n to be more useful in errors
Russ Cox [Fri, 6 Feb 2015 18:48:42 +0000 (13:48 -0500)]
cmd/yacc: adjust expansion of $n to be more useful in errors

When the compiler echoes back an expression, it shows the
generated yacc expression. Change the generated code to
use a slice so that $3 shows up as yyDollar[3] in such messages.

Consider changing testdata/expr/expr.y to say:

$$.Sub(float64($1), $3)

(The float64 conversion is incorrect.)

Before:
expr.y:70[expr.go:486]: cannot convert exprS[exprpt - 2].num (type *big.Rat) to type float64

After:
expr.y:70[expr.go:492]: cannot convert exprDollar[1].num (type *big.Rat) to type float64

Change-Id: I74e494069df588e62299d1fccb282f3658d8f8f4
Reviewed-on: https://go-review.googlesource.com/4630
Reviewed-by: Rob Pike <r@golang.org>
9 years agoencoding/xml: encoding name spaces correctly
Roger Peppe [Sat, 10 Jan 2015 14:00:21 +0000 (14:00 +0000)]
encoding/xml: encoding name spaces correctly

The current XML printer does not understand the xmlns
attribute. This change changes it so that it interprets the
xmlns attributes in the tokens being printed, and uses
appropriate prefixes.

Fixes #7535.

Change-Id: I20fae291d20602d37deb41ed42fab4c9a50ec85d
Reviewed-on: https://go-review.googlesource.com/2660
Reviewed-by: Nigel Tao <nigeltao@golang.org>
9 years agoruntime: fix stack corruption in race mode
Dmitry Vyukov [Fri, 13 Feb 2015 14:14:48 +0000 (17:14 +0300)]
runtime: fix stack corruption in race mode

MOVQ RARG0, 0(SP) smashes exactly what was saved by PUSHQ R15.
This code managed to work somehow with the current race runtime,
but corrupts caller arguments with new race runtime that I am testing.

Change-Id: I9ffe8b5eee86451db36e99dbf4d11f320192e576
Reviewed-on: https://go-review.googlesource.com/4810
Reviewed-by: Keith Randall <khr@golang.org>
9 years agoruntime/race: fix test in preparation for new race runtime
Dmitry Vyukov [Fri, 13 Feb 2015 14:19:33 +0000 (17:19 +0300)]
runtime/race: fix test in preparation for new race runtime

New race runtime is more scrupulous about env flags format.

Change-Id: I2828bc737a8be3feae5288ccf034c52883f224d8
Reviewed-on: https://go-review.googlesource.com/4811
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: rename drainworkbuf and drainobjects
Austin Clements [Thu, 12 Feb 2015 20:39:29 +0000 (15:39 -0500)]
runtime: rename drainworkbuf and drainobjects

drainworkbuf is now gcDrain, since it drains until there's
nothing left to drain.  drainobjects is now gcDrainN because it's
the bounded equivalent to gcDrain.

The new names use the Go camel case convention because we have to
start somewhere.  The "gc" prefix is because we don't have runtime
packages yet and just "drain" is too ambiguous.

Change-Id: I88dbdf32e8ce4ce6c3b7e1f234664be9b76cb8fd
Reviewed-on: https://go-review.googlesource.com/4785
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: remove drainallwbufs argument to drainworkbuf
Austin Clements [Thu, 12 Feb 2015 20:30:08 +0000 (15:30 -0500)]
runtime: remove drainallwbufs argument to drainworkbuf

All calls to drainworkbuf now pass true for this argument, so remove
the argument and update the documentation to reflect the simplified
interface.

At a higher level, there are no longer any situations where we drain
"one wbuf" (though drainworkbuf didn't guarantee this anyway).  We
either drain everything, or we drain a specific number of objects.

Change-Id: Ib7ee0fde56577eff64232ee1e711ec57c4361335
Reviewed-on: https://go-review.googlesource.com/4784
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: eliminate drainworkbufs from scanblock
Austin Clements [Thu, 12 Feb 2015 20:22:49 +0000 (15:22 -0500)]
runtime: eliminate drainworkbufs from scanblock

scanblock is only called during _GCscan and _GCmarktermination.
During _GCscan, scanblock didn't call drainworkbufs anyway.  During
_GCmarktermination, there's really no point in draining some (largely
arbitrary) amount of work during the scanblock, since the GC is about
to drain everything anyway, so simply eliminate this case.

Change-Id: I7f3c59ce9186a83037c6f9e9b143181acd04c597
Reviewed-on: https://go-review.googlesource.com/4783
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: eliminate b == 0 special case from scanblock
Austin Clements [Thu, 12 Feb 2015 20:20:13 +0000 (15:20 -0500)]
runtime: eliminate b == 0 special case from scanblock

We no longer ever call scanblock with b == 0.

Change-Id: I9b01da39595e0cc251668c24d58748d88f5f0792
Reviewed-on: https://go-review.googlesource.com/4782
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: replace scanblock(0, 0, nil, nil) with drainworkbuf
Austin Clements [Thu, 12 Feb 2015 20:05:55 +0000 (15:05 -0500)]
runtime: replace scanblock(0, 0, nil, nil) with drainworkbuf

scanblock(0, 0, nil, nil) was just a confusing way of saying

  wbuf = getpartialorempty()
  drainworkbuf(wbuf, true)

Make drainworkbuf accept a nil workbuf and perform the
getpartialorempty itself and replace all uses of scanblock(0, 0, nil,
nil) with direct calls to drainworkbuf(nil, true).

Change-Id: I7002a2f8f3eaf6aa85bbf17ccc81d7288acfef1c
Reviewed-on: https://go-review.googlesource.com/4781
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: move checknocurrentwbuf() from scanblock to drainworkbuf
Austin Clements [Thu, 12 Feb 2015 20:00:54 +0000 (15:00 -0500)]
runtime: move checknocurrentwbuf() from scanblock to drainworkbuf

Previously, scanblock called checknocurrentwbuf() after
drainworkbuf().  Move this call into drainworkbuf so that every return
path from drainworkbuf calls checknocurrentwbuf().  This is equivalent
to the previous code because scanblock was the only caller of
drainworkbuf.

Change-Id: I96ef2168c8aa169bfc4d368f296342fa0fbeafb4
Reviewed-on: https://go-review.googlesource.com/4780
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agocmd/gc: transform closure calls to function calls
Dmitry Vyukov [Fri, 6 Feb 2015 12:09:46 +0000 (15:09 +0300)]
cmd/gc: transform closure calls to function calls

Currently we always create context objects for closures that capture variables.
However, it is completely unnecessary for direct calls of closures
(whether it is func()(), defer func()() or go func()()).
This change transforms any OCALLFUNC(OCLOSURE) to normal function call.
Closed variables become function arguments.
This transformation is especially beneficial for go func(),
because we do not need to allocate context object on heap.
But it makes direct closure calls a bit faster as well (see BenchmarkClosureCall).

On implementation level it required to introduce yet another compiler pass.
However, the pass iterates only over xtop, so it should not be an issue.
Transformation consists of two parts: closure transformation and call site
transformation. We can't run these parts on different sides of escape analysis,
because tree state is inconsistent. We can do both parts during typecheck,
we don't know how to capture variables and don't have call site.
We can't do both parts during walk of OCALLFUNC, because we can walk
OCLOSURE body earlier.
So now capturevars pass only decides how to capture variables
(this info is required for escape analysis). New transformclosure
pass, that runs just before order/walk, does all transformations
of a closure. And later walk of OCALLFUNC(OCLOSURE) transforms call site.

benchmark                            old ns/op     new ns/op     delta
BenchmarkClosureCall                 4.89          3.09          -36.81%
BenchmarkCreateGoroutinesCapture     1634          1294          -20.81%

benchmark                            old allocs     new allocs     delta
BenchmarkCreateGoroutinesCapture     6              2              -66.67%

benchmark                            old bytes     new bytes     delta
BenchmarkCreateGoroutinesCapture     176           48            -72.73%

Change-Id: Ic85e1706e18c3235cc45b3c0c031a9c1cdb7a40e
Reviewed-on: https://go-review.googlesource.com/4050
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/go: make consistent use of leading Tabs
Shenghou Ma [Sun, 8 Feb 2015 23:09:23 +0000 (18:09 -0500)]
cmd/go: make consistent use of leading Tabs

The only remaining uses of four spaces instead of a tab is
when the line is too long (e.g. type Package).

Fixes #9809

Change-Id: Ifffd3639aa9264e795686ef1879a7686f182d2e5
Reviewed-on: https://go-review.googlesource.com/4182
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/gc: restore amd64p32 hack for bucket size
Dmitry Vyukov [Thu, 12 Feb 2015 19:31:27 +0000 (22:31 +0300)]
cmd/gc: restore amd64p32 hack for bucket size

This was accidentially removed in:
https://go-review.googlesource.com/#/c/3508/8/src/cmd/gc/reflect.c

Change-Id: I06dd5bb0cb3e2811bd4ef605d7a5225cfa033fe0
Reviewed-on: https://go-review.googlesource.com/4731
Reviewed-by: Keith Randall <khr@golang.org>
9 years agoruntime: cleanup after conversion to Go
Dmitry Vyukov [Thu, 12 Feb 2015 07:18:31 +0000 (10:18 +0300)]
runtime: cleanup after conversion to Go

Change-Id: I7c41cc6a5ab9fb3b0cc3812cf7e9776884658778
Reviewed-on: https://go-review.googlesource.com/4671
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/5g, cmd/6g, cmd/8g, cmd/9g: use a register to zero in componentgen
Josh Bleecher Snyder [Fri, 9 Jan 2015 20:26:48 +0000 (12:26 -0800)]
cmd/5g, cmd/6g, cmd/8g, cmd/9g: use a register to zero in componentgen

Using a zero register results in shorter, faster code.
5g already did this. Bring 6g, 8g, and 9g up to speed.
Reduces godoc binary size by 0.29% using 6g.

This CL includes cosmetic changes to 5g and 8g.
With those cosmetic changes included, componentgen is now
character-for-character equivalent across the four architectures.

Change-Id: I0e13dd48374bad830c725b117a1c86d4197d390c
Reviewed-on: https://go-review.googlesource.com/2606
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>

9 years agocmd/5g, cmd/6g, cmd/8g, cmd/9g: zero more in componentgen
Josh Bleecher Snyder [Fri, 9 Jan 2015 19:57:51 +0000 (11:57 -0800)]
cmd/5g, cmd/6g, cmd/8g, cmd/9g: zero more in componentgen

Fix a flipped nil check.
The flipped check prevented componentgen
from zeroing a non-cadable nl.
This fix reduces the number of non-SB LEAQs
in godoc from 35323 to 34920 (-1.1%).

Update #1914

Change-Id: I15ea303068835f606f883ddf4a2bb4cb2287e9ae
Reviewed-on: https://go-review.googlesource.com/2605
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>

9 years agocmd/gc: evaluate concrete == interface without allocating
Josh Bleecher Snyder [Wed, 24 Dec 2014 02:28:02 +0000 (18:28 -0800)]
cmd/gc: evaluate concrete == interface without allocating

Consider an interface value i of type I and concrete value c of type C.

Prior to this CL, i==c was evaluated as
I(c) == i

Evaluating I(c) can allocate.

This CL changes the evaluation of i==c to
x, ok := i.(C); ok && x == c

The new generated code is shorter and does not allocate directly.

If C is small, as it is in every instance in the stdlib,
the new code also uses less stack space
and makes one runtime call instead of two.

If C is very large, the original implementation is used.
The cutoff for "very large" is 1<<16,
following the stack vs heap cutoff used elsewhere.

This kind of comparison occurs in 38 places in the stdlib,
mostly in the net and os packages.

benchmark                     old ns/op     new ns/op     delta
BenchmarkEqEfaceConcrete      29.5          7.92          -73.15%
BenchmarkEqIfaceConcrete      32.1          7.90          -75.39%
BenchmarkNeEfaceConcrete      29.9          7.90          -73.58%
BenchmarkNeIfaceConcrete      35.9          7.90          -77.99%

Fixes #9370.

Change-Id: I7c4555950bcd6406ee5c613be1f2128da2c9a2b7
Reviewed-on: https://go-review.googlesource.com/2096
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>

9 years agocmd/6g, cmd/8g: make 2/3 word sgen more efficient
Josh Bleecher Snyder [Fri, 9 Jan 2015 20:41:47 +0000 (12:41 -0800)]
cmd/6g, cmd/8g: make 2/3 word sgen more efficient

When compiling the stdlib most of the calls
to sgen are for exactly 2 or 3 words:
85% for 6g and 70% for 8g.
Special case them for performance.
This optimization is not relevant to 5g and 9g.

6g

benchmark                old ns/op     new ns/op     delta
BenchmarkCopyFat16       3.25          0.82          -74.77%
BenchmarkCopyFat24       5.47          0.95          -82.63%

8g

benchmark               old ns/op     new ns/op     delta
BenchmarkCopyFat8       3.84          2.42          -36.98%
BenchmarkCopyFat12      4.94          2.15          -56.48%

Change-Id: I8bc60b453f12597dfd916df2d072a7d5fc33ab85
Reviewed-on: https://go-review.googlesource.com/2607
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>

9 years agocmd/6g: allocate fewer new registers in sgen
Josh Bleecher Snyder [Fri, 9 Jan 2015 21:03:55 +0000 (13:03 -0800)]
cmd/6g: allocate fewer new registers in sgen

When possible, generate nodl/nodr directly into DI/SI
rather than going through a temporary register.

CX has already been saved; use it during trailing bytes cleanup.

Change-Id: I4ec6209bcc5d3bfdc927c5c132009bd8d791ada3
Reviewed-on: https://go-review.googlesource.com/2608
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>

9 years agomath/big: implemented Float.Int64, simplified Float.Uint64
Robert Griesemer [Wed, 11 Feb 2015 19:22:45 +0000 (11:22 -0800)]
math/big: implemented Float.Int64, simplified Float.Uint64

Change-Id: Ic270ffa7ec6f6dd4b0a951c64ad965447cce1417
Reviewed-on: https://go-review.googlesource.com/4571
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agoruntime: move wbuf-related functions to new gcwork.go
Austin Clements [Thu, 12 Feb 2015 14:58:25 +0000 (09:58 -0500)]
runtime: move wbuf-related functions to new gcwork.go

No code modifications.

This is in preparation for improving the wbuf abstraction.

Change-Id: I719543a345c34d079b7e39b251eccd5dd8a07826
Reviewed-on: https://go-review.googlesource.com/4710
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: on Plan 9, zero memory returned to the brk by sysFree
Austin Clements [Thu, 12 Feb 2015 15:37:01 +0000 (10:37 -0500)]
runtime: on Plan 9, zero memory returned to the brk by sysFree

Plan 9's sysFree has an optimization where if the object being freed
is the last object allocated, it will roll back the brk to allow the
memory to be reused by sysAlloc.  However, it does not zero this
"returned" memory, so as a result, sysAlloc can return non-zeroed
memory after a sysFree.  This leads to corruption because the runtime
assumes sysAlloc returns zeroed memory.

Fix this by zeroing the memory returned by sysFree.

Fixes #9846.

Change-Id: Id328c58236eb7c464b31ac1da376a0b757a5dc6a
Reviewed-on: https://go-review.googlesource.com/4700
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: David du Colombier <0intro@gmail.com>
9 years agodoc: update pre-requisites for bootstrapping
Andrew Gerrand [Wed, 11 Feb 2015 01:44:50 +0000 (12:44 +1100)]
doc: update pre-requisites for bootstrapping

Change-Id: Id86994c8692e29f9d073b6322733ce9219887dc3
Reviewed-on: https://go-review.googlesource.com/4520
Run-TryBot: Andrew Gerrand <adg@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/gc: allocate non-escaping maps on stack
Dmitry Vyukov [Thu, 29 Jan 2015 16:40:02 +0000 (19:40 +0300)]
cmd/gc: allocate non-escaping maps on stack

Extend escape analysis to make(map[k]v).
If it does not escape, allocate temp buffer for hmap and one bucket on stack.

There are 75 cases of non-escaping maps in std lib.

benchmark                                    old allocs     new allocs     delta
BenchmarkConcurrentStmtQuery                 16161          15161          -6.19%
BenchmarkConcurrentTxQuery                   17658          16658          -5.66%
BenchmarkConcurrentTxStmtQuery               16157          15156          -6.20%
BenchmarkConcurrentRandom                    13637          13114          -3.84%
BenchmarkManyConcurrentQueries               22             20             -9.09%
BenchmarkDecodeComplex128Slice               250            188            -24.80%
BenchmarkDecodeFloat64Slice                  250            188            -24.80%
BenchmarkDecodeInt32Slice                    250            188            -24.80%
BenchmarkDecodeStringSlice                   2250           2188           -2.76%
BenchmarkNewEmptyMap                         1              0              -100.00%
BenchmarkNewSmallMap                         2              0              -100.00%

benchmark                old ns/op     new ns/op     delta
BenchmarkNewEmptyMap     124           55.7          -55.08%
BenchmarkNewSmallMap     317           148           -53.31%

benchmark                old allocs     new allocs     delta
BenchmarkNewEmptyMap     1              0              -100.00%
BenchmarkNewSmallMap     2              0              -100.00%

benchmark                old bytes     new bytes     delta
BenchmarkNewEmptyMap     48            0             -100.00%
BenchmarkNewSmallMap     192           0             -100.00%

Fixes #5449

Change-Id: I24fa66f949d2f138885d9e66a0d160240dc9e8fa
Reviewed-on: https://go-review.googlesource.com/3508
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>

9 years agocmd/gc: restore stack frame debugging
Dmitry Vyukov [Wed, 4 Feb 2015 08:26:22 +0000 (11:26 +0300)]
cmd/gc: restore stack frame debugging

Dump frames of functions.
Add function name and var width to output.

Change-Id: Ida06b8def96178fa550ca90836eb4a2509b9e13f
Reviewed-on: https://go-review.googlesource.com/3870
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: fix race instrumentation of append
Dmitry Vyukov [Tue, 10 Feb 2015 12:26:07 +0000 (15:26 +0300)]
runtime: fix race instrumentation of append

typedslicecopy is another write barrier that is not
understood by racewalk. It seems quite complex to handle it
in the compiler, so instead just instrument it in runtime.

Update #9796

Change-Id: I0eb6abf3a2cd2491a338fab5f7da22f01bf7e89b
Reviewed-on: https://go-review.googlesource.com/4370
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/gc: remove several copies of outervalue
Dmitry Vyukov [Tue, 3 Feb 2015 09:48:35 +0000 (12:48 +0300)]
cmd/gc: remove several copies of outervalue

Walk calls it outervalue, racewalk calls it basenod,
isstack does it manually and slightly differently.

Change-Id: Id5b5d32b8faf143fe9d34bd08457bfab6fb33daa
Reviewed-on: https://go-review.googlesource.com/3745
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/gc: allocate buffers for non-escaping string conversions on stack
Dmitry Vyukov [Fri, 30 Jan 2015 06:14:13 +0000 (09:14 +0300)]
cmd/gc: allocate buffers for non-escaping string conversions on stack

Support the following conversions in escape analysis:
[]rune("foo")
[]byte("foo")
string([]rune{})

If the result does not escape, allocate temp buffer on stack
and pass it to runtime functions.

Change-Id: I1d075907eab8b0109ad7ad1878104b02b3d5c690
Reviewed-on: https://go-review.googlesource.com/3590
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: remove obsolete SELinux execmem comment
Brad Fitzpatrick [Thu, 12 Feb 2015 07:20:15 +0000 (23:20 -0800)]
runtime: remove obsolete SELinux execmem comment

We don't have executable memory anymore.

Change-Id: I9835f03a7bcd97d809841ecbed8718b3048bfb32
Reviewed-on: https://go-review.googlesource.com/4681
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agoruntime: move all stdFunctions into os1_windows.go (no code changes)
Alex Brainman [Thu, 12 Feb 2015 03:25:59 +0000 (14:25 +1100)]
runtime: move all stdFunctions into os1_windows.go (no code changes)

Change-Id: I40291561a18bed3ca6be9dca12a664bdf28cb2f1
Reviewed-on: https://go-review.googlesource.com/4660
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: remove unused signals_windows.h
Alex Brainman [Thu, 12 Feb 2015 01:29:37 +0000 (12:29 +1100)]
runtime: remove unused signals_windows.h

Change-Id: I35fe76661c80ca808a711acf608a23c77aeb0608
Reviewed-on: https://go-review.googlesource.com/4651
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agosyscall: Readlink doesn't handle junction on windows
mattn [Tue, 6 Jan 2015 00:47:37 +0000 (09:47 +0900)]
syscall: Readlink doesn't handle junction on windows

Fixes #9190

Change-Id: I22177687ed834feed165454019d28c11fcbf0fa2
Reviewed-on: https://go-review.googlesource.com/2307
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
9 years agocmd/gc: avoid %#016x, which really means Go's %#014x
Russ Cox [Sat, 7 Feb 2015 11:51:44 +0000 (06:51 -0500)]
cmd/gc: avoid %#016x, which really means Go's %#014x

(In non-Go print formats, the 016 includes the leading 0x prefix.
No one noticed, but we were printing hex numbers with a minimum
of 30 digits, not 32.)

Change-Id: I10ff7a51a567ad7c8440418ac034be9e4b2d6bc1
Reviewed-on: https://go-review.googlesource.com/4592
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/gc: use go.builtin as package prefix, not go%2ebuiltin
Russ Cox [Wed, 11 Feb 2015 03:22:33 +0000 (22:22 -0500)]
cmd/gc: use go.builtin as package prefix, not go%2ebuiltin

This matches all the other pseudo-packages.
The line was simply forgotten.

Change-Id: I278f6cbcfc883ea7efad07f99fc8c853b9b5d274
Reviewed-on: https://go-review.googlesource.com/4591
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/gc: make qsort comparisons totally ordered
Russ Cox [Wed, 11 Feb 2015 03:22:50 +0000 (22:22 -0500)]
cmd/gc: make qsort comparisons totally ordered

Otherwise different qsort implementations might result
in different sort orders and therefore different compiled
object files.

Change-Id: Ie783ba55a55af06941307e150b0c406e0a8128b0
Reviewed-on: https://go-review.googlesource.com/4590
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/gc: remove C subclassing trick from popt.c
Russ Cox [Thu, 5 Feb 2015 10:18:08 +0000 (05:18 -0500)]
cmd/gc: remove C subclassing trick from popt.c

It does not convert to Go well.

Being able to do this just once, instead of 4 times, was the primary
motivation for all the recent refactoring (not that it wasn't overdue).

Still bit-for-bit identical.

Change-Id: Ia01f17948441bf64fa78ec4226f0bb40af0bbaab
Reviewed-on: https://go-review.googlesource.com/3962
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/gc: move reg.c into portable code
Russ Cox [Wed, 4 Feb 2015 00:23:18 +0000 (19:23 -0500)]
cmd/gc: move reg.c into portable code

Now there is only one registerizer shared among all the systems.
There are some unfortunate special cases based on arch.thechar
in reg.c, to preserve bit-for-bit compatibility during the refactoring.
Most are probably bugs one way or another and should be revisited.

Change-Id: I153b435c0eaa05bbbeaf8876822eeb6dedaae3cf
Reviewed-on: https://go-review.googlesource.com/3883
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/gc: remove cgen_asop, no longer used
Russ Cox [Tue, 3 Feb 2015 20:27:54 +0000 (15:27 -0500)]
cmd/gc: remove cgen_asop, no longer used

gc/order.c rewrites OASOP nodes into ordinary assignments.
The back ends never see them anymore.

Change-Id: I268ac8bdc92dccd7123110a21f99ada3ceeb2baa
Reviewed-on: https://go-review.googlesource.com/3882
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/gc: factor newly-portable code into gc directory
Russ Cox [Fri, 30 Jan 2015 04:50:10 +0000 (23:50 -0500)]
cmd/gc: factor newly-portable code into gc directory

This isn't everything, but it's a start.
Still producing bit-identical compiler output.

The semantics of the old back ends is preserved,
even when they are probably buggy.
There are some TODOs in gc/gsubr.c to
remove special cases to preserve bugs in 5g and 8g.

Change-Id: I28ae295fbfc94ef9df43e13ab96bd6fc2f194bc4
Reviewed-on: https://go-review.googlesource.com/3802
Reviewed-by: Austin Clements <austin@google.com>
9 years agostrconv: simplified logic resulting in faster float formatting
Robert Griesemer [Wed, 4 Feb 2015 23:07:04 +0000 (15:07 -0800)]
strconv: simplified logic resulting in faster float formatting

benchmark                               old ns/op     new ns/op     delta
BenchmarkFormatFloatDecimal             300           283           -5.67%
BenchmarkFormatFloat                    383           381           -0.52%
BenchmarkFormatFloatExp                 359           357           -0.56%
BenchmarkFormatFloatNegExp              357           358           +0.28%
BenchmarkFormatFloatBig                 468           430           -8.12%
BenchmarkAppendFloatDecimal             104           92.5          -11.06%
BenchmarkAppendFloat                    199           190           -4.52%
BenchmarkAppendFloatExp                 172           167           -2.91%
BenchmarkAppendFloatNegExp              172           169           -1.74%
BenchmarkAppendFloatBig                 280           235           -16.07%
BenchmarkAppendFloat32Integer           104           92.4          -11.15%
BenchmarkAppendFloat32ExactFraction     168           171           +1.79%
BenchmarkAppendFloat32Point             206           199           -3.40%
BenchmarkAppendFloat32Exp               167           167           +0.00%
BenchmarkAppendFloat32NegExp            167           166           -0.60%
BenchmarkAppendFloat64Fixed1            134           129           -3.73%
BenchmarkAppendFloat64Fixed2            144           136           -5.56%
BenchmarkAppendFloat64Fixed3            138           134           -2.90%
BenchmarkAppendFloat64Fixed4            145           138           -4.83%

Change-Id: Ia143840cb34cbd1cebd6b691dd0a45b7264b406c
Reviewed-on: https://go-review.googlesource.com/3920
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agomath/big: completed Float.Uint64
Robert Griesemer [Wed, 11 Feb 2015 00:38:51 +0000 (16:38 -0800)]
math/big: completed Float.Uint64

Change-Id: Ib3738492a2ec8fc99323e687168b17b7239db6ad
Reviewed-on: https://go-review.googlesource.com/4511
Reviewed-by: Alan Donovan <adonovan@google.com>