1
0
mirror of https://github.com/golang/go synced 2024-10-04 21:11:22 -06:00
go/src/cmd
Keith Randall 60fd32a47f cmd/compile: change the way we handle large map values
mapaccess{1,2} returns a pointer to the value.  When the key
is not in the map, it returns a pointer to zeroed memory.
Currently, for large map values we have a complicated scheme which
dynamically allocates zeroed memory for this purpose.  It is ugly
code and requires an atomic.Load in a bunch of places we'd rather
not have it.

Switch to a scheme where callsites of mapaccess{1,2} which expect
large return values pass in a pointer to zeroed memory that
mapaccess can return if the key is not found.  This avoids the
atomic.Load on all map accesses with a few extra instructions only
for the large value acccesses, plus a bit of bss space.

There was a time (1.4 & 1.5?) where we did something like this but
all the tricks to make the right size zero value were done by the
linker.  That scheme broke in the presence of dyamic linking.
The scheme in this CL works even when dynamic linking.

Fixes #12337

Change-Id: Ic2d0319944af33bbb59785938d9ab80958d1b4b1
Reviewed-on: https://go-review.googlesource.com/22221
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
2016-04-20 21:15:31 +00:00
..
addr2line cmd/addr2line: simplify windows test 2015-06-17 14:23:20 +00:00
api all: delete dead non-test code 2016-03-25 06:28:13 +00:00
asm cmd: remove unnecessary type conversions 2016-04-15 02:32:10 +00:00
cgo cmd/cgo: add missing formatting directive in error message 2016-04-15 22:03:22 +00:00
compile cmd/compile: change the way we handle large map values 2016-04-20 21:15:31 +00:00
cover all: single space after period. 2016-03-02 00:13:47 +00:00
dist cmd/compile/internal/s390x: add s390x support 2016-04-12 14:38:17 +00:00
doc all: delete dead non-test code 2016-03-25 06:28:13 +00:00
fix all: single space after period. 2016-03-02 00:13:47 +00:00
go cmd/go: mention that _test.go files are ignored when building 2016-04-18 04:05:23 +00:00
gofmt cmd/gofmt: make gofmt -s simplify slices in presence of dot-imports 2016-04-06 18:19:33 +00:00
internal cmd/internal/obj, cmd/link: random style cleanups 2016-04-15 06:54:36 +00:00
link cmd/link: move ppc64 genplt declarations into loop 2016-04-20 19:10:59 +00:00
nm all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
objdump cmd/objdump: skip TestDisasm* on s390x 2016-04-12 18:10:47 +00:00
pack cmd/pack,vet: use go doc instead of godoc in doc 2016-03-17 21:06:40 +00:00
pprof cmd/pprof/internal: move to cmd/internal/pprof 2016-04-12 15:02:28 +00:00
trace misc/trace: update trace viewer html 2016-04-14 14:48:04 +00:00
vet cmd: remove unnecessary type conversions 2016-04-15 02:32:10 +00:00
yacc all: delete dead non-test code 2016-03-25 06:28:13 +00:00