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.
Dave Cheney [Thu, 26 Sep 2013 11:35:49 +0000 (21:35 +1000)]
runtime, syscall: update freebsd/arm calling convention to match EABI
Fixes #6451.
There is still some breakages unrelated to the syscall change.
[root@beaglebone ~/go/src]# /root/go/pkg/tool/freebsd_arm/go_bootstrap version
go version devel freebsd/arm
a std@beaglebone ~/go/src]# /root/go/pkg/tool/freebsd_arm/go_bootstrap install -
fatal error: mark - finalizer inconsistency
Rob Pike [Wed, 25 Sep 2013 00:00:09 +0000 (10:00 +1000)]
html/template: update the Tree field after parsing new templates
After text/template.Parse, all the templates may have changed, so
we need to set them all back to their unescaped state. The code
did this but (mea culpa) forgot to set the Tree field of the html/template
struct.
Since the Tree is reset during escaping, this only matters if an error
arises during escaping and we want to print a message.
Alex Brainman [Tue, 24 Sep 2013 03:15:49 +0000 (13:15 +1000)]
net: re-enable raw socket tests on windows
Since CL 38bf89161a72 raw socket tests are not executed
on windows builders. This change re-enable them again.
It will attempt to run raw socket tests only if user
is permitted to create raw socket by OS.
encoding/json: don't cache value addressability when building first encoder
newTypeEncoder (called once per type and then cached) was
looking at the first value seen of that type's addressability
and caching the encoder decision. If the first value seen was
addressable and a future one wasn't, it would panic.
Instead, introduce a new wrapper encoder type that checks
CanAddr at runtime.
Rob Pike [Mon, 23 Sep 2013 06:03:57 +0000 (16:03 +1000)]
fmt: one bad index shouldn't spoil them all
In an indexed verb such as %[3]d, if the index is out of range, don't
skip processing the rest of the verbs. The bug was that the bad
index set a bit for the whole format instead of just the verb.
Ok for 1.2 because this is a bug in a 1.2 feature.
misc/notepadplus: fix some number syntax highlight issue
notepadplus can only support some normal golang's hex and imaginary numbers.
it can't detect some special number, eg. 1./1.e/1.i/1+0.1i (omit "0" in ".0").
Carl Shapiro [Sat, 21 Sep 2013 00:27:56 +0000 (17:27 -0700)]
test/chan: avoid wrap-around in memstats comparison
The select2.go test assumed that the memory allocated between
its two samplings of runtime.ReadMemStats is strictly
increasing. To avoid failing the tests when this is not true,
a greater-than check is introduced before computing the
difference in allocated memory.
cmd/gc: print expression in 'duplicate case in switch' error
The line number alone does not help when the line is
case '~', '*', '(', ')', '[', ']', '{', '}', '?', ':', ';', ',', '*', '%', '^', '!', '=', '<', '>', '+', '-', '&', '|':
runtime: avoid allocation of internal panic values
If a fault happens in malloc, inevitably the next thing that happens
is a deadlock trying to allocate the panic value that says the fault
happened. Stop doing that, two ways.
First, reject panic in malloc just as we reject panic in garbage collection.
Second, runtime.panicstring was using an error implementation
backed by a Go string, so the interface held an allocated *string.
Since the actual errors are C strings, define a new error
implementation backed by a C char*, which needs no indirection
and therefore no allocation.
This second fix will avoid allocation for errors like nil panic derefs
or division by zero, so it is worth doing even though the first fix
should take care of faults during malloc.
Update #6419
R=golang-dev, dvyukov, dave
CC=golang-dev
https://golang.org/cl/13774043
This eliminates ~75% of the nil checks being emitted,
on all architectures. We can do better, but we need
a bit more general support from the compiler, and
I don't want to do that so close to Go 1.2.
What's here is simple but effective and safe.
A few small code generation cleanups were required
to make the analysis consistent on all systems about
which nil checks are omitted, at least in the test.
Adam Langley [Tue, 17 Sep 2013 17:30:36 +0000 (13:30 -0400)]
crypto/tls: don't select ECDSA ciphersuites with only an RSA certificate.
47ec7a68b1a2 added support for ECDSA ciphersuites but didn't alter the
cipher suite selection to take that into account. Thus Go servers could
try and select an ECDSA cipher suite while only having an RSA
certificate, leading to connection failures.
text/template/parse, html/template: copy Tree.text during html template clone
The root cause of the panic reported in https://code.google.com/p/go/issues/detail?id=5980
is that parse's Tree.Text wasn't being copied during the clone.
Fix this by adding and using a Copy method for parse.Tree.
Fixes #5980.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12420044
Carl Shapiro [Tue, 17 Sep 2013 02:03:19 +0000 (19:03 -0700)]
runtime: export PCDATA value reader
This interface is required to use the PCDATA interface
implemented in Go 1.2. While initially entirely private, the
FUNCDATA side of the interface has been made public. This
change completes the FUNCDATA/PCDATA interface.
Hide container symbols like text and etext so that
the individual pieces inside are shown instead.
For example, if text and main.init have the same
address, it was a toss-up which name was printed.
The code for call site-specific pointer bitmaps was not ready in time,
but the zeroing required without it is too expensive to use by default.
We will have to wait for precise collection of stack frames until Go 1.3.
The precise collection can be re-enabled by
GOEXPERIMENT=precisestack ./all.bash
but that will not be the default for a Go 1.2 build.
Fixes #6087.
R=golang-dev, jeremyjackins, dan.kortschak, r
CC=golang-dev
https://golang.org/cl/13677045