Russ Cox [Tue, 15 Oct 2013 19:00:48 +0000 (15:00 -0400)]
cmd/cgo: print the builtin prolog after the per-file preamble
The preamble may want to #define some special symbols
and then #include <sys/types.h> itself. The builtin prolog
also #includes <sys/types.h>, which would break such a
preamble (because the second #include will be a no-op).
The use of sys/types.h in the builtin prolog is new since Go 1.1,
so this should preserve the semantics of more existing cgo
code than we would otherwise.
It also fixes src/pkg/syscall/mkall.sh's use of go tool cgo -godefs
on some Linux systems.
undone because the change slows down profile collection
significantly and unpredictable at times (see comments
at https://golang.org/cl/14231047 for details)
««« original CL description
runtime: collect profiles even while on g0 stack
Rob Pike [Fri, 11 Oct 2013 00:26:03 +0000 (17:26 -0700)]
doc/effective_go.html: fix a couple of cosmetic issues
At the moment, godoc expands the example in the link, but in
the past it has not. Add a waffle word to allow either possibility.
Also change the order of cases in the switch in Compare to
be consistent with the other switch in the function.
Dominik Honnef [Thu, 10 Oct 2013 23:30:47 +0000 (16:30 -0700)]
codereview: fix hg sync closing of CLs for subrepositories
The regexp for closing CLs that were sent by you but committed by
someone else only matched messages for the main repository,
because of the added &repo=... for subrepositories.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14512045
Instead of adding an -march=armv5t flag to the gcc command
line, the same effect is obtained with an ".arch armv5t"
pseudo op in the assembly file that uses armv5t instructions.
R=golang-dev, iant, dave
CC=golang-dev
https://golang.org/cl/14511044
Joel Sing [Mon, 7 Oct 2013 16:12:17 +0000 (09:12 -0700)]
os/user: enable tests on all supported platforms
All of the currently supported platforms have a working user
implementation and do not use stubs. As a result, enable the tests
on all platforms rather than whitelisting.
Keith Randall [Fri, 4 Oct 2013 20:54:03 +0000 (13:54 -0700)]
runtime: fix bug in maps at the intersection of iterators, growing, and NaN keys
If an iterator is started while a map is in the middle of a grow,
and the map has NaN keys, then those keys might get returned by
the iterator more than once. This fix makes the evacuation decision
deterministic and repeatable for NaN keys so each one gets returned
only once.
Rob Pike [Thu, 3 Oct 2013 17:40:42 +0000 (10:40 -0700)]
sync/atomic: explain how to subtract an unsigned constant
Explain for those unfamiliar with twos-complement arithmetic how to
implement negation of signed positive constant.
Fixes #6408.
In the longer term, khr's new stacks will avoid needing to
make this decision at all, but for Go 1.2 this is a reasonable
stopgap that makes performance significantly better.
Demand paging should mean that if the second 4 kB is not
used, it will not be brought into memory, so the change
should not adversely affect resident set size.
The same argument could justify bumping as high as 64 kB
on 64-bit machines, but there are diminishing returns
after 8 kB, and using 8 kB limits the possible unintended
memory overheads we are not aware of.
Benchmark graphs at
http://swtch.com/~rsc/gostackamd64.html
http://swtch.com/~rsc/gostack386.html
Dave Day [Thu, 3 Oct 2013 03:48:47 +0000 (13:48 +1000)]
cmd/gc: support -installsuffix in the compiler and builder
Add the -installsuffix flag to gc and {5,6,8}l, which overrides -race
for the suffix if both are supplied.
Pass this flag from the go tool for build and install.
Shenghou Ma [Thu, 3 Oct 2013 00:14:54 +0000 (20:14 -0400)]
misc/dist: support building statically linked toolchain.
so that we don't need worry about specifying the required
libc version (note: as cmd/go will still be dynamically
linked to libc, we still need to perform the build on OSes
with an old enough libc. But as cmd/go doesn't rely on many
libc symbols, the situation should be significantly better).
RawMessage is useful and mildly non-obvious.
Given the frequency with which RawMessage questions
show up on golang-nuts, and get answered with an example,
I suspect adding an example to the docs might help.
Russ Cox [Wed, 2 Oct 2013 16:30:49 +0000 (12:30 -0400)]
runtime: fix finalizer test on amd64
Not scanning the stack by frames means we are reintroducing
a few false positives into the collection. Run the finalizer registration
in its own goroutine so that stack is guaranteed to be out of
consideration in a later collection.
This is working around a regression from yesterday's tip, but
it's not a regression from Go 1.1.
Russ Cox [Wed, 2 Oct 2013 15:59:53 +0000 (11:59 -0400)]
runtime: do not scan stack by frames during garbage collection
Walking the stack by frames is ~3x more expensive
than not, and since it didn't end up being precise,
there is not enough benefit to outweigh the cost.
This is the conservative choice: this CL makes the
stack scanning behavior the same as it was in Go 1.1.
Add benchmarks to package runtime so that we have
them when we re-enable this feature during the
Go 1.3 development.
Shenghou Ma [Wed, 2 Oct 2013 03:44:20 +0000 (23:44 -0400)]
cmd/dist, build: support building statically linked toolchain
Added a new $GO_DISTFLAGS to make.bash, and while we're here,
added mention $CXX in make.bash (CL 13704044).
Fixes #6448.
Update #3564
We can pass GO_DISTFLAGS=-s from misc/dist to make.bash so that
it will build a statically linked toolchain.
(Note: OS X doesn't have the concept of static linking, so don't
pass GO_DISTFLAGS=-s for OS X builds)
Dave Cheney [Sun, 29 Sep 2013 00:34:41 +0000 (10:34 +1000)]
race.bash, race.bat: build a race enabled cmd/cgo before trying to use it
Fixes #5537.
To avoid `go install -v race std` replacing cmd/cgo with a race enabled version and another package trying to build a cgo enabled package, always build cmd/cgo race enabled before doing the rest of the build.
Ian Lance Taylor [Sat, 28 Sep 2013 22:19:05 +0000 (15:19 -0700)]
test: match gccgo error messages for blank1.go
blank1.go:10:9: error: invalid package name _
blank1.go:17:2: error: cannot use _ as value
blank1.go:18:7: error: cannot use _ as value
blank1.go:20:8: error: invalid use of ‘_’
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14088044
Ian Lance Taylor [Sat, 28 Sep 2013 03:38:52 +0000 (20:38 -0700)]
test: recognize gccgo error message in index.go
When a floating point constant is used as an array/slice
index, gccgo prints "error: index must be integer"; gc prints
"constant 2.1 truncated to integer".
Carl Shapiro [Fri, 27 Sep 2013 04:59:13 +0000 (21:59 -0700)]
reflect: expose reflect.call argument slice to the garbage collector
The argument slice was kept hidden from the garbage collector
by destroying its referent in an unsafe.Pointer to uintptr
conversion. This change preserves the unsafe.Pointer referent
and only performs an unsafe.Pointer to uintptr conversions
within expressions that construct new unsafe.Pointer values.
Adam Langley [Thu, 26 Sep 2013 21:09:56 +0000 (17:09 -0400)]
crypto/tls: don't select TLS 1.2 cipher suites in prior versions.
AES-GCM cipher suites are only defined for TLS 1.2, although there's
nothing really version specific about them. However, development
versions of NSS (meaning Firefox and Chrome) have an issue where
they'll advertise TLS 1.2-only cipher suites in a TLS 1.1 ClientHello
but then balk when the server selects one.
This change causes Go clients not to advertise TLS 1.2 cipher suites
unless TLS 1.2 is being used, and prevents servers from selecting them
unless TLS 1.2 has been negotiated.