]> Cypherpunks repositories - gostls13.git/log
gostls13.git
10 years agoimage/color: add alpha-premultiplied comment.
Nigel Tao [Wed, 18 Mar 2015 22:46:43 +0000 (09:46 +1100)]
image/color: add alpha-premultiplied comment.

Change-Id: I9968f53a8286a0e5ccc197a9b5fae499e2f95326
Reviewed-on: https://go-review.googlesource.com/7790
Reviewed-by: Rob Pike <r@golang.org>
10 years agoruntime: fix return values for open/read/write/close on openbsd/arm
Joel Sing [Tue, 17 Mar 2015 11:55:40 +0000 (22:55 +1100)]
runtime: fix return values for open/read/write/close on openbsd/arm

Change-Id: I5b057d16eed1b364e608ff0fd74de323da6492bc
Reviewed-on: https://go-review.googlesource.com/7679
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime: fix linux/amd64p32 build
Dave Cheney [Sat, 21 Mar 2015 02:19:33 +0000 (13:19 +1100)]
runtime: fix linux/amd64p32 build

Implement runtime.atomicand8 for amd64p32 which was overlooked
in CL 7861.

Change-Id: Ic7eccddc6fd6c4682cac1761294893928f5428a2
Reviewed-on: https://go-review.googlesource.com/7920
Reviewed-by: Minux Ma <minux@golang.org>
10 years agospec: extend type omission rules for composite literal element values
Robert Griesemer [Fri, 9 Jan 2015 00:01:31 +0000 (16:01 -0800)]
spec: extend type omission rules for composite literal element values
      to map element keys

Composite literals containing element values that are themselves composite
literals may leave away the element's literal types if they are identical
to the enclosing composite literal's element type.

(http://golang.org/ref/spec#Composite_literals)

When we made this change, we forgot to apply the analogous rule to map
literal keys. This change generalizes that rule. Added more examples,
including one showing the recursive application of the elision rules.

This is a fully backward-compatible language change. It was discussed
some time back.

Fixes #8589.

To be submitted once all compilers accept the extension.

Change-Id: I4d45b64b5970f0d5501572945d5a097e64a9458b
Reviewed-on: https://go-review.googlesource.com/2591
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/go: Delete some unused code.
Jeremy Schlatter [Fri, 20 Mar 2015 21:18:17 +0000 (21:18 +0000)]
cmd/go: Delete some unused code.

Change-Id: I5e11a76ebb20284618144be2ef5449d3202b6222
Reviewed-on: https://go-review.googlesource.com/7900
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agogo/parser: permit type elision from composite literal map keys
Robert Griesemer [Fri, 9 Jan 2015 21:19:19 +0000 (13:19 -0800)]
go/parser: permit type elision from composite literal map keys

Per pending https://go-review.googlesource.com/2591 .

Change-Id: I1ce9d1c629e9fc43dbd862b3433aa5840f46656c
Reviewed-on: https://go-review.googlesource.com/2621
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agomath/big: enable pure Go (no assembly) build with build tag
Robert Griesemer [Fri, 20 Mar 2015 20:02:56 +0000 (13:02 -0700)]
math/big: enable pure Go (no assembly) build with build tag

To use a pure Go implementation of the low-level arithmetic
functions (when no platform-specific assembly implementations
are available), set the build tag math_big_pure_go.

This will make it easy to vendor the math/big package where no
assembly is available (for instance for use with gc which relies
on 1.4 functionality for now).

Change-Id: I91e17c0fdc568a20ec1512d7c64621241dc60c17
Reviewed-on: https://go-review.googlesource.com/7856
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocmd/internal/gc: inline x := y.(*T) and x, ok := y.(*T)
Russ Cox [Fri, 20 Mar 2015 04:06:10 +0000 (00:06 -0400)]
cmd/internal/gc: inline x := y.(*T) and x, ok := y.(*T)

These can be implemented with just a compare and a move instruction.
Do so, avoiding the overhead of a call into the runtime.

These assertions are a significant cost in Go code that uses interface{}
as a safe alternative to C's void* (or unsafe.Pointer), such as the
current version of the Go compiler.

*T here includes pointer to T but also any Go type represented as
a single pointer (chan, func, map). It does not include [1]*T or struct{*int}.
That requires more work in other parts of the compiler; there is a TODO.

Change-Id: I7ff681c20d2c3eb6ad11dd7b3a37b1f3dda23965
Reviewed-on: https://go-review.googlesource.com/7862
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/gc: move cgen, regalloc, et al to portable code
Russ Cox [Wed, 18 Mar 2015 21:26:36 +0000 (17:26 -0400)]
cmd/internal/gc: move cgen, regalloc, et al to portable code

This CL moves the bulk of the code that has been copy-and-pasted
since the initial 386 port back into a shared place, cutting 5 copies to 1.

The motivation here is not cleanup per se but instead to reduce the
cost of introducing changes in shared concepts like regalloc or general
expression evaluation. For example, a change after this one will
implement x.(*T) without a call into the runtime. This CL makes that
followup work 5x easier.

The single copy still has more special cases for architecture details
than I'd like, but having them called out explicitly like this at least
opens the door to generalizing the conditions and smoothing out
the distinctions in the future.

This is a LARGE CL. I started by trying to pull in one function at a time
in a sequence of CLs and it became clear that everything was so
interrelated that it had to be moved as a whole. Apologies for the size.

It is not clear how many more releases this code will matter for;
eventually it will be replaced by Keith's SSA work. But as noted above,
the deduplication was necessary to reduce the cost of working on
the current code while we have it.

Passes tests on amd64, 386, arm, and ppc64le.
Can build arm64 binaries but not tested there.
Being able to build binaries means it is probably very close.

Change-Id: I735977f04c0614f80215fb12966dfe9bbd1f5861
Reviewed-on: https://go-review.googlesource.com/7853
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agohtml/template: fix crash when escaping incomplete template
Rob Pike [Fri, 20 Mar 2015 17:47:52 +0000 (10:47 -0700)]
html/template: fix crash when escaping incomplete template

text/template turned this into an error but html/template crashed.
Refactor text/template.Execute to export a new function,
text/template.DefinedTemplates, so html/template can get the same
helpful error message in this case, and invoke it when there is no
definition for a template being escaped.

Fixes #10204.

Change-Id: I1d04e9e7ebca829bc08509caeb65e75da969711f
Reviewed-on: https://go-review.googlesource.com/7855
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agobytes, os/exec, strings: fix a few BUG comments
areski [Mon, 22 Dec 2014 17:16:15 +0000 (18:16 +0100)]
bytes, os/exec, strings: fix a few BUG comments

Regular expression noteMarker requires the definition of a (who) section
when reading note from a sequence of comments.

Change-Id: I9635de9b86f00d20ec108097fee4d4a8f76237b2
Reviewed-on: https://go-review.googlesource.com/1952
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoos: don't return Chmod's error from Mkdir and OpenFile
Kato Kazuyoshi [Tue, 23 Dec 2014 05:05:07 +0000 (21:05 -0800)]
os: don't return Chmod's error from Mkdir and OpenFile

Mkdir and OpenFile call Chmod internally on *BSD and Solaris,
because these OSes don't handle the sticky bit correctly.

However Chmod's error should be ignored. It shouldn't hide
the fact that a file itself is created.

Fixes #8383

Change-Id: Ia2e0b2ba72712d73a0a48ba5a263432e0fff31a5
Reviewed-on: https://go-review.googlesource.com/2057
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/internal/gc: remove dead code
Robert Griesemer [Thu, 19 Mar 2015 23:43:28 +0000 (16:43 -0700)]
cmd/internal/gc: remove dead code

Change-Id: I6b49ca1b7ee39d138aafad5875767ce93a6344f3
Reviewed-on: https://go-review.googlesource.com/7851
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/internal/gc: use big.Int to represent Mpint bits
Robert Griesemer [Wed, 18 Mar 2015 21:10:22 +0000 (14:10 -0700)]
cmd/internal/gc: use big.Int to represent Mpint bits

- renamed (existing) Mpint -> Mpfix
- defined (new) Mpint using big.Int
- modified funcs mpxxx operating on new Mpint
- renamed funcs mpxxx -> _mpxxx if still needed with Mpfix
- left old (possibly unused) code in place for comparison

Passes all.bash.

Change-Id: I1fc7bba7dc4b6386f2f0950d745cec17c1e67615

cmd/internal/gc: renamed Mpint -> Mpfix

Change-Id: Ia06aeae1081ef29d5ad9b711fb57e4c5579ce29b
Reviewed-on: https://go-review.googlesource.com/7830
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoruntime: exit getfull barrier if there are partial workbufs
Austin Clements [Thu, 19 Mar 2015 21:46:18 +0000 (17:46 -0400)]
runtime: exit getfull barrier if there are partial workbufs

Currently, we only exit the getfull barrier if there is work on the
full list, even though the exit path will take work from either the
full or partial list. Change this to exit the barrier if there is work
on either the full or partial lists.

I believe it's currently safe to check only the full list, since
during mark termination there is no reason to put a workbuf on a
partial list. However, checking both is more robust.

Change-Id: Icf095b0945c7cad326a87ff2f1dc49b7699df373
Reviewed-on: https://go-review.googlesource.com/7840
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: document subtlety around entering mark termination
Austin Clements [Thu, 19 Mar 2015 18:37:30 +0000 (14:37 -0400)]
runtime: document subtlety around entering mark termination

The barrier in gcDrain does not account for concurrent gcDrainNs
happening in gchelpwork, so it can actually return while there is
still work being done. It turns out this is okay, but for subtle
reasons involving gcDrainN always being run on the system
stack. Document these reasons.

Change-Id: Ib07b3753cc4e2b54533ab3081a359cbd1c3c08fb
Reviewed-on: https://go-review.googlesource.com/7736
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agomime/quotedprintable: add writer
Alexandre Cesaro [Thu, 26 Feb 2015 20:23:31 +0000 (21:23 +0100)]
mime/quotedprintable: add writer

Updates #4943

Change-Id: I082b97ccd787cf91245d39b8d93783732db6f42c
Reviewed-on: https://go-review.googlesource.com/6171
Reviewed-by: Nigel Tao <nigeltao@golang.org>
10 years agoruntime: fix arm build
Russ Cox [Fri, 20 Mar 2015 04:59:37 +0000 (00:59 -0400)]
runtime: fix arm build

Make mask uint32, and move down one line to match atomic_arm64.go.

Change-Id: I4867de494bc4076b7c2b3bf4fd74aa984e3ea0c8
Reviewed-on: https://go-review.googlesource.com/7854
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/internal/gc: move componentgen into portable code
Russ Cox [Wed, 18 Mar 2015 16:29:40 +0000 (12:29 -0400)]
cmd/internal/gc: move componentgen into portable code

Change-Id: I652cc7a33a186d1041f62f6e7581421496832a27
Reviewed-on: https://go-review.googlesource.com/7747
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
10 years agocmd/internal/gc: increase registerization limits
Russ Cox [Mon, 9 Mar 2015 19:34:06 +0000 (15:34 -0400)]
cmd/internal/gc: increase registerization limits

Also clean up code a little.

Change-Id: I23b7d2b7871b31e0974f1305e54f0c18dcab05d9
Reviewed-on: https://go-review.googlesource.com/7746
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/gc: cache ProgInfo in Prog
Russ Cox [Mon, 16 Mar 2015 20:46:25 +0000 (16:46 -0400)]
cmd/internal/gc: cache ProgInfo in Prog

The ProgInfo is loaded many times during each analysis pass.
Load it once at the beginning (in Flowstart if using that, or explicitly,
as in plive.go) and then refer to the cached copy.

Removes many calls to proginfo.

Makes Prog a little bigger, but the previous CL more than compensates.

Change-Id: If90a12fc6729878fdae10444f9c3bedc8d85026e
Reviewed-on: https://go-review.googlesource.com/7745
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
10 years agocmd/internal/obj: replace Addr.U struct {...} with Val interface{}
Russ Cox [Mon, 16 Mar 2015 19:54:44 +0000 (15:54 -0400)]
cmd/internal/obj: replace Addr.U struct {...} with Val interface{}

An interface{} is more in the spirit of the original union.
By my calculations, on 64-bit systems this reduces
Addr from 120 to 80 bytes, and Prog from 592 to 424 bytes.

Change-Id: I0d7b0981513c2a3c94c9ac76bb4f8816485b5a3c
Reviewed-on: https://go-review.googlesource.com/7744
Reviewed-by: Rob Pike <r@golang.org>
10 years agoruntime: implement atomicand8 atomically
Russ Cox [Thu, 19 Mar 2015 23:42:16 +0000 (19:42 -0400)]
runtime: implement atomicand8 atomically

We're skating on thin ice, and things are finally starting to melt around here.
(I want to avoid the debugging session that will happen when someone
uses atomicand8 expecting it to be atomic with respect to other operations.)

Change-Id: I254f1582be4eb1f2d7fbba05335a91c6bf0c7f02
Reviewed-on: https://go-review.googlesource.com/7861
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/6g: allow componentgen of slice inside struct
Russ Cox [Mon, 9 Mar 2015 19:42:49 +0000 (15:42 -0400)]
cmd/6g: allow componentgen of slice inside struct

Change-Id: I847bf32bd0be913fad277c5e657f44df147eee14
Reviewed-on: https://go-review.googlesource.com/7729
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/internal/obj/x86: fix duffcopy/duffzero for GOEXPERIMENT=framepointer
Russ Cox [Tue, 17 Mar 2015 01:19:08 +0000 (21:19 -0400)]
cmd/internal/obj/x86: fix duffcopy/duffzero for GOEXPERIMENT=framepointer

Change-Id: I99aee6dff97a4abcaf5a9cddb505ba90b65667ea
Reviewed-on: https://go-review.googlesource.com/7728
Reviewed-by: Rob Pike <r@golang.org>
10 years agotesting: document that flag.Parse is not called when TestMain runs
Shenghou Ma [Mon, 16 Mar 2015 01:08:57 +0000 (21:08 -0400)]
testing: document that flag.Parse is not called when TestMain runs

Fixes #9825.

Change-Id: Id7eeaa14c26201db34db0820371c92a63af485b0
Reviewed-on: https://go-review.googlesource.com/7604
Reviewed-by: Rob Pike <r@golang.org>
10 years agocrypto/x509: document that DecryptPEMBlock cannot detect all cases of incorrect password
Shenghou Ma [Sun, 15 Mar 2015 22:38:56 +0000 (18:38 -0400)]
crypto/x509: document that DecryptPEMBlock cannot detect all cases of incorrect password

Fixes #10171.

Change-Id: I1b2e30ebbb2b9d66680008674baa96e550efe1f2
Reviewed-on: https://go-review.googlesource.com/7603
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>

10 years agocmd/internal/obj: shuffle link.go to put declarations in original order
Russ Cox [Mon, 16 Mar 2015 19:31:32 +0000 (15:31 -0400)]
cmd/internal/obj: shuffle link.go to put declarations in original order

I think the file ended up in the order of the typedefs instead of the
order of the actual struct definitions. You can see where some of
the declarations were because some of the comments didn't move.
Put things back in the original order.

Change-Id: I0e3703008278b084b632c917cfb73bc81bdd4f23
Reviewed-on: https://go-review.googlesource.com/7743
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
10 years agocmd/internal/gc: change Naddr to take a *Addr to fill in
Russ Cox [Mon, 16 Mar 2015 19:27:19 +0000 (15:27 -0400)]
cmd/internal/gc: change Naddr to take a *Addr to fill in

This allows gins to let Naddr fill in p.From and p.To directly,
avoiding the zeroing and copying of a temporary.

Change-Id: I96d120afe266e68f94d5e82b00886bf6bd458f85
Reviewed-on: https://go-review.googlesource.com/7742
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
10 years agocmd/dist: add //line to copied bootstrap files
Russ Cox [Mon, 16 Mar 2015 19:18:49 +0000 (15:18 -0400)]
cmd/dist: add //line to copied bootstrap files

This way the error messages will show the original file name
in addition to the bootstrap file name, so that you have some
chance of making the correction in the original instead of the copy
(which will be blown away).

Before:
/Users/rsc/g/go/pkg/bootstrap/src/bootstrap/5g/gsubr.go:863: undefined: a

After:
/Users/rsc/g/go/src/cmd/5g/gsubr.go:860[/Users/rsc/g/go/pkg/bootstrap/src/bootstrap/5g/gsubr.go:863]: undefined: a

Change-Id: I8d6006abd9499edb16d9f27fe8b7dc6cae143fca
Reviewed-on: https://go-review.googlesource.com/7741
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: add GODEBUG=sbrk=1 to bypass memory allocator (and GC)
Russ Cox [Mon, 9 Mar 2015 00:56:15 +0000 (20:56 -0400)]
runtime: add GODEBUG=sbrk=1 to bypass memory allocator (and GC)

To reduce lock contention in this mode, makes persistent allocation state per-P,
which means at most 64 kB overhead x $GOMAXPROCS, which should be
completely tolerable.

Change-Id: I34ca95e77d7e67130e30822e5a4aff6772b1a1c5
Reviewed-on: https://go-review.googlesource.com/7740
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoRevert "cmd/internal/gc: add internConcat for alloc-free string concatenation"
Russ Cox [Thu, 19 Mar 2015 23:38:24 +0000 (23:38 +0000)]
Revert "cmd/internal/gc: add internConcat for alloc-free string concatenation"

This reverts commit 42fcc6fea03673eeed1447eaab78a7df9385246e.

Change-Id: If860b7cbff5b5d288c1df1405c1765275dfba7cb
Reviewed-on: https://go-review.googlesource.com/7860
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/internal/gc: add internConcat for alloc-free string concatenation
Josh Bleecher Snyder [Thu, 19 Mar 2015 16:28:02 +0000 (09:28 -0700)]
cmd/internal/gc: add internConcat for alloc-free string concatenation

This is a follow-up to review comments on CL 7696.

I believe that this includes the first regular Go test in the compiler.

No functional changes. Passes toolstash -cmp.

Change-Id: Id45f51aa664c5d52ece2a61cd7d8417159ce3cf0
Reviewed-on: https://go-review.googlesource.com/7820
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agonet/http/pprof: Correct body tag in index template
Quoc-Viet Nguyen [Thu, 19 Mar 2015 14:40:37 +0000 (00:40 +1000)]
net/http/pprof: Correct body tag in index template

The body tag in the pprof template was misplaced.

Change-Id: Icd7948b358f52df1acc7e033ab27a062990ef977
Reviewed-on: https://go-review.googlesource.com/7795
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocmd/dist: re-disable android test
David Crawshaw [Thu, 19 Mar 2015 19:36:54 +0000 (15:36 -0400)]
cmd/dist: re-disable android test

Accidentally turned on in golang.org/cl/7734.

Change-Id: I8d72c279150a0b93732a2ac41b82fbb3cd7bf9d3
Reviewed-on: https://go-review.googlesource.com/7737
Reviewed-by: Burcu Dogan <jbd@google.com>
10 years agocmd/dist: update android testing TODO, add iOS
David Crawshaw [Thu, 19 Mar 2015 17:15:56 +0000 (13:15 -0400)]
cmd/dist: update android testing TODO, add iOS

This CL updates a TODO on a condition excluding a lot of tests on
android, clarifying what needs to be done. Several of the tests should
be turned off, for example anything depending on the Go tool, others
should be enabled. (See #8345, comment 3 for more details.)

Also add iOS, which has the same set of restrictions.

Tested manually on linux/amd64, darwin/amd64, android/arm, darwin/arm.

Updates #8345

Change-Id: I147f0a915426e0e0de9a73f9aea353766156609b
Reviewed-on: https://go-review.googlesource.com/7734
Reviewed-by: Burcu Dogan <jbd@google.com>
10 years agocmd/internal/gc: remove duplicate copyright notice
Robert Griesemer [Wed, 18 Mar 2015 17:37:53 +0000 (10:37 -0700)]
cmd/internal/gc: remove duplicate copyright notice

Change-Id: Ifa71fb443a66eb8d7732f3b0c1408947b583c1f1
Reviewed-on: https://go-review.googlesource.com/7800
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/internal/gc: fix broken build
Josh Bleecher Snyder [Thu, 19 Mar 2015 16:49:25 +0000 (09:49 -0700)]
cmd/internal/gc: fix broken build

CL 7697 caused doasm failures on 386:

runtime/append_test.go:1: doasm: notfound ft=2 tt=20 00112 (runtime/iface_test.go:207) CMPL $0, BX 2 20

I think that this should be fixed in liblink,
but in the meantime, work around the problem
by instead generating CMPL BX, $0.

Change-Id: I9c572f8f15fc159507132cf4ace8d7a328a3eb4a
Reviewed-on: https://go-review.googlesource.com/7810
Reviewed-by: Keith Randall <khr@golang.org>
10 years agocmd/internal/gc, runtime: speed up some cases of _, ok := i.(T)
Josh Bleecher Snyder [Tue, 17 Mar 2015 22:14:31 +0000 (15:14 -0700)]
cmd/internal/gc, runtime: speed up some cases of _, ok := i.(T)

Some type assertions of the form _, ok := i.(T) allow efficient inlining.
Such type assertions commonly show up in type switches.
For example, with this optimization, using 6g, the length of
encoding/binary's intDataSize function shrinks from 2224 to 1728 bytes (-22%).

benchmark                    old ns/op     new ns/op     delta
BenchmarkAssertI2E2Blank     4.67          0.82          -82.44%
BenchmarkAssertE2T2Blank     4.38          0.83          -81.05%
BenchmarkAssertE2E2Blank     3.88          0.83          -78.61%
BenchmarkAssertE2E2          14.2          14.4          +1.41%
BenchmarkAssertE2T2          10.3          10.4          +0.97%
BenchmarkAssertI2E2          13.4          13.3          -0.75%

Change-Id: Ie9798c3e85432bb8e0f2c723afc376e233639df7
Reviewed-on: https://go-review.googlesource.com/7697
Reviewed-by: Keith Randall <khr@golang.org>
10 years agocmd/internal/gc: clean up walk conv* and assert*
Josh Bleecher Snyder [Tue, 17 Mar 2015 20:56:29 +0000 (13:56 -0700)]
cmd/internal/gc: clean up walk conv* and assert*

This is preliminary cleanup for another change.

No functional changes. Passes toolstash -cmp.

Change-Id: I11d562fbd6cba5c48d9636f3149e210e5f5308ad
Reviewed-on: https://go-review.googlesource.com/7696
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime: combine gcWorkProducer into gcWork
Austin Clements [Thu, 12 Mar 2015 17:09:30 +0000 (13:09 -0400)]
runtime: combine gcWorkProducer into gcWork

The distinction between gcWorkProducer and gcWork (producer and
consumer) is not serving us as originally intended, so merge these
into just gcWork.

The original intent was to replace the currentwbuf cache with a
gcWorkProducer. However, with gchelpwork (aka mutator assists),
mutators can both produce and consume work, so it will make more sense
to cache a whole gcWork.

Change-Id: I6e633e96db7cb23a64fbadbfc4607e3ad32bcfb3
Reviewed-on: https://go-review.googlesource.com/7733
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: don't use cached wbuf in markroot
Austin Clements [Thu, 12 Mar 2015 17:03:50 +0000 (13:03 -0400)]
runtime: don't use cached wbuf in markroot

Currently markroot fetches the wbuf to fill from the per-M wbuf
cache. The wbuf cache is primarily meant for the write barrier because
it produces very little work on each call. There's little point to
using the cache in mark root, since each call to markroot is likely to
produce a large amount of work (so the slight win on getting it from
the cache instead of from the central wbuf lists doesn't matter), and
markroot does not dispose the wbuf back to the cache (so most markroot
calls won't get anything from the wbuf cache anyway).

Instead, just get the wbuf from the central wbuf lists like other work
producers. This will simplify later changes.

Change-Id: I07a18a4335a41e266a6d70aa3a0911a40babce23
Reviewed-on: https://go-review.googlesource.com/7732
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: run concurrent mark phase on regular stack
Austin Clements [Wed, 18 Mar 2015 15:22:12 +0000 (11:22 -0400)]
runtime: run concurrent mark phase on regular stack

Currently, the GC's concurrent mark phase runs on the system
stack. There's no need to do this, and running it this way ties up the
entire M and P running the GC by preventing the scheduler from
preempting the GC even during concurrent mark.

Fix this by running concurrent mark on the regular G stack. It's still
non-preemptible because we also set preemptoff around the whole GC
process, but this moves us closer to making it preemptible.

Change-Id: Ia9f1245e299b8c5c513a4b1e3ef13eaa35ac5e73
Reviewed-on: https://go-review.googlesource.com/7730
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: improve comment in concurrent GC
Austin Clements [Tue, 17 Mar 2015 19:31:11 +0000 (15:31 -0400)]
runtime: improve comment in concurrent GC

"Sync" is not very informative. What's being synchronized and with
whom? Update this comment to explain what we're really doing: enabling
write barriers.

Change-Id: I4f0cbb8771988c7ba4606d566b77c26c64165f0f
Reviewed-on: https://go-review.googlesource.com/7700
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: remove pointless harvestwbufs
Austin Clements [Tue, 17 Mar 2015 19:28:57 +0000 (15:28 -0400)]
runtime: remove pointless harvestwbufs

Currently we harvestwbufs the moment we enter the mark phase, even
before starting the world again. Since cached wbufs are only filled
when we're in mark or mark termination, they should all be empty at
this point, making the harvest pointless. Remove the harvest.

We should, but do not currently harvest at the end of the mark phase
when we're running out of work to do.

Change-Id: I5f4ba874f14dd915b8dfbc4ee5bb526eecc2c0b4
Reviewed-on: https://go-review.googlesource.com/7669
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: remove out of date comment
Austin Clements [Mon, 16 Mar 2015 18:41:59 +0000 (14:41 -0400)]
runtime: remove out of date comment

Change-Id: I0ad1a81a235c7c067fea2093bbeac4e06a233c10
Reviewed-on: https://go-review.googlesource.com/7661
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: delete old .h files
Josh Bleecher Snyder [Sun, 15 Mar 2015 03:03:29 +0000 (20:03 -0700)]
runtime: delete old .h files

Change-Id: I5a49f56518adf7d64ba8610b51ea1621ad888fc4
Reviewed-on: https://go-review.googlesource.com/7771
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/internal/gc: speed up large string switches
Josh Bleecher Snyder [Tue, 17 Mar 2015 23:10:31 +0000 (16:10 -0700)]
cmd/internal/gc: speed up large string switches

Switch statements do a binary search on long runs of constants.
Doing a less-than comparison on a string is much more expensive
than on (say) an int. Use two part comparison for strings:
First compare length, then the strings themselves.

Benchmarks from issue 10000:

benchmark                  old ns/op     new ns/op     delta
BenchmarkIf0               3.36          3.35          -0.30%
BenchmarkIf1               4.45          4.47          +0.45%
BenchmarkIf2               5.22          5.26          +0.77%
BenchmarkIf3               5.56          5.58          +0.36%
BenchmarkIf4               10.5          10.6          +0.95%
BenchmarkIfNewStr0         5.26          5.30          +0.76%
BenchmarkIfNewStr1         7.19          7.15          -0.56%
BenchmarkIfNewStr2         7.23          7.16          -0.97%
BenchmarkIfNewStr3         7.47          7.43          -0.54%
BenchmarkIfNewStr4         12.4          12.2          -1.61%
BenchmarkSwitch0           9.56          4.24          -55.65%
BenchmarkSwitch1           8.64          5.58          -35.42%
BenchmarkSwitch2           9.38          10.1          +7.68%
BenchmarkSwitch3           8.66          5.00          -42.26%
BenchmarkSwitch4           7.99          8.18          +2.38%
BenchmarkSwitchNewStr0     11.3          6.12          -45.84%
BenchmarkSwitchNewStr1     11.1          8.33          -24.95%
BenchmarkSwitchNewStr2     11.0          11.1          +0.91%
BenchmarkSwitchNewStr3     10.3          6.93          -32.72%
BenchmarkSwitchNewStr4     11.0          11.2          +1.82%

Fixes #10000

Change-Id: Ia2fffc32e9843425374c274064f709ec7ee46d80
Reviewed-on: https://go-review.googlesource.com/7698
Reviewed-by: Keith Randall <khr@golang.org>
10 years agoruntime: fix minor typo
Josh Bleecher Snyder [Wed, 18 Mar 2015 00:01:34 +0000 (17:01 -0700)]
runtime: fix minor typo

Change-Id: I79b7ed8f7e78e9d35b5e30ef70b98db64bc68a7b
Reviewed-on: https://go-review.googlesource.com/7720
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoall: use "reports whether" in place of "returns true if(f)"
Josh Bleecher Snyder [Tue, 17 Feb 2015 23:44:42 +0000 (15:44 -0800)]
all: use "reports whether" in place of "returns true if(f)"

Comment changes only.

Change-Id: I56848814564c4aa0988b451df18bebdfc88d6d94
Reviewed-on: https://go-review.googlesource.com/7721
Reviewed-by: Rob Pike <r@golang.org>
10 years agoruntime: add a select test
Dmitry Vyukov [Fri, 13 Mar 2015 10:37:57 +0000 (13:37 +0300)]
runtime: add a select test

One of my earlier versions of finer-grained select locking
failed on this test. If you just naively lock and check channels
one-by-one, it is possible that you skip over ready channels.
Consider that initially c1 is ready and c2 is not. Select checks c2.
Then another goroutine makes c1 not ready and c2 ready (in that order).
Then select checks c1, concludes that no channels are ready and
executes the default case. But there was no point in time when
no channel is ready and so default case must not be executed.

Change-Id: I3594bf1f36cfb120be65e2474794f0562aebcbbd
Reviewed-on: https://go-review.googlesource.com/7550
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agobufio: fix incorrect comment on Scanner.Scan
Aaron Jacobs [Tue, 17 Mar 2015 21:14:07 +0000 (08:14 +1100)]
bufio: fix incorrect comment on Scanner.Scan

Change-Id: I216511a4bce431de0a468f618a7a7c4da79e2979
Reviewed-on: https://go-review.googlesource.com/7710
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocrypto/tls: disable RC4 by default.
Adam Langley [Tue, 17 Mar 2015 00:13:10 +0000 (17:13 -0700)]
crypto/tls: disable RC4 by default.

RC4 is frowned upon[1] at this point and major providers are disabling it
by default[2].

Those who still need RC4 support in crypto/tls can enable it by
specifying the CipherSuites slice in crypto/tls.Config explicitly.

Fixes #10094.

[1] https://tools.ietf.org/html/rfc7465
[2] https://blog.cloudflare.com/killing-rc4-the-long-goodbye/

Change-Id: Ia03a456f7e7a4362b706392b0e3c4cc93ce06f9f
Reviewed-on: https://go-review.googlesource.com/7647
Reviewed-by: Andrew Gerrand <adg@golang.org>
10 years agocrypto/tls: panic with unknown hash functions.
Adam Langley [Mon, 16 Mar 2015 23:45:29 +0000 (16:45 -0700)]
crypto/tls: panic with unknown hash functions.

Just so that we notice in the future if another hash function is added
without updating this utility function, make it panic when passed an
unknown handshake hash function. (Which should never happen.)

Change-Id: I60a6fc01669441523d8c44e8fbe7ed435e7f04c8
Reviewed-on: https://go-review.googlesource.com/7646
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Joël Stemmer <stemmertech@gmail.com>
10 years agocrypto/{ecdsa,rsa}: always use io.ReadFull with crypto/rand.Reader.
Adam Langley [Mon, 16 Mar 2015 23:42:12 +0000 (16:42 -0700)]
crypto/{ecdsa,rsa}: always use io.ReadFull with crypto/rand.Reader.

crypto/rand.Reader doesn't ensure that short reads don't happen. This
change contains a couple of fixups where io.ReadFull wasn't being used
with it.

Change-Id: I3855b81f5890f2e703112eeea804aeba07b6a6b8
Reviewed-on: https://go-review.googlesource.com/7645
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
10 years agocmd/go: don't crash on unknown GOARCH unless we actually care
Ian Lance Taylor [Tue, 17 Mar 2015 19:58:10 +0000 (12:58 -0700)]
cmd/go: don't crash on unknown GOARCH unless we actually care

For example, "GOARCH=sparc go build -compiler=gccgo" should not crash
merely because the architecture character for sparc is not known.

Change-Id: I18912c7f5d90ef8f586592235ec9d6e5053e4bef
Reviewed-on: https://go-review.googlesource.com/7695
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agomath/big: clearer semantics for Float.Scan
Robert Griesemer [Tue, 17 Mar 2015 18:15:30 +0000 (11:15 -0700)]
math/big: clearer semantics for Float.Scan

Change-Id: I72e8389ec080be8a0119f98df898de6f5510fa4d
Reviewed-on: https://go-review.googlesource.com/7693
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agocmd/internal/gc: add a comment to esc.go
David Chase [Tue, 17 Mar 2015 19:48:06 +0000 (15:48 -0400)]
cmd/internal/gc: add a comment to esc.go

Change-Id: I19e6542e7d79d60e39d62339da51a827c5aa6d3b
Reviewed-on: https://go-review.googlesource.com/7668
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoruntime: fix writebarrier throw in lock_sema
Russ Cox [Tue, 17 Mar 2015 19:07:05 +0000 (15:07 -0400)]
runtime: fix writebarrier throw in lock_sema

The value in question is really a bit pattern
(a pointer with extra bits thrown in),
so treat it as a uintptr instead, avoiding the
generation of a write barrier when there
might not be a p.

Also add the obligatory //go:nowritebarrier.

Change-Id: I4ea097945dd7093a140f4740bcadca3ce7191971
Reviewed-on: https://go-review.googlesource.com/7667
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
10 years agoruntime: Remove write barriers during STW.
Rick Hudson [Thu, 12 Mar 2015 18:19:21 +0000 (14:19 -0400)]
runtime: Remove write barriers during STW.

The GC assumes that there will be no asynchronous write barriers when
the world is stopped. This keeps the synchronization between write
barriers and the GC simple. However, currently, there are a few places
in runtime code where this assumption does not hold.
The GC stops the world by collecting all Ps, which stops all user Go
code, but small parts of the runtime can run without a P. For example,
the code that releases a P must still deschedule its G onto a runnable
queue before stopping. Similarly, when a G returns from a long-running
syscall, it must run code to reacquire a P.
Currently, this code can contain write barriers. This can lead to the
GC collecting reachable objects if something like the following
sequence of events happens:
1. GC stops the world by collecting all Ps.
2. G #1 returns from a syscall (for example), tries to install a
pointer to object X, and calls greyobject on X.
3. greyobject on G #1 marks X, but does not yet add it to a write
buffer. At this point, X is effectively black, not grey, even though
it may point to white objects.
4. GC reaches X through some other path and calls greyobject on X, but
greyobject does nothing because X is already marked.
5. GC completes.
6. greyobject on G #1 adds X to a work buffer, but it's too late.
7. Objects that were reachable only through X are incorrectly collected.
To fix this, we check the invariant that no asynchronous write
barriers happen when the world is stopped by checking that write
barriers always have a P, and modify all currently known sources of
these writes to disable the write barrier. In all modified cases this
is safe because the object in question will always be reachable via
some other path.

Some of the trace code was turned off, in particular the
code that traces returning from a syscall. The GC assumes
that as far as the heap is concerned the thread is stopped
when it is in a syscall. Upon returning the trace code
must not do any heap writes for the same reasons discussed
above.

Fixes #10098
Fixes #9953
Fixes #9951
Fixes #9884

May relate to #9610 #9771

Change-Id: Ic2e70b7caffa053e56156838eb8d89503e3c0c8a
Reviewed-on: https://go-review.googlesource.com/7504
Reviewed-by: Austin Clements <austin@google.com>
10 years agoruntime: copy env strings on startup
David Crawshaw [Tue, 17 Mar 2015 14:18:30 +0000 (10:18 -0400)]
runtime: copy env strings on startup

Some versions of libc, in this case Android's bionic, point environ
directly at the envp memory.

https://android.googlesource.com/platform/bionic/+/master/libc/bionic/libc_init_common.cpp#104

The Go runtime does something surprisingly similar, building the
runtime's envs []string using gostringnocopy. Both libc and the Go
runtime reusing memory interacts badly. When syscall.Setenv uses cgo
to call setenv(3), C modifies the underlying memory of a Go string.

This manifests on android/arm. With GOROOT=/data/local/tmp, a
runtime test calls syscall.Setenv("/os"), resulting in
runtime.GOROOT()=="/os\x00a/local/tmp/goroot".

Avoid this by copying environment string memory into Go.

Covered by runtime.TestFixedGOROOT on android/arm.

Change-Id: Id0cf9553969f587addd462f2239dafca1cf371fa
Reviewed-on: https://go-review.googlesource.com/7663
Reviewed-by: Keith Randall <khr@golang.org>
10 years agomath/big: cleaner handling of exponent under/overflow
Robert Griesemer [Fri, 6 Mar 2015 01:32:57 +0000 (17:32 -0800)]
math/big: cleaner handling of exponent under/overflow

Fixed several corner-case bugs and added corresponding tests.

Change-Id: I23096b9caeeff0956f65ab59fa91e168d0e47bb8
Reviewed-on: https://go-review.googlesource.com/7001
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agoruntime: fix comment
Dmitry Vyukov [Fri, 13 Mar 2015 13:02:47 +0000 (16:02 +0300)]
runtime: fix comment

IRIW requires 4 threads: first writes x, second writes y,
third reads x and y, fourth reads y and x.
This is Peterson/Dekker mutual exclusion algorithm based on
critical store-load sequences:
http://en.wikipedia.org/wiki/Dekker's_algorithm
http://en.wikipedia.org/wiki/Peterson%27s_algorithm

Change-Id: I30a00865afbe895f7617feed4559018f81ff4528
Reviewed-on: https://go-review.googlesource.com/7561
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: remove futile wakeups from trace
Dmitry Vyukov [Wed, 11 Mar 2015 15:29:12 +0000 (18:29 +0300)]
runtime: remove futile wakeups from trace

Channels and sync.Mutex'es allow another goroutine to acquire resource
ahead of an unblocked goroutine. This is good for performance, but
leads to futile wakeups (the unblocked goroutine needs to block again).
Futile wakeups caused user confusion during the very first evaluation
of tracing functionality on a real server (a goroutine as if acquires a mutex
in a loop, while there is no loop in user code).

This change detects futile wakeups on channels and emits a special event
to denote the fact. Later parser finds entire wakeup sequences
(unblock->start->block) and removes them.

sync.Mutex will be supported in a separate change.

Change-Id: Iaaaee9d5c0921afc62b449a97447445030ac19d3
Reviewed-on: https://go-review.googlesource.com/7380
Reviewed-by: Keith Randall <khr@golang.org>
10 years agoruntime/cgo: catch EXC_BAD_ACCESS on darwin/arm
David Crawshaw [Sun, 8 Mar 2015 15:37:02 +0000 (11:37 -0400)]
runtime/cgo: catch EXC_BAD_ACCESS on darwin/arm

The Go builders (and standard development cycle) for programs on iOS
require running the programs under lldb. Unfortunately lldb intercepts
SIGSEGV and will not give it back.

https://llvm.org/bugs/show_bug.cgi?id=22868

We get around this by never letting lldb see the SIGSEGV. On darwin,
Unix signals are emulated on top of mach exceptions. The debugger
registers a task-level mach exception handler. We register a
thread-level exception handler which acts as a faux signal handler.
The thread-level handler gets precedence over the task-level handler,
so we can turn the exception EXC_BAD_ACCESS into a panic before lldb
can see it.

Fixes #10043

Change-Id: I64d7c310dfa7ecf60eb1e59f094966520d473335
Reviewed-on: https://go-review.googlesource.com/7072
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>

10 years agotest: fix recover4 test on 64kb systems
Dave Cheney [Tue, 17 Mar 2015 03:56:04 +0000 (14:56 +1100)]
test: fix recover4 test on 64kb systems

Fix recover4.go to work on 64kb systems.

Change-Id: I211cb048de1268a8bbac77c6f3a1e0b8c8277594
Reviewed-on: https://go-review.googlesource.com/7673
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/yacc: fix path in documentation
Jeremy Jackins [Tue, 17 Mar 2015 04:00:31 +0000 (13:00 +0900)]
cmd/yacc: fix path in documentation

Change-Id: I367b5a837844e3bee1576c59497d37f5e67c761d
Reviewed-on: https://go-review.googlesource.com/7674
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoRevert "test: disable recover4 test to fix ppc64 builds"
Dave Cheney [Tue, 17 Mar 2015 03:37:31 +0000 (03:37 +0000)]
Revert "test: disable recover4 test to fix ppc64 builds"

This reverts commit 1313e7982f44c24948e73c4795d9606265d36871.

Change-Id: I96cc58baf71156fdfbf8fd61332744bcc3ea52e5
Reviewed-on: https://go-review.googlesource.com/7670
Reviewed-by: Dave Cheney <dave@cheney.net>
10 years agotest: disable recover4 test to fix ppc64 builds
Dave Cheney [Tue, 17 Mar 2015 01:38:53 +0000 (12:38 +1100)]
test: disable recover4 test to fix ppc64 builds

Updates #10180

Temporarily disable this test on ppc64 systems as all our builders use 64k page size.

We need a portable way to get the page size of the host so we can correctly size the mmap hole.

Change-Id: Ibd36ebe2f54cf75a44667e2070c385f0daaca481
Reviewed-on: https://go-review.googlesource.com/7652
Reviewed-by: Andrew Gerrand <adg@golang.org>
10 years agoruntime: factor object dumping code out of greyobject
Austin Clements [Thu, 12 Mar 2015 18:26:04 +0000 (14:26 -0400)]
runtime: factor object dumping code out of greyobject

When checkmark fails, greyobject dumps both the object that pointed to
the unmarked object and the unmarked object. This code cluttered up
greyobject, was copy-pasted for the two objects, and the copy for
dumping the unmarked object was not entirely correct.

Extract object dumping out to a new function. This declutters
greyobject and fixes the bugs in dumping the unmarked object. The new
function is slightly cleaned up from the original code to have more
natural control flow and shows a marker on the field in the base
object that points to the unmarked object to make it easy to find.

Change-Id: Ib51318a943f50b0b99995f0941d03ee8876b9fcf
Reviewed-on: https://go-review.googlesource.com/7506
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: fix out of date comment
Austin Clements [Thu, 12 Mar 2015 15:20:02 +0000 (11:20 -0400)]
runtime: fix out of date comment

scanobject no longer returns the new wbuf.

Change-Id: I0da335ae5cd7ef7ea0e0fa965cf0e9f3a650d0e6
Reviewed-on: https://go-review.googlesource.com/7505
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agocmd/internal/gc: mv builtins builtin
Russ Cox [Mon, 16 Mar 2015 23:03:09 +0000 (19:03 -0400)]
cmd/internal/gc: mv builtins builtin

This directory is processed by mkbuiltin.go and generates builtin.go.
It should be named builtin too, not builtins, both for consistency
and because file and directory names in general are singular unless
forced otherwise.

Commented on CL 6233 too.

Change-Id: Ic5d3671443ae9292b69fda118f61a11c88d823fa
Reviewed-on: https://go-review.googlesource.com/7660
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/6g: make proginfo register bits constants
Russ Cox [Tue, 10 Mar 2015 19:18:10 +0000 (15:18 -0400)]
cmd/6g: make proginfo register bits constants

Also replace proginfo call with cheaper calls where only flags are needed.

Change-Id: Ib6e5c12bd8752b87c0d8bcf22fa9e25e04a7941f
Reviewed-on: https://go-review.googlesource.com/7630
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/obj/x86: minor optimization
Russ Cox [Fri, 13 Mar 2015 15:58:13 +0000 (11:58 -0400)]
cmd/internal/obj/x86: minor optimization

- avoid copy in range ytab
- add fast path to prefixof

Change-Id: I88aa9d91a0abe80d253f7c3bca950b4613297499
Reviewed-on: https://go-review.googlesource.com/7628
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/gc: fmt.Sprintf elimination and minor cleanup
Russ Cox [Thu, 12 Mar 2015 22:45:30 +0000 (18:45 -0400)]
cmd/internal/gc: fmt.Sprintf elimination and minor cleanup

Change-Id: Iaf5a7d25e6308b32c17a38afbbd46befa17aa3a4
Reviewed-on: https://go-review.googlesource.com/7629
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/...: remove use of func() { ... }() in loop increment
Russ Cox [Mon, 9 Mar 2015 04:31:13 +0000 (00:31 -0400)]
cmd/...: remove use of func() { ... }() in loop increment

These were introduced during C -> Go translation when the loop increment
contained multiple statements.

Change-Id: Ic8abd8dcb3308851a1f7024de00711f0f984e684
Reviewed-on: https://go-review.googlesource.com/7627
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/gc: add -d disablenil debug option to turn off nil checks
Russ Cox [Sun, 8 Mar 2015 22:46:28 +0000 (18:46 -0400)]
cmd/internal/gc: add -d disablenil debug option to turn off nil checks

Change-Id: I18f2e2ee141ebb65a8579ee1e440cb9c2069ef86
Reviewed-on: https://go-review.googlesource.com/7626
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/gc: rewrite argtype to substitute in a single pass
Russ Cox [Sun, 8 Mar 2015 17:33:49 +0000 (13:33 -0400)]
cmd/gc: rewrite argtype to substitute in a single pass

Substituting in multiple passes meant walking the type
multiple times, and worse, if a complex type was substituted
in an early pass, later passes would follow it, possibly recursively,
until hitting the depth 10 limit.

Change-Id: Ie61d6ec08438e297baabe932afe33d08f358e55f
Reviewed-on: https://go-review.googlesource.com/7625
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/dist: show reason for command failure
Russ Cox [Sun, 8 Mar 2015 17:33:39 +0000 (13:33 -0400)]
cmd/dist: show reason for command failure

Change-Id: I9fb5c1c11a750766ae2d9532869d5ab26f1cf9cf
Reviewed-on: https://go-review.googlesource.com/7624
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
10 years agocmd/internal/obj: reimplement line history
Russ Cox [Mon, 9 Mar 2015 02:41:48 +0000 (22:41 -0400)]
cmd/internal/obj: reimplement line history

In addition to possibly being clearer code,
this replaces an O(n) lookup with an O(log n) lookup.

Change-Id: I0a574c536a965a87f7ad6dcdcc30f737bc771cd5
Reviewed-on: https://go-review.googlesource.com/7623
Reviewed-by: Rob Pike <r@golang.org>
10 years agocrypto/tls: return correct hash function when using client certificates in handshake
Joël Stemmer [Fri, 6 Mar 2015 13:08:55 +0000 (14:08 +0100)]
crypto/tls: return correct hash function when using client certificates in handshake

Commit f1d669aee994b28e1afcfe974680565932d25b70 added support for
AES_256_GCM_SHA384 cipher suites as specified in RFC5289. However, it
did not take the arbitrary hash function into account in the TLS client
handshake when using client certificates.

The hashForClientCertificate method always returned SHA256 as its
hashing function, even if it actually used a different one to calculate
its digest. Setting up the connection would eventually fail with the
error "tls: failed to sign handshake with client certificate:
crypto/rsa: input must be hashed message".

Included is an additional test for this specific situation that uses the
SHA384 hash.

Fixes #9808

Change-Id: Iccbf4ab225633471ef897907c208ad31f92855a3
Reviewed-on: https://go-review.googlesource.com/7040
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>

10 years agocrypto/rsa: implement crypto.Decrypter
Nick Sullivan [Wed, 25 Feb 2015 01:55:25 +0000 (17:55 -0800)]
crypto/rsa: implement crypto.Decrypter

Decrypter is an interface to support opaque private keys that perform
decryption operations. This interface is analogous to the crypto.Signer
interface.

This change introduces the crypto.Decrypter interface and implements
the crypto.Decrypter interface for rsa.PrivateKey with both OAEP and
PKCS#1 v1.5 padding modes.

Change-Id: I433f649f84ed3c2148337d735cafd75f1d94a904
Reviewed-on: https://go-review.googlesource.com/3900
Reviewed-by: Adam Langley <agl@golang.org>
10 years agocmd/internal/obj: add basic test of line history
Russ Cox [Sat, 14 Mar 2015 22:50:18 +0000 (18:50 -0400)]
cmd/internal/obj: add basic test of line history

Change-Id: Ic22e004b43bd98e712befb30684be16d8214c94a
Reviewed-on: https://go-review.googlesource.com/7622
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/obj: use map for symbol table
Russ Cox [Mon, 9 Mar 2015 02:45:13 +0000 (22:45 -0400)]
cmd/internal/obj: use map for symbol table

Change-Id: I105c1e7730c1e7ccf36297b9cbf96dc0a4868013
Reviewed-on: https://go-review.googlesource.com/7621
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/pprof/internal/profile: insert blank line after non-doc comment
Russ Cox [Thu, 12 Mar 2015 18:26:05 +0000 (14:26 -0400)]
cmd/pprof/internal/profile: insert blank line after non-doc comment

Change-Id: I91fe72c60d6c41644780474620e05380e9af2a3d
Reviewed-on: https://go-review.googlesource.com/7620
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
10 years agotest: add test that variables captured by deferred funcs are current on fault
Russ Cox [Wed, 11 Mar 2015 15:52:19 +0000 (11:52 -0400)]
test: add test that variables captured by deferred funcs are current on fault

This came up in private mail.
It works today and I want to make sure it stays working.

Change-Id: I13ebdc2dfadb3c72d7f179be89883137320c05d0
Reviewed-on: https://go-review.googlesource.com/7390
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Rob Pike <r@golang.org>
10 years agotext/template: protect against explicit nil in field chains
Rob Pike [Tue, 13 Jan 2015 22:13:42 +0000 (09:13 +1100)]
text/template: protect against explicit nil in field chains

An explicit nil in an expression like nil.Foo caused a panic
because the evaluator attempted to reflect on the nil.
A typeless nil like this cannot be used to do anything, so
just error out.

Fixes #9426

Change-Id: Icd2c9c7533dda742748bf161eced163991a12f54
Reviewed-on: https://go-review.googlesource.com/7643
Reviewed-by: David Symonds <dsymonds@golang.org>
10 years agodoc/go_mem.html: correct the channel example
Shenghou Ma [Sun, 15 Mar 2015 22:21:08 +0000 (18:21 -0400)]
doc/go_mem.html: correct the channel example

While we're here, also fix two HTML issues.

Fixes #9235.

Change-Id: I6e2f50931c0f387881271484a726ac2308518cf4
Reviewed-on: https://go-review.googlesource.com/7602
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/gc: remove dead code
Josh Bleecher Snyder [Mon, 16 Mar 2015 19:24:51 +0000 (12:24 -0700)]
cmd/internal/gc: remove dead code

Change-Id: Id5ce859bd4b6318dc9104f7377ae23d7f0bc30cd
Reviewed-on: https://go-review.googlesource.com/7640
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/objdump: disable TestDisasm.* on arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 13:29:44 +0000 (14:29 +0100)]
cmd/objdump: disable TestDisasm.* on arm64

ARM64 doesn't have disassembler yet.

Change-Id: I016fa013b5ff50dc49d38ade42351b79be023d80
Reviewed-on: https://go-review.googlesource.com/7149
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoos/signal, hash/crc32: add arm64 build tags
Aram Hăvărneanu [Sun, 8 Mar 2015 13:28:35 +0000 (14:28 +0100)]
os/signal, hash/crc32: add arm64 build tags

Change-Id: I6ca9caec8ccf12618e56dcf6b83328e7acf8b1ec
Reviewed-on: https://go-review.googlesource.com/7148
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agotest: fix nosplit test, and disable nilptr3 test on arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 13:27:51 +0000 (14:27 +0100)]
test: fix nosplit test, and disable nilptr3 test on arm64

Change-Id: I5d40e04395de743a8fdcfa8bdc0e580729bc66a3
Reviewed-on: https://go-review.googlesource.com/7147
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoreflect: add support for GOARCH=arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 13:26:40 +0000 (14:26 +0100)]
reflect: add support for GOARCH=arm64

Change-Id: I033eecff5e5838ba677378ac884bf5f29267e880
Reviewed-on: https://go-review.googlesource.com/7146
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agosync/atomic: add support for GOARCH=arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 13:26:18 +0000 (14:26 +0100)]
sync/atomic: add support for GOARCH=arm64

Change-Id: I11cd4b5e8daf3805af0eaa83b55b20da889702f4
Reviewed-on: https://go-review.googlesource.com/7145
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agomath, math/big: add support for GOARCH=arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 13:25:50 +0000 (14:25 +0100)]
math, math/big: add support for GOARCH=arm64

Change-Id: Ief12e1435a40dd2eaddc3f97f63be44c4dd2e050
Reviewed-on: https://go-review.googlesource.com/7144
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agosyscall: add support for GOARCH=arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 13:21:00 +0000 (14:21 +0100)]
syscall: add support for GOARCH=arm64

Change-Id: Ia817e78d9678a365a76fea5e4dbe8f8a5aab0bac
Reviewed-on: https://go-review.googlesource.com/7143
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoruntime: add support for linux/arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 13:20:20 +0000 (14:20 +0100)]
runtime: add support for linux/arm64

Change-Id: Ibda6a5bedaff57fd161d63fc04ad260931d34413
Reviewed-on: https://go-review.googlesource.com/7142
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/dist: add support for GOARCH=arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 13:18:23 +0000 (14:18 +0100)]
cmd/dist: add support for GOARCH=arm64

Change-Id: I92b4301b64054272d78dd15c16bf6ff592acad26
Reviewed-on: https://go-review.googlesource.com/7141
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/cgo: add support for GOARCH=arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 13:17:46 +0000 (14:17 +0100)]
cmd/cgo: add support for GOARCH=arm64

Change-Id: Ia6c3d5e7a32b20e3c45d9485e66b48cd02644280
Reviewed-on: https://go-review.googlesource.com/7140
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/7g: add ARM64 Go compiler, based on 9g
Aram Hăvărneanu [Sun, 8 Mar 2015 13:16:29 +0000 (14:16 +0100)]
cmd/7g: add ARM64 Go compiler, based on 9g

No peep optimizer yet.

Change-Id: Ifa5f993cd6ac5e34783c0df41faf772fbce96ae2
Reviewed-on: https://go-review.googlesource.com/7049
Reviewed-by: Russ Cox <rsc@golang.org>