2015-02-13 14:40:36 -05:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
package gc
|
|
|
|
|
|
|
|
|
|
import (
|
2016-03-12 14:07:40 -08:00
|
|
|
"cmd/compile/internal/ssa"
|
cmd/compile: factor out Pkg, Sym, and Type into package types
- created new package cmd/compile/internal/types
- moved Pkg, Sym, Type to new package
- to break cycles, for now we need the (ugly) types/utils.go
file which contains a handful of functions that must be installed
early by the gc frontend
- to break cycles, for now we need two functions to convert between
*gc.Node and *types.Node (the latter is a dummy type)
- adjusted the gc's code to use the new package and the conversion
functions as needed
- made several Pkg, Sym, and Type methods functions as needed
- renamed constructors typ, typPtr, typArray, etc. to types.New,
types.NewPtr, types.NewArray, etc.
Passes toolstash-check -all.
Change-Id: I8adfa5e85c731645d0a7fd2030375ed6ebf54b72
Reviewed-on: https://go-review.googlesource.com/39855
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-04-04 17:54:02 -07:00
|
|
|
"cmd/compile/internal/types"
|
2015-02-13 14:40:36 -05:00
|
|
|
"cmd/internal/obj"
|
2016-12-06 17:08:06 -08:00
|
|
|
"cmd/internal/src"
|
cmd/compile: add initial backend concurrency support
This CL adds initial support for concurrent backend compilation.
BACKGROUND
The compiler currently consists (very roughly) of the following phases:
1. Initialization.
2. Lexing and parsing into the cmd/compile/internal/syntax AST.
3. Translation into the cmd/compile/internal/gc AST.
4. Some gc AST passes: typechecking, escape analysis, inlining,
closure handling, expression evaluation ordering (order.go),
and some lowering and optimization (walk.go).
5. Translation into the cmd/compile/internal/ssa SSA form.
6. Optimization and lowering of SSA form.
7. Translation from SSA form to assembler instructions.
8. Translation from assembler instructions to machine code.
9. Writing lots of output: machine code, DWARF symbols,
type and reflection info, export data.
Phase 2 was already concurrent as of Go 1.8.
Phase 3 is planned for eventual removal;
we hope to go straight from syntax AST to SSA.
Phases 5–8 are per-function; this CL adds support for
processing multiple functions concurrently.
The slowest phases in the compiler are 5 and 6,
so this offers the opportunity for some good speed-ups.
Unfortunately, it's not quite that straightforward.
In the current compiler, the latter parts of phase 4
(order, walk) are done function-at-a-time as needed.
Making order and walk concurrency-safe proved hard,
and they're not particularly slow, so there wasn't much reward.
To enable phases 5–8 to be done concurrently,
when concurrent backend compilation is requested,
we complete phase 4 for all functions
before starting later phases for any functions.
Also, in reality, we automatically generate new
functions in phase 9, such as method wrappers
and equality and has routines.
Those new functions then go through phases 4–8.
This CL disables concurrent backend compilation
after the first, big, user-provided batch of
functions has been compiled.
This is done to keep things simple,
and because the autogenerated functions
tend to be small, few, simple, and fast to compile.
USAGE
Concurrent backend compilation still defaults to off.
To set the number of functions that may be backend-compiled
concurrently, use the compiler flag -c.
In future work, cmd/go will automatically set -c.
Furthermore, this CL has been intentionally written
so that the c=1 path has no backend concurrency whatsoever,
not even spawning any goroutines.
This helps ensure that, should problems arise
late in the development cycle,
we can simply have cmd/go set c=1 always,
and revert to the original compiler behavior.
MUTEXES
Most of the work required to make concurrent backend
compilation safe has occurred over the past month.
This CL adds a handful of mutexes to get the rest of the way there;
they are the mutexes that I didn't see a clean way to avoid.
Some of them may still be eliminable in future work.
In no particular order:
* gc.funcsymsmu. The global funcsyms slice is populated
lazily when we need function symbols for closures.
This occurs during gc AST to SSA translation.
The function funcsym also does a package lookup,
which is a source of races on types.Pkg.Syms;
funcsymsmu also covers that package lookup.
This mutex is low priority: it adds a single global,
it is in an infrequently used code path, and it is low contention.
Since funcsyms may now be added in any order,
we must sort them to preserve reproducible builds.
* gc.largeStackFramesMu. We don't discover until after SSA compilation
that a function's stack frame is gigantic.
Recording that error happens basically never,
but it does happen concurrently.
Fix with a low priority mutex and sorting.
* obj.Link.hashmu. ctxt.hash stores the mapping from
types.Syms (compiler symbols) to obj.LSyms (linker symbols).
It is accessed fairly heavily through all the phases.
This is the only heavily contended mutex.
* gc.signatlistmu. The global signatlist map is
populated with types through several of the concurrent phases,
including notably via ngotype during DWARF generation.
It is low priority for removal.
* gc.typepkgmu. Looking up symbols in the types package
happens a fair amount during backend compilation
and DWARF generation, particularly via ngotype.
This mutex helps us to avoid a broader mutex on types.Pkg.Syms.
It has low-to-moderate contention.
* types.internedStringsmu. gc AST to SSA conversion and
some SSA work introduce new autotmps.
Those autotmps have their names interned to reduce allocations.
That interning requires protecting types.internedStrings.
The autotmp names are heavily re-used, and the mutex
overhead and contention here are low, so it is probably
a worthwhile performance optimization to keep this mutex.
TESTING
I have been testing this code locally by running
'go install -race cmd/compile'
and then doing
'go build -a -gcflags=-c=128 std cmd'
for all architectures and a variety of compiler flags.
This obviously needs to be made part of the builders,
but it is too expensive to make part of all.bash.
I have filed #19962 for this.
REPRODUCIBLE BUILDS
This version of the compiler generates reproducible builds.
Testing reproducible builds also needs automation, however,
and is also too expensive for all.bash.
This is #19961.
Also of note is that some of the compiler flags used by 'toolstash -cmp'
are currently incompatible with concurrent backend compilation.
They still work fine with c=1.
Time will tell whether this is a problem.
NEXT STEPS
* Continue to find and fix races and bugs,
using a combination of code inspection, fuzzing,
and hopefully some community experimentation.
I do not know of any outstanding races,
but there probably are some.
* Improve testing.
* Improve performance, for many values of c.
* Integrate with cmd/go and fine tune.
* Support concurrent compilation with the -race flag.
It is a sad irony that it does not yet work.
* Minor code cleanup that has been deferred during
the last month due to uncertainty about the
ultimate shape of this CL.
PERFORMANCE
Here's the buried lede, at last. :)
All benchmarks are from my 8 core 2.9 GHz Intel Core i7 darwin/amd64 laptop.
First, going from tip to this CL with c=1 has almost no impact.
name old time/op new time/op delta
Template 195ms ± 3% 194ms ± 5% ~ (p=0.370 n=30+29)
Unicode 86.6ms ± 3% 87.0ms ± 7% ~ (p=0.958 n=29+30)
GoTypes 548ms ± 3% 555ms ± 4% +1.35% (p=0.001 n=30+28)
Compiler 2.51s ± 2% 2.54s ± 2% +1.17% (p=0.000 n=28+30)
SSA 5.16s ± 3% 5.16s ± 2% ~ (p=0.910 n=30+29)
Flate 124ms ± 5% 124ms ± 4% ~ (p=0.947 n=30+30)
GoParser 146ms ± 3% 146ms ± 3% ~ (p=0.150 n=29+28)
Reflect 354ms ± 3% 352ms ± 4% ~ (p=0.096 n=29+29)
Tar 107ms ± 5% 106ms ± 3% ~ (p=0.370 n=30+29)
XML 200ms ± 4% 201ms ± 4% ~ (p=0.313 n=29+28)
[Geo mean] 332ms 333ms +0.10%
name old user-time/op new user-time/op delta
Template 227ms ± 5% 225ms ± 5% ~ (p=0.457 n=28+27)
Unicode 109ms ± 4% 109ms ± 5% ~ (p=0.758 n=29+29)
GoTypes 713ms ± 4% 721ms ± 5% ~ (p=0.051 n=30+29)
Compiler 3.36s ± 2% 3.38s ± 3% ~ (p=0.146 n=30+30)
SSA 7.46s ± 3% 7.47s ± 3% ~ (p=0.804 n=30+29)
Flate 146ms ± 7% 147ms ± 3% ~ (p=0.833 n=29+27)
GoParser 179ms ± 5% 179ms ± 5% ~ (p=0.866 n=30+30)
Reflect 431ms ± 4% 429ms ± 4% ~ (p=0.593 n=29+30)
Tar 124ms ± 5% 123ms ± 5% ~ (p=0.140 n=29+29)
XML 243ms ± 4% 242ms ± 7% ~ (p=0.404 n=29+29)
[Geo mean] 415ms 415ms +0.02%
name old obj-bytes new obj-bytes delta
Template 382k ± 0% 382k ± 0% ~ (all equal)
Unicode 203k ± 0% 203k ± 0% ~ (all equal)
GoTypes 1.18M ± 0% 1.18M ± 0% ~ (all equal)
Compiler 3.98M ± 0% 3.98M ± 0% ~ (all equal)
SSA 8.28M ± 0% 8.28M ± 0% ~ (all equal)
Flate 230k ± 0% 230k ± 0% ~ (all equal)
GoParser 287k ± 0% 287k ± 0% ~ (all equal)
Reflect 1.00M ± 0% 1.00M ± 0% ~ (all equal)
Tar 190k ± 0% 190k ± 0% ~ (all equal)
XML 416k ± 0% 416k ± 0% ~ (all equal)
[Geo mean] 660k 660k +0.00%
Comparing this CL to itself, from c=1 to c=2
improves real times 20-30%, costs 5-10% more CPU time,
and adds about 2% alloc.
The allocation increase comes from allocating more ssa.Caches.
name old time/op new time/op delta
Template 202ms ± 3% 149ms ± 3% -26.15% (p=0.000 n=49+49)
Unicode 87.4ms ± 4% 84.2ms ± 3% -3.68% (p=0.000 n=48+48)
GoTypes 560ms ± 2% 398ms ± 2% -28.96% (p=0.000 n=49+49)
Compiler 2.46s ± 3% 1.76s ± 2% -28.61% (p=0.000 n=48+46)
SSA 6.17s ± 2% 4.04s ± 1% -34.52% (p=0.000 n=49+49)
Flate 126ms ± 3% 92ms ± 2% -26.81% (p=0.000 n=49+48)
GoParser 148ms ± 4% 107ms ± 2% -27.78% (p=0.000 n=49+48)
Reflect 361ms ± 3% 281ms ± 3% -22.10% (p=0.000 n=49+49)
Tar 109ms ± 4% 86ms ± 3% -20.81% (p=0.000 n=49+47)
XML 204ms ± 3% 144ms ± 2% -29.53% (p=0.000 n=48+45)
name old user-time/op new user-time/op delta
Template 246ms ± 9% 246ms ± 4% ~ (p=0.401 n=50+48)
Unicode 109ms ± 4% 111ms ± 4% +1.47% (p=0.000 n=44+50)
GoTypes 728ms ± 3% 765ms ± 3% +5.04% (p=0.000 n=46+50)
Compiler 3.33s ± 3% 3.41s ± 2% +2.31% (p=0.000 n=49+48)
SSA 8.52s ± 2% 9.11s ± 2% +6.93% (p=0.000 n=49+47)
Flate 149ms ± 4% 161ms ± 3% +8.13% (p=0.000 n=50+47)
GoParser 181ms ± 5% 192ms ± 2% +6.40% (p=0.000 n=49+46)
Reflect 452ms ± 9% 474ms ± 2% +4.99% (p=0.000 n=50+48)
Tar 126ms ± 6% 136ms ± 4% +7.95% (p=0.000 n=50+49)
XML 247ms ± 5% 264ms ± 3% +6.94% (p=0.000 n=48+50)
name old alloc/op new alloc/op delta
Template 38.8MB ± 0% 39.3MB ± 0% +1.48% (p=0.008 n=5+5)
Unicode 29.8MB ± 0% 30.2MB ± 0% +1.19% (p=0.008 n=5+5)
GoTypes 113MB ± 0% 114MB ± 0% +0.69% (p=0.008 n=5+5)
Compiler 443MB ± 0% 447MB ± 0% +0.95% (p=0.008 n=5+5)
SSA 1.25GB ± 0% 1.26GB ± 0% +0.89% (p=0.008 n=5+5)
Flate 25.3MB ± 0% 25.9MB ± 1% +2.35% (p=0.008 n=5+5)
GoParser 31.7MB ± 0% 32.2MB ± 0% +1.59% (p=0.008 n=5+5)
Reflect 78.2MB ± 0% 78.9MB ± 0% +0.91% (p=0.008 n=5+5)
Tar 26.6MB ± 0% 27.0MB ± 0% +1.80% (p=0.008 n=5+5)
XML 42.4MB ± 0% 43.4MB ± 0% +2.35% (p=0.008 n=5+5)
name old allocs/op new allocs/op delta
Template 379k ± 0% 378k ± 0% ~ (p=0.421 n=5+5)
Unicode 322k ± 0% 321k ± 0% ~ (p=0.222 n=5+5)
GoTypes 1.14M ± 0% 1.14M ± 0% ~ (p=0.548 n=5+5)
Compiler 4.12M ± 0% 4.11M ± 0% -0.14% (p=0.032 n=5+5)
SSA 9.72M ± 0% 9.72M ± 0% ~ (p=0.421 n=5+5)
Flate 234k ± 1% 234k ± 0% ~ (p=0.421 n=5+5)
GoParser 316k ± 1% 315k ± 0% ~ (p=0.222 n=5+5)
Reflect 980k ± 0% 979k ± 0% ~ (p=0.095 n=5+5)
Tar 249k ± 1% 249k ± 1% ~ (p=0.841 n=5+5)
XML 392k ± 0% 391k ± 0% ~ (p=0.095 n=5+5)
From c=1 to c=4, real time is down ~40%, CPU usage up 10-20%, alloc up ~5%:
name old time/op new time/op delta
Template 203ms ± 3% 131ms ± 5% -35.45% (p=0.000 n=50+50)
Unicode 87.2ms ± 4% 84.1ms ± 2% -3.61% (p=0.000 n=48+47)
GoTypes 560ms ± 4% 310ms ± 2% -44.65% (p=0.000 n=50+49)
Compiler 2.47s ± 3% 1.41s ± 2% -43.10% (p=0.000 n=50+46)
SSA 6.17s ± 2% 3.20s ± 2% -48.06% (p=0.000 n=49+49)
Flate 126ms ± 4% 74ms ± 2% -41.06% (p=0.000 n=49+48)
GoParser 148ms ± 4% 89ms ± 3% -39.97% (p=0.000 n=49+50)
Reflect 360ms ± 3% 242ms ± 3% -32.81% (p=0.000 n=49+49)
Tar 108ms ± 4% 73ms ± 4% -32.48% (p=0.000 n=50+49)
XML 203ms ± 3% 119ms ± 3% -41.56% (p=0.000 n=49+48)
name old user-time/op new user-time/op delta
Template 246ms ± 9% 287ms ± 9% +16.98% (p=0.000 n=50+50)
Unicode 109ms ± 4% 118ms ± 5% +7.56% (p=0.000 n=46+50)
GoTypes 735ms ± 4% 806ms ± 2% +9.62% (p=0.000 n=50+50)
Compiler 3.34s ± 4% 3.56s ± 2% +6.78% (p=0.000 n=49+49)
SSA 8.54s ± 3% 10.04s ± 3% +17.55% (p=0.000 n=50+50)
Flate 149ms ± 6% 176ms ± 3% +17.82% (p=0.000 n=50+48)
GoParser 181ms ± 5% 213ms ± 3% +17.47% (p=0.000 n=50+50)
Reflect 453ms ± 6% 499ms ± 2% +10.11% (p=0.000 n=50+48)
Tar 126ms ± 5% 149ms ±11% +18.76% (p=0.000 n=50+50)
XML 246ms ± 5% 287ms ± 4% +16.53% (p=0.000 n=49+50)
name old alloc/op new alloc/op delta
Template 38.8MB ± 0% 40.4MB ± 0% +4.21% (p=0.008 n=5+5)
Unicode 29.8MB ± 0% 30.9MB ± 0% +3.68% (p=0.008 n=5+5)
GoTypes 113MB ± 0% 116MB ± 0% +2.71% (p=0.008 n=5+5)
Compiler 443MB ± 0% 455MB ± 0% +2.75% (p=0.008 n=5+5)
SSA 1.25GB ± 0% 1.27GB ± 0% +1.84% (p=0.008 n=5+5)
Flate 25.3MB ± 0% 26.9MB ± 1% +6.31% (p=0.008 n=5+5)
GoParser 31.7MB ± 0% 33.2MB ± 0% +4.61% (p=0.008 n=5+5)
Reflect 78.2MB ± 0% 80.2MB ± 0% +2.53% (p=0.008 n=5+5)
Tar 26.6MB ± 0% 27.9MB ± 0% +5.19% (p=0.008 n=5+5)
XML 42.4MB ± 0% 44.6MB ± 0% +5.20% (p=0.008 n=5+5)
name old allocs/op new allocs/op delta
Template 380k ± 0% 379k ± 0% -0.39% (p=0.032 n=5+5)
Unicode 321k ± 0% 321k ± 0% ~ (p=0.841 n=5+5)
GoTypes 1.14M ± 0% 1.14M ± 0% ~ (p=0.421 n=5+5)
Compiler 4.12M ± 0% 4.14M ± 0% +0.52% (p=0.008 n=5+5)
SSA 9.72M ± 0% 9.76M ± 0% +0.37% (p=0.008 n=5+5)
Flate 234k ± 1% 234k ± 1% ~ (p=0.690 n=5+5)
GoParser 316k ± 0% 317k ± 1% ~ (p=0.841 n=5+5)
Reflect 981k ± 0% 981k ± 0% ~ (p=1.000 n=5+5)
Tar 250k ± 0% 249k ± 1% ~ (p=0.151 n=5+5)
XML 393k ± 0% 392k ± 0% ~ (p=0.056 n=5+5)
Going beyond c=4 on my machine tends to increase CPU time and allocs
without impacting real time.
The CPU time numbers matter, because when there are many concurrent
compilation processes, that will impact the overall throughput.
The numbers above are in many ways the best case scenario;
we can take full advantage of all cores.
Fortunately, the most common compilation scenario is incremental
re-compilation of a single package during a build/test cycle.
Updates #15756
Change-Id: I6725558ca2069edec0ac5b0d1683105a9fff6bea
Reviewed-on: https://go-review.googlesource.com/40693
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-19 08:27:26 -07:00
|
|
|
"sync"
|
2015-02-13 14:40:36 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
cmd/compile: make []byte("...") more efficient
Do []byte(string) conversions more efficiently when the string
is a constant. Instead of calling stringtobyteslice, allocate
just the space we need and encode the initialization directly.
[]byte("foo") rewrites to the following pseudocode:
var s [3]byte // on heap or stack, depending on whether b escapes
s = *(*[3]byte)(&"foo"[0]) // initialize s from the string
b = s[:]
which generates this assembly:
0x001d 00029 (tmp1.go:9) LEAQ type.[3]uint8(SB), AX
0x0024 00036 (tmp1.go:9) MOVQ AX, (SP)
0x0028 00040 (tmp1.go:9) CALL runtime.newobject(SB)
0x002d 00045 (tmp1.go:9) MOVQ 8(SP), AX
0x0032 00050 (tmp1.go:9) MOVBLZX go.string."foo"+2(SB), CX
0x0039 00057 (tmp1.go:9) MOVWLZX go.string."foo"(SB), DX
0x0040 00064 (tmp1.go:9) MOVW DX, (AX)
0x0043 00067 (tmp1.go:9) MOVB CL, 2(AX)
// Then the slice is b = {AX, 3, 3}
The generated code is still not optimal, as it still does load/store
from read-only memory instead of constant stores. Next CL...
Update #26498
Fixes #10170
Change-Id: I4b990b19f9a308f60c8f4f148934acffefe0a5bd
Reviewed-on: https://go-review.googlesource.com/c/140698
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-08 17:46:45 -07:00
|
|
|
BADWIDTH = types.BADWIDTH
|
2019-06-05 14:53:28 -04:00
|
|
|
)
|
cmd/compile: make []byte("...") more efficient
Do []byte(string) conversions more efficiently when the string
is a constant. Instead of calling stringtobyteslice, allocate
just the space we need and encode the initialization directly.
[]byte("foo") rewrites to the following pseudocode:
var s [3]byte // on heap or stack, depending on whether b escapes
s = *(*[3]byte)(&"foo"[0]) // initialize s from the string
b = s[:]
which generates this assembly:
0x001d 00029 (tmp1.go:9) LEAQ type.[3]uint8(SB), AX
0x0024 00036 (tmp1.go:9) MOVQ AX, (SP)
0x0028 00040 (tmp1.go:9) CALL runtime.newobject(SB)
0x002d 00045 (tmp1.go:9) MOVQ 8(SP), AX
0x0032 00050 (tmp1.go:9) MOVBLZX go.string."foo"+2(SB), CX
0x0039 00057 (tmp1.go:9) MOVWLZX go.string."foo"(SB), DX
0x0040 00064 (tmp1.go:9) MOVW DX, (AX)
0x0043 00067 (tmp1.go:9) MOVB CL, 2(AX)
// Then the slice is b = {AX, 3, 3}
The generated code is still not optimal, as it still does load/store
from read-only memory instead of constant stores. Next CL...
Update #26498
Fixes #10170
Change-Id: I4b990b19f9a308f60c8f4f148934acffefe0a5bd
Reviewed-on: https://go-review.googlesource.com/c/140698
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-08 17:46:45 -07:00
|
|
|
|
2019-06-05 14:53:28 -04:00
|
|
|
var (
|
cmd/compile: make []byte("...") more efficient
Do []byte(string) conversions more efficiently when the string
is a constant. Instead of calling stringtobyteslice, allocate
just the space we need and encode the initialization directly.
[]byte("foo") rewrites to the following pseudocode:
var s [3]byte // on heap or stack, depending on whether b escapes
s = *(*[3]byte)(&"foo"[0]) // initialize s from the string
b = s[:]
which generates this assembly:
0x001d 00029 (tmp1.go:9) LEAQ type.[3]uint8(SB), AX
0x0024 00036 (tmp1.go:9) MOVQ AX, (SP)
0x0028 00040 (tmp1.go:9) CALL runtime.newobject(SB)
0x002d 00045 (tmp1.go:9) MOVQ 8(SP), AX
0x0032 00050 (tmp1.go:9) MOVBLZX go.string."foo"+2(SB), CX
0x0039 00057 (tmp1.go:9) MOVWLZX go.string."foo"(SB), DX
0x0040 00064 (tmp1.go:9) MOVW DX, (AX)
0x0043 00067 (tmp1.go:9) MOVB CL, 2(AX)
// Then the slice is b = {AX, 3, 3}
The generated code is still not optimal, as it still does load/store
from read-only memory instead of constant stores. Next CL...
Update #26498
Fixes #10170
Change-Id: I4b990b19f9a308f60c8f4f148934acffefe0a5bd
Reviewed-on: https://go-review.googlesource.com/c/140698
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-08 17:46:45 -07:00
|
|
|
// maximum size variable which we will allocate on the stack.
|
|
|
|
|
// This limit is for explicit variable declarations like "var x T" or "x := ...".
|
2019-06-05 14:53:28 -04:00
|
|
|
// Note: the flag smallframes can update this value.
|
|
|
|
|
maxStackVarSize = int64(10 * 1024 * 1024)
|
cmd/compile: make []byte("...") more efficient
Do []byte(string) conversions more efficiently when the string
is a constant. Instead of calling stringtobyteslice, allocate
just the space we need and encode the initialization directly.
[]byte("foo") rewrites to the following pseudocode:
var s [3]byte // on heap or stack, depending on whether b escapes
s = *(*[3]byte)(&"foo"[0]) // initialize s from the string
b = s[:]
which generates this assembly:
0x001d 00029 (tmp1.go:9) LEAQ type.[3]uint8(SB), AX
0x0024 00036 (tmp1.go:9) MOVQ AX, (SP)
0x0028 00040 (tmp1.go:9) CALL runtime.newobject(SB)
0x002d 00045 (tmp1.go:9) MOVQ 8(SP), AX
0x0032 00050 (tmp1.go:9) MOVBLZX go.string."foo"+2(SB), CX
0x0039 00057 (tmp1.go:9) MOVWLZX go.string."foo"(SB), DX
0x0040 00064 (tmp1.go:9) MOVW DX, (AX)
0x0043 00067 (tmp1.go:9) MOVB CL, 2(AX)
// Then the slice is b = {AX, 3, 3}
The generated code is still not optimal, as it still does load/store
from read-only memory instead of constant stores. Next CL...
Update #26498
Fixes #10170
Change-Id: I4b990b19f9a308f60c8f4f148934acffefe0a5bd
Reviewed-on: https://go-review.googlesource.com/c/140698
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-08 17:46:45 -07:00
|
|
|
|
|
|
|
|
// maximum size of implicit variables that we will allocate on the stack.
|
|
|
|
|
// p := new(T) allocating T on the stack
|
|
|
|
|
// p := &T{} allocating T on the stack
|
|
|
|
|
// s := make([]T, n) allocating [n]T on the stack
|
|
|
|
|
// s := []byte("...") allocating [n]byte on the stack
|
2019-06-05 14:53:28 -04:00
|
|
|
// Note: the flag smallframes can update this value.
|
|
|
|
|
maxImplicitStackVarSize = int64(64 * 1024)
|
2019-09-28 23:30:08 +07:00
|
|
|
|
|
|
|
|
// smallArrayBytes is the maximum size of an array which is considered small.
|
|
|
|
|
// Small arrays will be initialized directly with a sequence of constant stores.
|
|
|
|
|
// Large arrays will be initialized by copying from a static temp.
|
|
|
|
|
// 256 bytes was chosen to minimize generated code + statictmp size.
|
|
|
|
|
smallArrayBytes = int64(256)
|
2015-03-05 10:39:23 -08:00
|
|
|
)
|
|
|
|
|
|
cmd/compile: factor out Pkg, Sym, and Type into package types
- created new package cmd/compile/internal/types
- moved Pkg, Sym, Type to new package
- to break cycles, for now we need the (ugly) types/utils.go
file which contains a handful of functions that must be installed
early by the gc frontend
- to break cycles, for now we need two functions to convert between
*gc.Node and *types.Node (the latter is a dummy type)
- adjusted the gc's code to use the new package and the conversion
functions as needed
- made several Pkg, Sym, and Type methods functions as needed
- renamed constructors typ, typPtr, typArray, etc. to types.New,
types.NewPtr, types.NewArray, etc.
Passes toolstash-check -all.
Change-Id: I8adfa5e85c731645d0a7fd2030375ed6ebf54b72
Reviewed-on: https://go-review.googlesource.com/39855
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-04-04 17:54:02 -07:00
|
|
|
// isRuntimePkg reports whether p is package runtime.
|
|
|
|
|
func isRuntimePkg(p *types.Pkg) bool {
|
2020-11-16 00:59:30 -05:00
|
|
|
if Flag.CompilingRuntime && p == localpkg {
|
2017-02-28 15:51:29 -08:00
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
return p.Path == "runtime"
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-19 22:18:15 +07:00
|
|
|
// isReflectPkg reports whether p is package reflect.
|
|
|
|
|
func isReflectPkg(p *types.Pkg) bool {
|
|
|
|
|
if p == localpkg {
|
2020-11-16 00:59:30 -05:00
|
|
|
return Ctxt.Pkgpath == "reflect"
|
2020-04-19 22:18:15 +07:00
|
|
|
}
|
|
|
|
|
return p.Path == "reflect"
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-26 14:57:36 -07:00
|
|
|
// The Class of a variable/function describes the "storage class"
|
|
|
|
|
// of a variable or function. During parsing, storage classes are
|
|
|
|
|
// called declaration contexts.
|
|
|
|
|
type Class uint8
|
|
|
|
|
|
2017-04-30 09:14:52 -07:00
|
|
|
//go:generate stringer -type=Class
|
2015-02-13 14:40:36 -05:00
|
|
|
const (
|
2017-04-26 10:18:41 -07:00
|
|
|
Pxxx Class = iota // no class; used during ssa conversion to indicate pseudo-variables
|
2020-10-19 12:11:13 +00:00
|
|
|
PEXTERN // global variables
|
2017-04-26 10:18:41 -07:00
|
|
|
PAUTO // local variables
|
2020-10-19 12:11:13 +00:00
|
|
|
PAUTOHEAP // local variables or parameters moved to heap
|
2017-04-26 10:18:41 -07:00
|
|
|
PPARAM // input arguments
|
|
|
|
|
PPARAMOUT // output results
|
2020-10-19 12:11:13 +00:00
|
|
|
PFUNC // global functions
|
2015-03-05 13:57:36 -05:00
|
|
|
|
2017-04-26 10:18:41 -07:00
|
|
|
// Careful: Class is stored in three bits in Node.flags.
|
2019-10-12 16:58:01 -07:00
|
|
|
_ = uint((1 << 3) - iota) // static assert for iota <= (1 << 3)
|
2015-02-13 14:40:36 -05:00
|
|
|
)
|
|
|
|
|
|
2020-04-08 12:36:35 -07:00
|
|
|
// Slices in the runtime are represented by three components:
|
2015-10-22 09:51:12 +09:00
|
|
|
//
|
2020-04-08 12:36:35 -07:00
|
|
|
// type slice struct {
|
|
|
|
|
// ptr unsafe.Pointer
|
|
|
|
|
// len int
|
|
|
|
|
// cap int
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// Strings in the runtime are represented by two components:
|
2015-10-22 09:51:12 +09:00
|
|
|
//
|
2020-04-08 12:36:35 -07:00
|
|
|
// type string struct {
|
|
|
|
|
// ptr unsafe.Pointer
|
|
|
|
|
// len int
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// These variables are the offsets of fields and sizes of these structs.
|
|
|
|
|
var (
|
|
|
|
|
slicePtrOffset int64
|
|
|
|
|
sliceLenOffset int64
|
|
|
|
|
sliceCapOffset int64
|
|
|
|
|
|
|
|
|
|
sizeofSlice int64
|
|
|
|
|
sizeofString int64
|
|
|
|
|
)
|
2015-02-13 14:40:36 -05:00
|
|
|
|
2018-04-11 15:37:16 -07:00
|
|
|
var pragcgobuf [][]string
|
2015-02-13 14:40:36 -05:00
|
|
|
|
2015-05-14 19:33:31 -07:00
|
|
|
var decldepth int32
|
2015-02-13 14:40:36 -05:00
|
|
|
|
cmd/compile: factor out Pkg, Sym, and Type into package types
- created new package cmd/compile/internal/types
- moved Pkg, Sym, Type to new package
- to break cycles, for now we need the (ugly) types/utils.go
file which contains a handful of functions that must be installed
early by the gc frontend
- to break cycles, for now we need two functions to convert between
*gc.Node and *types.Node (the latter is a dummy type)
- adjusted the gc's code to use the new package and the conversion
functions as needed
- made several Pkg, Sym, and Type methods functions as needed
- renamed constructors typ, typPtr, typArray, etc. to types.New,
types.NewPtr, types.NewArray, etc.
Passes toolstash-check -all.
Change-Id: I8adfa5e85c731645d0a7fd2030375ed6ebf54b72
Reviewed-on: https://go-review.googlesource.com/39855
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-04-04 17:54:02 -07:00
|
|
|
var localpkg *types.Pkg // package being compiled
|
2015-02-13 14:40:36 -05:00
|
|
|
|
2017-03-23 17:39:28 -07:00
|
|
|
var inimport bool // set during import
|
2015-02-13 14:40:36 -05:00
|
|
|
|
cmd/compile: factor out Pkg, Sym, and Type into package types
- created new package cmd/compile/internal/types
- moved Pkg, Sym, Type to new package
- to break cycles, for now we need the (ugly) types/utils.go
file which contains a handful of functions that must be installed
early by the gc frontend
- to break cycles, for now we need two functions to convert between
*gc.Node and *types.Node (the latter is a dummy type)
- adjusted the gc's code to use the new package and the conversion
functions as needed
- made several Pkg, Sym, and Type methods functions as needed
- renamed constructors typ, typPtr, typArray, etc. to types.New,
types.NewPtr, types.NewArray, etc.
Passes toolstash-check -all.
Change-Id: I8adfa5e85c731645d0a7fd2030375ed6ebf54b72
Reviewed-on: https://go-review.googlesource.com/39855
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-04-04 17:54:02 -07:00
|
|
|
var itabpkg *types.Pkg // fake pkg for itab entries
|
2016-03-17 06:18:13 -07:00
|
|
|
|
cmd/compile: factor out Pkg, Sym, and Type into package types
- created new package cmd/compile/internal/types
- moved Pkg, Sym, Type to new package
- to break cycles, for now we need the (ugly) types/utils.go
file which contains a handful of functions that must be installed
early by the gc frontend
- to break cycles, for now we need two functions to convert between
*gc.Node and *types.Node (the latter is a dummy type)
- adjusted the gc's code to use the new package and the conversion
functions as needed
- made several Pkg, Sym, and Type methods functions as needed
- renamed constructors typ, typPtr, typArray, etc. to types.New,
types.NewPtr, types.NewArray, etc.
Passes toolstash-check -all.
Change-Id: I8adfa5e85c731645d0a7fd2030375ed6ebf54b72
Reviewed-on: https://go-review.googlesource.com/39855
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-04-04 17:54:02 -07:00
|
|
|
var itablinkpkg *types.Pkg // fake package for runtime itab entries
|
2016-03-17 06:18:13 -07:00
|
|
|
|
cmd/compile: factor out Pkg, Sym, and Type into package types
- created new package cmd/compile/internal/types
- moved Pkg, Sym, Type to new package
- to break cycles, for now we need the (ugly) types/utils.go
file which contains a handful of functions that must be installed
early by the gc frontend
- to break cycles, for now we need two functions to convert between
*gc.Node and *types.Node (the latter is a dummy type)
- adjusted the gc's code to use the new package and the conversion
functions as needed
- made several Pkg, Sym, and Type methods functions as needed
- renamed constructors typ, typPtr, typArray, etc. to types.New,
types.NewPtr, types.NewArray, etc.
Passes toolstash-check -all.
Change-Id: I8adfa5e85c731645d0a7fd2030375ed6ebf54b72
Reviewed-on: https://go-review.googlesource.com/39855
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-04-04 17:54:02 -07:00
|
|
|
var Runtimepkg *types.Pkg // fake package runtime
|
2015-02-13 14:40:36 -05:00
|
|
|
|
cmd/compile: factor out Pkg, Sym, and Type into package types
- created new package cmd/compile/internal/types
- moved Pkg, Sym, Type to new package
- to break cycles, for now we need the (ugly) types/utils.go
file which contains a handful of functions that must be installed
early by the gc frontend
- to break cycles, for now we need two functions to convert between
*gc.Node and *types.Node (the latter is a dummy type)
- adjusted the gc's code to use the new package and the conversion
functions as needed
- made several Pkg, Sym, and Type methods functions as needed
- renamed constructors typ, typPtr, typArray, etc. to types.New,
types.NewPtr, types.NewArray, etc.
Passes toolstash-check -all.
Change-Id: I8adfa5e85c731645d0a7fd2030375ed6ebf54b72
Reviewed-on: https://go-review.googlesource.com/39855
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-04-04 17:54:02 -07:00
|
|
|
var racepkg *types.Pkg // package runtime/race
|
2015-02-13 14:40:36 -05:00
|
|
|
|
cmd/compile: factor out Pkg, Sym, and Type into package types
- created new package cmd/compile/internal/types
- moved Pkg, Sym, Type to new package
- to break cycles, for now we need the (ugly) types/utils.go
file which contains a handful of functions that must be installed
early by the gc frontend
- to break cycles, for now we need two functions to convert between
*gc.Node and *types.Node (the latter is a dummy type)
- adjusted the gc's code to use the new package and the conversion
functions as needed
- made several Pkg, Sym, and Type methods functions as needed
- renamed constructors typ, typPtr, typArray, etc. to types.New,
types.NewPtr, types.NewArray, etc.
Passes toolstash-check -all.
Change-Id: I8adfa5e85c731645d0a7fd2030375ed6ebf54b72
Reviewed-on: https://go-review.googlesource.com/39855
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-04-04 17:54:02 -07:00
|
|
|
var msanpkg *types.Pkg // package runtime/msan
|
2015-10-21 07:04:10 -07:00
|
|
|
|
cmd/compile: factor out Pkg, Sym, and Type into package types
- created new package cmd/compile/internal/types
- moved Pkg, Sym, Type to new package
- to break cycles, for now we need the (ugly) types/utils.go
file which contains a handful of functions that must be installed
early by the gc frontend
- to break cycles, for now we need two functions to convert between
*gc.Node and *types.Node (the latter is a dummy type)
- adjusted the gc's code to use the new package and the conversion
functions as needed
- made several Pkg, Sym, and Type methods functions as needed
- renamed constructors typ, typPtr, typArray, etc. to types.New,
types.NewPtr, types.NewArray, etc.
Passes toolstash-check -all.
Change-Id: I8adfa5e85c731645d0a7fd2030375ed6ebf54b72
Reviewed-on: https://go-review.googlesource.com/39855
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-04-04 17:54:02 -07:00
|
|
|
var unsafepkg *types.Pkg // package unsafe
|
2015-02-13 14:40:36 -05:00
|
|
|
|
cmd/compile: factor out Pkg, Sym, and Type into package types
- created new package cmd/compile/internal/types
- moved Pkg, Sym, Type to new package
- to break cycles, for now we need the (ugly) types/utils.go
file which contains a handful of functions that must be installed
early by the gc frontend
- to break cycles, for now we need two functions to convert between
*gc.Node and *types.Node (the latter is a dummy type)
- adjusted the gc's code to use the new package and the conversion
functions as needed
- made several Pkg, Sym, and Type methods functions as needed
- renamed constructors typ, typPtr, typArray, etc. to types.New,
types.NewPtr, types.NewArray, etc.
Passes toolstash-check -all.
Change-Id: I8adfa5e85c731645d0a7fd2030375ed6ebf54b72
Reviewed-on: https://go-review.googlesource.com/39855
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-04-04 17:54:02 -07:00
|
|
|
var trackpkg *types.Pkg // fake package for field tracking
|
2015-02-13 14:40:36 -05:00
|
|
|
|
cmd/compile: factor out Pkg, Sym, and Type into package types
- created new package cmd/compile/internal/types
- moved Pkg, Sym, Type to new package
- to break cycles, for now we need the (ugly) types/utils.go
file which contains a handful of functions that must be installed
early by the gc frontend
- to break cycles, for now we need two functions to convert between
*gc.Node and *types.Node (the latter is a dummy type)
- adjusted the gc's code to use the new package and the conversion
functions as needed
- made several Pkg, Sym, and Type methods functions as needed
- renamed constructors typ, typPtr, typArray, etc. to types.New,
types.NewPtr, types.NewArray, etc.
Passes toolstash-check -all.
Change-Id: I8adfa5e85c731645d0a7fd2030375ed6ebf54b72
Reviewed-on: https://go-review.googlesource.com/39855
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-04-04 17:54:02 -07:00
|
|
|
var mappkg *types.Pkg // fake package for map zero value
|
2018-04-04 18:42:39 -07:00
|
|
|
|
|
|
|
|
var gopkg *types.Pkg // pseudo-package for method symbols on anonymous receiver types
|
|
|
|
|
|
2016-04-19 08:31:04 -07:00
|
|
|
var zerosize int64
|
|
|
|
|
|
cmd/compile: factor out Pkg, Sym, and Type into package types
- created new package cmd/compile/internal/types
- moved Pkg, Sym, Type to new package
- to break cycles, for now we need the (ugly) types/utils.go
file which contains a handful of functions that must be installed
early by the gc frontend
- to break cycles, for now we need two functions to convert between
*gc.Node and *types.Node (the latter is a dummy type)
- adjusted the gc's code to use the new package and the conversion
functions as needed
- made several Pkg, Sym, and Type methods functions as needed
- renamed constructors typ, typPtr, typArray, etc. to types.New,
types.NewPtr, types.NewArray, etc.
Passes toolstash-check -all.
Change-Id: I8adfa5e85c731645d0a7fd2030375ed6ebf54b72
Reviewed-on: https://go-review.googlesource.com/39855
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-04-04 17:54:02 -07:00
|
|
|
var simtype [NTYPE]types.EType
|
2015-02-13 14:40:36 -05:00
|
|
|
|
2015-03-01 07:54:01 +00:00
|
|
|
var (
|
2016-09-16 00:33:29 +10:00
|
|
|
isInt [NTYPE]bool
|
|
|
|
|
isFloat [NTYPE]bool
|
|
|
|
|
isComplex [NTYPE]bool
|
2015-03-01 07:54:01 +00:00
|
|
|
issimple [NTYPE]bool
|
|
|
|
|
)
|
2015-02-13 14:40:36 -05:00
|
|
|
|
2015-03-01 07:54:01 +00:00
|
|
|
var (
|
|
|
|
|
okforeq [NTYPE]bool
|
|
|
|
|
okforadd [NTYPE]bool
|
|
|
|
|
okforand [NTYPE]bool
|
|
|
|
|
okfornone [NTYPE]bool
|
|
|
|
|
okforcmp [NTYPE]bool
|
|
|
|
|
okforbool [NTYPE]bool
|
|
|
|
|
okforcap [NTYPE]bool
|
|
|
|
|
okforlen [NTYPE]bool
|
|
|
|
|
okforarith [NTYPE]bool
|
|
|
|
|
okforconst [NTYPE]bool
|
|
|
|
|
)
|
2015-02-13 14:40:36 -05:00
|
|
|
|
2015-03-01 07:54:01 +00:00
|
|
|
var (
|
|
|
|
|
okfor [OEND][]bool
|
|
|
|
|
iscmp [OEND]bool
|
|
|
|
|
)
|
2015-02-13 14:40:36 -05:00
|
|
|
|
2016-03-09 20:29:21 -08:00
|
|
|
var xtop []*Node
|
2015-02-13 14:40:36 -05:00
|
|
|
|
2015-08-12 14:29:50 -07:00
|
|
|
var exportlist []*Node
|
2015-02-13 14:40:36 -05:00
|
|
|
|
2015-09-06 22:38:49 +02:00
|
|
|
var importlist []*Node // imported functions and methods with inlinable bodies
|
2015-02-13 14:40:36 -05:00
|
|
|
|
cmd/compile: add initial backend concurrency support
This CL adds initial support for concurrent backend compilation.
BACKGROUND
The compiler currently consists (very roughly) of the following phases:
1. Initialization.
2. Lexing and parsing into the cmd/compile/internal/syntax AST.
3. Translation into the cmd/compile/internal/gc AST.
4. Some gc AST passes: typechecking, escape analysis, inlining,
closure handling, expression evaluation ordering (order.go),
and some lowering and optimization (walk.go).
5. Translation into the cmd/compile/internal/ssa SSA form.
6. Optimization and lowering of SSA form.
7. Translation from SSA form to assembler instructions.
8. Translation from assembler instructions to machine code.
9. Writing lots of output: machine code, DWARF symbols,
type and reflection info, export data.
Phase 2 was already concurrent as of Go 1.8.
Phase 3 is planned for eventual removal;
we hope to go straight from syntax AST to SSA.
Phases 5–8 are per-function; this CL adds support for
processing multiple functions concurrently.
The slowest phases in the compiler are 5 and 6,
so this offers the opportunity for some good speed-ups.
Unfortunately, it's not quite that straightforward.
In the current compiler, the latter parts of phase 4
(order, walk) are done function-at-a-time as needed.
Making order and walk concurrency-safe proved hard,
and they're not particularly slow, so there wasn't much reward.
To enable phases 5–8 to be done concurrently,
when concurrent backend compilation is requested,
we complete phase 4 for all functions
before starting later phases for any functions.
Also, in reality, we automatically generate new
functions in phase 9, such as method wrappers
and equality and has routines.
Those new functions then go through phases 4–8.
This CL disables concurrent backend compilation
after the first, big, user-provided batch of
functions has been compiled.
This is done to keep things simple,
and because the autogenerated functions
tend to be small, few, simple, and fast to compile.
USAGE
Concurrent backend compilation still defaults to off.
To set the number of functions that may be backend-compiled
concurrently, use the compiler flag -c.
In future work, cmd/go will automatically set -c.
Furthermore, this CL has been intentionally written
so that the c=1 path has no backend concurrency whatsoever,
not even spawning any goroutines.
This helps ensure that, should problems arise
late in the development cycle,
we can simply have cmd/go set c=1 always,
and revert to the original compiler behavior.
MUTEXES
Most of the work required to make concurrent backend
compilation safe has occurred over the past month.
This CL adds a handful of mutexes to get the rest of the way there;
they are the mutexes that I didn't see a clean way to avoid.
Some of them may still be eliminable in future work.
In no particular order:
* gc.funcsymsmu. The global funcsyms slice is populated
lazily when we need function symbols for closures.
This occurs during gc AST to SSA translation.
The function funcsym also does a package lookup,
which is a source of races on types.Pkg.Syms;
funcsymsmu also covers that package lookup.
This mutex is low priority: it adds a single global,
it is in an infrequently used code path, and it is low contention.
Since funcsyms may now be added in any order,
we must sort them to preserve reproducible builds.
* gc.largeStackFramesMu. We don't discover until after SSA compilation
that a function's stack frame is gigantic.
Recording that error happens basically never,
but it does happen concurrently.
Fix with a low priority mutex and sorting.
* obj.Link.hashmu. ctxt.hash stores the mapping from
types.Syms (compiler symbols) to obj.LSyms (linker symbols).
It is accessed fairly heavily through all the phases.
This is the only heavily contended mutex.
* gc.signatlistmu. The global signatlist map is
populated with types through several of the concurrent phases,
including notably via ngotype during DWARF generation.
It is low priority for removal.
* gc.typepkgmu. Looking up symbols in the types package
happens a fair amount during backend compilation
and DWARF generation, particularly via ngotype.
This mutex helps us to avoid a broader mutex on types.Pkg.Syms.
It has low-to-moderate contention.
* types.internedStringsmu. gc AST to SSA conversion and
some SSA work introduce new autotmps.
Those autotmps have their names interned to reduce allocations.
That interning requires protecting types.internedStrings.
The autotmp names are heavily re-used, and the mutex
overhead and contention here are low, so it is probably
a worthwhile performance optimization to keep this mutex.
TESTING
I have been testing this code locally by running
'go install -race cmd/compile'
and then doing
'go build -a -gcflags=-c=128 std cmd'
for all architectures and a variety of compiler flags.
This obviously needs to be made part of the builders,
but it is too expensive to make part of all.bash.
I have filed #19962 for this.
REPRODUCIBLE BUILDS
This version of the compiler generates reproducible builds.
Testing reproducible builds also needs automation, however,
and is also too expensive for all.bash.
This is #19961.
Also of note is that some of the compiler flags used by 'toolstash -cmp'
are currently incompatible with concurrent backend compilation.
They still work fine with c=1.
Time will tell whether this is a problem.
NEXT STEPS
* Continue to find and fix races and bugs,
using a combination of code inspection, fuzzing,
and hopefully some community experimentation.
I do not know of any outstanding races,
but there probably are some.
* Improve testing.
* Improve performance, for many values of c.
* Integrate with cmd/go and fine tune.
* Support concurrent compilation with the -race flag.
It is a sad irony that it does not yet work.
* Minor code cleanup that has been deferred during
the last month due to uncertainty about the
ultimate shape of this CL.
PERFORMANCE
Here's the buried lede, at last. :)
All benchmarks are from my 8 core 2.9 GHz Intel Core i7 darwin/amd64 laptop.
First, going from tip to this CL with c=1 has almost no impact.
name old time/op new time/op delta
Template 195ms ± 3% 194ms ± 5% ~ (p=0.370 n=30+29)
Unicode 86.6ms ± 3% 87.0ms ± 7% ~ (p=0.958 n=29+30)
GoTypes 548ms ± 3% 555ms ± 4% +1.35% (p=0.001 n=30+28)
Compiler 2.51s ± 2% 2.54s ± 2% +1.17% (p=0.000 n=28+30)
SSA 5.16s ± 3% 5.16s ± 2% ~ (p=0.910 n=30+29)
Flate 124ms ± 5% 124ms ± 4% ~ (p=0.947 n=30+30)
GoParser 146ms ± 3% 146ms ± 3% ~ (p=0.150 n=29+28)
Reflect 354ms ± 3% 352ms ± 4% ~ (p=0.096 n=29+29)
Tar 107ms ± 5% 106ms ± 3% ~ (p=0.370 n=30+29)
XML 200ms ± 4% 201ms ± 4% ~ (p=0.313 n=29+28)
[Geo mean] 332ms 333ms +0.10%
name old user-time/op new user-time/op delta
Template 227ms ± 5% 225ms ± 5% ~ (p=0.457 n=28+27)
Unicode 109ms ± 4% 109ms ± 5% ~ (p=0.758 n=29+29)
GoTypes 713ms ± 4% 721ms ± 5% ~ (p=0.051 n=30+29)
Compiler 3.36s ± 2% 3.38s ± 3% ~ (p=0.146 n=30+30)
SSA 7.46s ± 3% 7.47s ± 3% ~ (p=0.804 n=30+29)
Flate 146ms ± 7% 147ms ± 3% ~ (p=0.833 n=29+27)
GoParser 179ms ± 5% 179ms ± 5% ~ (p=0.866 n=30+30)
Reflect 431ms ± 4% 429ms ± 4% ~ (p=0.593 n=29+30)
Tar 124ms ± 5% 123ms ± 5% ~ (p=0.140 n=29+29)
XML 243ms ± 4% 242ms ± 7% ~ (p=0.404 n=29+29)
[Geo mean] 415ms 415ms +0.02%
name old obj-bytes new obj-bytes delta
Template 382k ± 0% 382k ± 0% ~ (all equal)
Unicode 203k ± 0% 203k ± 0% ~ (all equal)
GoTypes 1.18M ± 0% 1.18M ± 0% ~ (all equal)
Compiler 3.98M ± 0% 3.98M ± 0% ~ (all equal)
SSA 8.28M ± 0% 8.28M ± 0% ~ (all equal)
Flate 230k ± 0% 230k ± 0% ~ (all equal)
GoParser 287k ± 0% 287k ± 0% ~ (all equal)
Reflect 1.00M ± 0% 1.00M ± 0% ~ (all equal)
Tar 190k ± 0% 190k ± 0% ~ (all equal)
XML 416k ± 0% 416k ± 0% ~ (all equal)
[Geo mean] 660k 660k +0.00%
Comparing this CL to itself, from c=1 to c=2
improves real times 20-30%, costs 5-10% more CPU time,
and adds about 2% alloc.
The allocation increase comes from allocating more ssa.Caches.
name old time/op new time/op delta
Template 202ms ± 3% 149ms ± 3% -26.15% (p=0.000 n=49+49)
Unicode 87.4ms ± 4% 84.2ms ± 3% -3.68% (p=0.000 n=48+48)
GoTypes 560ms ± 2% 398ms ± 2% -28.96% (p=0.000 n=49+49)
Compiler 2.46s ± 3% 1.76s ± 2% -28.61% (p=0.000 n=48+46)
SSA 6.17s ± 2% 4.04s ± 1% -34.52% (p=0.000 n=49+49)
Flate 126ms ± 3% 92ms ± 2% -26.81% (p=0.000 n=49+48)
GoParser 148ms ± 4% 107ms ± 2% -27.78% (p=0.000 n=49+48)
Reflect 361ms ± 3% 281ms ± 3% -22.10% (p=0.000 n=49+49)
Tar 109ms ± 4% 86ms ± 3% -20.81% (p=0.000 n=49+47)
XML 204ms ± 3% 144ms ± 2% -29.53% (p=0.000 n=48+45)
name old user-time/op new user-time/op delta
Template 246ms ± 9% 246ms ± 4% ~ (p=0.401 n=50+48)
Unicode 109ms ± 4% 111ms ± 4% +1.47% (p=0.000 n=44+50)
GoTypes 728ms ± 3% 765ms ± 3% +5.04% (p=0.000 n=46+50)
Compiler 3.33s ± 3% 3.41s ± 2% +2.31% (p=0.000 n=49+48)
SSA 8.52s ± 2% 9.11s ± 2% +6.93% (p=0.000 n=49+47)
Flate 149ms ± 4% 161ms ± 3% +8.13% (p=0.000 n=50+47)
GoParser 181ms ± 5% 192ms ± 2% +6.40% (p=0.000 n=49+46)
Reflect 452ms ± 9% 474ms ± 2% +4.99% (p=0.000 n=50+48)
Tar 126ms ± 6% 136ms ± 4% +7.95% (p=0.000 n=50+49)
XML 247ms ± 5% 264ms ± 3% +6.94% (p=0.000 n=48+50)
name old alloc/op new alloc/op delta
Template 38.8MB ± 0% 39.3MB ± 0% +1.48% (p=0.008 n=5+5)
Unicode 29.8MB ± 0% 30.2MB ± 0% +1.19% (p=0.008 n=5+5)
GoTypes 113MB ± 0% 114MB ± 0% +0.69% (p=0.008 n=5+5)
Compiler 443MB ± 0% 447MB ± 0% +0.95% (p=0.008 n=5+5)
SSA 1.25GB ± 0% 1.26GB ± 0% +0.89% (p=0.008 n=5+5)
Flate 25.3MB ± 0% 25.9MB ± 1% +2.35% (p=0.008 n=5+5)
GoParser 31.7MB ± 0% 32.2MB ± 0% +1.59% (p=0.008 n=5+5)
Reflect 78.2MB ± 0% 78.9MB ± 0% +0.91% (p=0.008 n=5+5)
Tar 26.6MB ± 0% 27.0MB ± 0% +1.80% (p=0.008 n=5+5)
XML 42.4MB ± 0% 43.4MB ± 0% +2.35% (p=0.008 n=5+5)
name old allocs/op new allocs/op delta
Template 379k ± 0% 378k ± 0% ~ (p=0.421 n=5+5)
Unicode 322k ± 0% 321k ± 0% ~ (p=0.222 n=5+5)
GoTypes 1.14M ± 0% 1.14M ± 0% ~ (p=0.548 n=5+5)
Compiler 4.12M ± 0% 4.11M ± 0% -0.14% (p=0.032 n=5+5)
SSA 9.72M ± 0% 9.72M ± 0% ~ (p=0.421 n=5+5)
Flate 234k ± 1% 234k ± 0% ~ (p=0.421 n=5+5)
GoParser 316k ± 1% 315k ± 0% ~ (p=0.222 n=5+5)
Reflect 980k ± 0% 979k ± 0% ~ (p=0.095 n=5+5)
Tar 249k ± 1% 249k ± 1% ~ (p=0.841 n=5+5)
XML 392k ± 0% 391k ± 0% ~ (p=0.095 n=5+5)
From c=1 to c=4, real time is down ~40%, CPU usage up 10-20%, alloc up ~5%:
name old time/op new time/op delta
Template 203ms ± 3% 131ms ± 5% -35.45% (p=0.000 n=50+50)
Unicode 87.2ms ± 4% 84.1ms ± 2% -3.61% (p=0.000 n=48+47)
GoTypes 560ms ± 4% 310ms ± 2% -44.65% (p=0.000 n=50+49)
Compiler 2.47s ± 3% 1.41s ± 2% -43.10% (p=0.000 n=50+46)
SSA 6.17s ± 2% 3.20s ± 2% -48.06% (p=0.000 n=49+49)
Flate 126ms ± 4% 74ms ± 2% -41.06% (p=0.000 n=49+48)
GoParser 148ms ± 4% 89ms ± 3% -39.97% (p=0.000 n=49+50)
Reflect 360ms ± 3% 242ms ± 3% -32.81% (p=0.000 n=49+49)
Tar 108ms ± 4% 73ms ± 4% -32.48% (p=0.000 n=50+49)
XML 203ms ± 3% 119ms ± 3% -41.56% (p=0.000 n=49+48)
name old user-time/op new user-time/op delta
Template 246ms ± 9% 287ms ± 9% +16.98% (p=0.000 n=50+50)
Unicode 109ms ± 4% 118ms ± 5% +7.56% (p=0.000 n=46+50)
GoTypes 735ms ± 4% 806ms ± 2% +9.62% (p=0.000 n=50+50)
Compiler 3.34s ± 4% 3.56s ± 2% +6.78% (p=0.000 n=49+49)
SSA 8.54s ± 3% 10.04s ± 3% +17.55% (p=0.000 n=50+50)
Flate 149ms ± 6% 176ms ± 3% +17.82% (p=0.000 n=50+48)
GoParser 181ms ± 5% 213ms ± 3% +17.47% (p=0.000 n=50+50)
Reflect 453ms ± 6% 499ms ± 2% +10.11% (p=0.000 n=50+48)
Tar 126ms ± 5% 149ms ±11% +18.76% (p=0.000 n=50+50)
XML 246ms ± 5% 287ms ± 4% +16.53% (p=0.000 n=49+50)
name old alloc/op new alloc/op delta
Template 38.8MB ± 0% 40.4MB ± 0% +4.21% (p=0.008 n=5+5)
Unicode 29.8MB ± 0% 30.9MB ± 0% +3.68% (p=0.008 n=5+5)
GoTypes 113MB ± 0% 116MB ± 0% +2.71% (p=0.008 n=5+5)
Compiler 443MB ± 0% 455MB ± 0% +2.75% (p=0.008 n=5+5)
SSA 1.25GB ± 0% 1.27GB ± 0% +1.84% (p=0.008 n=5+5)
Flate 25.3MB ± 0% 26.9MB ± 1% +6.31% (p=0.008 n=5+5)
GoParser 31.7MB ± 0% 33.2MB ± 0% +4.61% (p=0.008 n=5+5)
Reflect 78.2MB ± 0% 80.2MB ± 0% +2.53% (p=0.008 n=5+5)
Tar 26.6MB ± 0% 27.9MB ± 0% +5.19% (p=0.008 n=5+5)
XML 42.4MB ± 0% 44.6MB ± 0% +5.20% (p=0.008 n=5+5)
name old allocs/op new allocs/op delta
Template 380k ± 0% 379k ± 0% -0.39% (p=0.032 n=5+5)
Unicode 321k ± 0% 321k ± 0% ~ (p=0.841 n=5+5)
GoTypes 1.14M ± 0% 1.14M ± 0% ~ (p=0.421 n=5+5)
Compiler 4.12M ± 0% 4.14M ± 0% +0.52% (p=0.008 n=5+5)
SSA 9.72M ± 0% 9.76M ± 0% +0.37% (p=0.008 n=5+5)
Flate 234k ± 1% 234k ± 1% ~ (p=0.690 n=5+5)
GoParser 316k ± 0% 317k ± 1% ~ (p=0.841 n=5+5)
Reflect 981k ± 0% 981k ± 0% ~ (p=1.000 n=5+5)
Tar 250k ± 0% 249k ± 1% ~ (p=0.151 n=5+5)
XML 393k ± 0% 392k ± 0% ~ (p=0.056 n=5+5)
Going beyond c=4 on my machine tends to increase CPU time and allocs
without impacting real time.
The CPU time numbers matter, because when there are many concurrent
compilation processes, that will impact the overall throughput.
The numbers above are in many ways the best case scenario;
we can take full advantage of all cores.
Fortunately, the most common compilation scenario is incremental
re-compilation of a single package during a build/test cycle.
Updates #15756
Change-Id: I6725558ca2069edec0ac5b0d1683105a9fff6bea
Reviewed-on: https://go-review.googlesource.com/40693
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-19 08:27:26 -07:00
|
|
|
var (
|
|
|
|
|
funcsymsmu sync.Mutex // protects funcsyms and associated package lookups (see func funcsym)
|
|
|
|
|
funcsyms []*types.Sym
|
|
|
|
|
)
|
2015-02-13 14:40:36 -05:00
|
|
|
|
2015-10-26 14:57:36 -07:00
|
|
|
var dclcontext Class // PEXTERN/PAUTO
|
2015-02-13 14:40:36 -05:00
|
|
|
|
|
|
|
|
var Curfn *Node
|
|
|
|
|
|
|
|
|
|
var Widthptr int
|
|
|
|
|
|
|
|
|
|
var Widthreg int
|
|
|
|
|
|
|
|
|
|
var nblank *Node
|
|
|
|
|
|
2015-08-30 23:56:40 +02:00
|
|
|
var typecheckok bool
|
2015-02-13 14:40:36 -05:00
|
|
|
|
2015-10-20 10:00:07 -07:00
|
|
|
// Whether we are adding any sort of code instrumentation, such as
|
|
|
|
|
// when the race detector is enabled.
|
|
|
|
|
var instrumenting bool
|
|
|
|
|
|
2017-05-02 16:46:01 +02:00
|
|
|
// Whether we are tracking lexical scopes for DWARF.
|
|
|
|
|
var trackScopes bool
|
|
|
|
|
|
2015-02-13 14:40:36 -05:00
|
|
|
var Ctxt *obj.Link
|
|
|
|
|
|
2018-03-08 21:00:36 +00:00
|
|
|
var nodfp *Node
|
|
|
|
|
|
2017-03-28 13:52:14 -07:00
|
|
|
var autogeneratedPos src.XPos
|
|
|
|
|
|
2015-10-22 09:51:12 +09:00
|
|
|
// interface to back end
|
2015-02-13 14:40:36 -05:00
|
|
|
|
|
|
|
|
type Arch struct {
|
2016-04-06 12:01:40 -07:00
|
|
|
LinkArch *obj.LinkArch
|
|
|
|
|
|
2017-11-10 18:08:48 +01:00
|
|
|
REGSP int
|
|
|
|
|
MAXWIDTH int64
|
|
|
|
|
SoftFloat bool
|
2015-03-18 17:26:36 -04:00
|
|
|
|
2019-10-25 00:50:00 -04:00
|
|
|
PadFrame func(int64) int64
|
|
|
|
|
|
|
|
|
|
// ZeroRange zeroes a range of memory on stack. It is only inserted
|
|
|
|
|
// at function entry, and it is ok to clobber registers.
|
|
|
|
|
ZeroRange func(*Progs, *obj.Prog, int64, int64, *uint32) *obj.Prog
|
|
|
|
|
|
2019-02-21 14:48:52 -05:00
|
|
|
Ginsnop func(*Progs) *obj.Prog
|
|
|
|
|
Ginsnopdefer func(*Progs) *obj.Prog // special ginsnop for deferreturn
|
2016-03-12 14:07:40 -08:00
|
|
|
|
|
|
|
|
// SSAMarkMoves marks any MOVXconst ops that need to avoid clobbering flags.
|
|
|
|
|
SSAMarkMoves func(*SSAGenState, *ssa.Block)
|
|
|
|
|
|
|
|
|
|
// SSAGenValue emits Prog(s) for the Value.
|
|
|
|
|
SSAGenValue func(*SSAGenState, *ssa.Value)
|
|
|
|
|
|
|
|
|
|
// SSAGenBlock emits end-of-block Progs. SSAGenValue should be called
|
|
|
|
|
// for all values in the block before SSAGenBlock.
|
|
|
|
|
SSAGenBlock func(s *SSAGenState, b, next *ssa.Block)
|
2015-02-13 14:40:36 -05:00
|
|
|
}
|
|
|
|
|
|
2017-03-17 13:35:36 -07:00
|
|
|
var thearch Arch
|
2015-02-13 14:40:36 -05:00
|
|
|
|
2016-10-28 11:37:45 -07:00
|
|
|
var (
|
2020-03-03 21:03:40 +00:00
|
|
|
staticuint64s,
|
2017-02-06 13:40:19 -08:00
|
|
|
zerobase *Node
|
|
|
|
|
|
2018-04-18 08:52:40 -07:00
|
|
|
assertE2I,
|
|
|
|
|
assertE2I2,
|
|
|
|
|
assertI2I,
|
|
|
|
|
assertI2I2,
|
2018-08-20 10:55:26 +02:00
|
|
|
deferproc,
|
2019-06-08 17:20:57 +00:00
|
|
|
deferprocStack,
|
2016-10-28 11:37:45 -07:00
|
|
|
Deferreturn,
|
2017-02-06 14:46:48 -08:00
|
|
|
Duffcopy,
|
|
|
|
|
Duffzero,
|
2018-04-18 08:52:40 -07:00
|
|
|
gcWriteBarrier,
|
|
|
|
|
goschedguarded,
|
2016-10-28 11:37:45 -07:00
|
|
|
growslice,
|
2018-04-18 08:52:40 -07:00
|
|
|
msanread,
|
|
|
|
|
msanwrite,
|
2019-03-17 07:14:12 -07:00
|
|
|
newobject,
|
2018-08-20 10:55:26 +02:00
|
|
|
newproc,
|
2018-04-18 08:52:40 -07:00
|
|
|
panicdivide,
|
2019-01-20 10:52:11 -08:00
|
|
|
panicshift,
|
2017-01-03 16:15:38 -08:00
|
|
|
panicdottypeE,
|
|
|
|
|
panicdottypeI,
|
2016-10-28 11:37:45 -07:00
|
|
|
panicnildottype,
|
2018-10-23 20:54:56 -06:00
|
|
|
panicoverflow,
|
2018-03-27 13:50:08 -07:00
|
|
|
raceread,
|
|
|
|
|
racereadrange,
|
2018-04-18 08:52:40 -07:00
|
|
|
racewrite,
|
2018-03-27 13:50:08 -07:00
|
|
|
racewriterange,
|
2018-11-06 17:00:04 +01:00
|
|
|
x86HasPOPCNT,
|
|
|
|
|
x86HasSSE41,
|
2018-09-25 03:10:33 -04:00
|
|
|
x86HasFMA,
|
2018-10-15 03:14:57 -04:00
|
|
|
armHasVFPv4,
|
2018-11-06 17:00:04 +01:00
|
|
|
arm64HasATOMICS,
|
2018-04-18 08:52:40 -07:00
|
|
|
typedmemclr,
|
|
|
|
|
typedmemmove,
|
|
|
|
|
Udiv,
|
2019-03-17 07:14:12 -07:00
|
|
|
writeBarrier,
|
|
|
|
|
zerobaseSym *obj.LSym
|
2017-08-08 16:38:25 -07:00
|
|
|
|
2019-02-06 14:12:36 -08:00
|
|
|
BoundsCheckFunc [ssa.BoundsKindCount]*obj.LSym
|
|
|
|
|
ExtendCheckFunc [ssa.BoundsKindCount]*obj.LSym
|
|
|
|
|
|
2018-03-29 00:55:53 +02:00
|
|
|
// Wasm
|
|
|
|
|
WasmMove,
|
|
|
|
|
WasmZero,
|
|
|
|
|
WasmDiv,
|
|
|
|
|
WasmTruncS,
|
|
|
|
|
WasmTruncU,
|
|
|
|
|
SigPanic *obj.LSym
|
2016-10-28 11:37:45 -07:00
|
|
|
)
|
cmd/compile, runtime: use more registers for amd64 write barrier calls
The compiler-inserted write barrier calls use a special ABI
for speed and to minimize the binary size impact.
runtime.gcWriteBarrier takes its args in DI and AX.
This change adds gcWriteBarrier wrapper functions,
varying only in the register used for the second argument.
(Allowing variation in the first argument doesn't offer improvements,
which is convenient, as it avoids quadratic API growth.)
This reduces the number of register copies.
The goals are reduced binary size via reduced register pressure/copies.
One downside to this change is that when the write barrier is on,
we may bounce through several different write barrier wrappers,
which is bad for the instruction cache.
Package runtime write barrier benchmarks for this change:
name old time/op new time/op delta
WriteBarrier-8 16.6ns ± 6% 15.6ns ± 6% -5.73% (p=0.000 n=97+99)
BulkWriteBarrier-8 4.37ns ± 7% 4.22ns ± 8% -3.45% (p=0.000 n=96+99)
However, I don't particularly trust these numbers.
I ran runtime.BenchmarkWriteBarrier multiple times as I rebased
this change, and noticed that the results have high variance
depending on the parent change, perhaps due to aligment.
This change was stress tested with GOGC=1 GODEBUG=gccheckmark=1 go test std.
This change reduces binary sizes:
file before after Δ %
addr2line 4308720 4296688 -12032 -0.279%
api 5965592 5945368 -20224 -0.339%
asm 5148088 5025464 -122624 -2.382%
buildid 2848760 2844904 -3856 -0.135%
cgo 4828968 4812840 -16128 -0.334%
compile 19754720 19529744 -224976 -1.139%
cover 5256840 5236600 -20240 -0.385%
dist 3670312 3658264 -12048 -0.328%
doc 4669608 4657576 -12032 -0.258%
fix 3377976 3365944 -12032 -0.356%
link 6614888 6586472 -28416 -0.430%
nm 4258368 4254528 -3840 -0.090%
objdump 4656336 4644304 -12032 -0.258%
pack 2295176 2295432 +256 +0.011%
pprof 14762356 14709364 -52992 -0.359%
test2json 2824456 2820600 -3856 -0.137%
trace 11684404 11643700 -40704 -0.348%
vet 8284760 8252248 -32512 -0.392%
total 115210328 114580040 -630288 -0.547%
This change improves compiler performance:
name old time/op new time/op delta
Template 208ms ± 3% 207ms ± 3% -0.40% (p=0.030 n=43+44)
Unicode 80.2ms ± 3% 81.3ms ± 3% +1.25% (p=0.000 n=41+44)
GoTypes 699ms ± 3% 694ms ± 2% -0.71% (p=0.016 n=42+37)
Compiler 3.26s ± 2% 3.23s ± 2% -0.86% (p=0.000 n=43+45)
SSA 6.97s ± 1% 6.93s ± 1% -0.63% (p=0.000 n=43+45)
Flate 134ms ± 3% 133ms ± 2% ~ (p=0.139 n=45+42)
GoParser 165ms ± 2% 164ms ± 1% -0.79% (p=0.000 n=45+40)
Reflect 434ms ± 4% 435ms ± 4% ~ (p=0.937 n=44+44)
Tar 181ms ± 2% 181ms ± 2% ~ (p=0.702 n=43+45)
XML 244ms ± 2% 244ms ± 2% ~ (p=0.237 n=45+44)
[Geo mean] 403ms 402ms -0.29%
name old user-time/op new user-time/op delta
Template 271ms ± 2% 268ms ± 1% -1.40% (p=0.000 n=42+42)
Unicode 117ms ± 3% 116ms ± 5% ~ (p=0.066 n=45+45)
GoTypes 948ms ± 2% 936ms ± 2% -1.30% (p=0.000 n=41+40)
Compiler 4.26s ± 1% 4.21s ± 2% -1.25% (p=0.000 n=37+45)
SSA 9.52s ± 2% 9.41s ± 1% -1.18% (p=0.000 n=44+45)
Flate 167ms ± 2% 165ms ± 2% -1.15% (p=0.000 n=44+41)
GoParser 201ms ± 2% 198ms ± 1% -1.40% (p=0.000 n=43+43)
Reflect 563ms ± 8% 560ms ± 7% ~ (p=0.206 n=45+44)
Tar 224ms ± 2% 222ms ± 2% -0.81% (p=0.000 n=45+45)
XML 308ms ± 2% 304ms ± 1% -1.17% (p=0.000 n=42+43)
[Geo mean] 525ms 519ms -1.08%
name old alloc/op new alloc/op delta
Template 36.3MB ± 0% 36.3MB ± 0% ~ (p=0.421 n=5+5)
Unicode 28.4MB ± 0% 28.3MB ± 0% ~ (p=0.056 n=5+5)
GoTypes 121MB ± 0% 121MB ± 0% -0.14% (p=0.008 n=5+5)
Compiler 567MB ± 0% 567MB ± 0% -0.06% (p=0.016 n=4+5)
SSA 1.26GB ± 0% 1.26GB ± 0% -0.07% (p=0.008 n=5+5)
Flate 22.9MB ± 0% 22.8MB ± 0% ~ (p=0.310 n=5+5)
GoParser 28.0MB ± 0% 27.9MB ± 0% -0.09% (p=0.008 n=5+5)
Reflect 78.4MB ± 0% 78.4MB ± 0% -0.03% (p=0.008 n=5+5)
Tar 34.2MB ± 0% 34.2MB ± 0% -0.05% (p=0.008 n=5+5)
XML 44.4MB ± 0% 44.4MB ± 0% -0.04% (p=0.016 n=5+5)
[Geo mean] 76.4MB 76.3MB -0.05%
name old allocs/op new allocs/op delta
Template 356k ± 0% 356k ± 0% -0.13% (p=0.008 n=5+5)
Unicode 326k ± 0% 326k ± 0% -0.07% (p=0.008 n=5+5)
GoTypes 1.24M ± 0% 1.24M ± 0% -0.24% (p=0.008 n=5+5)
Compiler 5.30M ± 0% 5.28M ± 0% -0.34% (p=0.008 n=5+5)
SSA 11.9M ± 0% 11.9M ± 0% -0.16% (p=0.008 n=5+5)
Flate 226k ± 0% 225k ± 0% -0.12% (p=0.008 n=5+5)
GoParser 287k ± 0% 286k ± 0% -0.29% (p=0.008 n=5+5)
Reflect 930k ± 0% 929k ± 0% -0.05% (p=0.008 n=5+5)
Tar 332k ± 0% 331k ± 0% -0.12% (p=0.008 n=5+5)
XML 411k ± 0% 411k ± 0% -0.12% (p=0.008 n=5+5)
[Geo mean] 771k 770k -0.16%
For some packages, this change significantly reduces the size of executable text.
Examples:
file before after Δ %
cmd/internal/obj/arm.s 68658 66855 -1803 -2.626%
cmd/internal/obj/mips.s 57486 56272 -1214 -2.112%
cmd/internal/obj/arm64.s 152107 147163 -4944 -3.250%
cmd/internal/obj/ppc64.s 125544 120456 -5088 -4.053%
cmd/vendor/golang.org/x/tools/go/cfg.s 31699 30742 -957 -3.019%
Full listing:
file before after Δ %
container/ring.s 1890 1870 -20 -1.058%
container/list.s 5366 5390 +24 +0.447%
internal/cpu.s 3298 3295 -3 -0.091%
internal/testlog.s 1507 1501 -6 -0.398%
image/color.s 8281 8248 -33 -0.399%
runtime.s 480970 480075 -895 -0.186%
sync.s 16497 16408 -89 -0.539%
internal/singleflight.s 2591 2577 -14 -0.540%
math/rand.s 10456 10438 -18 -0.172%
cmd/go/internal/par.s 2801 2790 -11 -0.393%
internal/reflectlite.s 28477 28417 -60 -0.211%
errors.s 2750 2736 -14 -0.509%
internal/oserror.s 446 434 -12 -2.691%
sort.s 17061 17046 -15 -0.088%
io.s 17063 16999 -64 -0.375%
vendor/golang.org/x/crypto/hkdf.s 1962 1936 -26 -1.325%
text/tabwriter.s 9617 9574 -43 -0.447%
hash/crc64.s 3414 3408 -6 -0.176%
hash/crc32.s 6657 6651 -6 -0.090%
bytes.s 31932 31863 -69 -0.216%
strconv.s 53158 52799 -359 -0.675%
strings.s 42829 42665 -164 -0.383%
encoding/ascii85.s 4833 4791 -42 -0.869%
vendor/golang.org/x/text/transform.s 16810 16724 -86 -0.512%
path.s 6848 6845 -3 -0.044%
encoding/base32.s 9658 9592 -66 -0.683%
bufio.s 23051 22908 -143 -0.620%
compress/bzip2.s 11773 11764 -9 -0.076%
image.s 37565 37502 -63 -0.168%
syscall.s 82359 82279 -80 -0.097%
regexp/syntax.s 83573 82930 -643 -0.769%
image/jpeg.s 36535 36490 -45 -0.123%
regexp.s 64396 64214 -182 -0.283%
time.s 82724 82622 -102 -0.123%
plugin.s 6539 6536 -3 -0.046%
context.s 10959 10865 -94 -0.858%
internal/poll.s 24286 24270 -16 -0.066%
reflect.s 168304 167927 -377 -0.224%
internal/fmtsort.s 7416 7376 -40 -0.539%
os.s 52465 51787 -678 -1.292%
cmd/go/internal/lockedfile/internal/filelock.s 2326 2317 -9 -0.387%
os/signal.s 4657 4648 -9 -0.193%
runtime/debug.s 6040 5998 -42 -0.695%
encoding/binary.s 30838 30801 -37 -0.120%
vendor/golang.org/x/net/route.s 23694 23491 -203 -0.857%
path/filepath.s 17895 17889 -6 -0.034%
cmd/vendor/golang.org/x/sys/unix.s 78125 78109 -16 -0.020%
io/ioutil.s 6999 6996 -3 -0.043%
encoding/base64.s 12094 12007 -87 -0.719%
crypto/cipher.s 20466 20372 -94 -0.459%
cmd/go/internal/robustio.s 2672 2669 -3 -0.112%
encoding/pem.s 9302 9286 -16 -0.172%
internal/obscuretestdata.s 1719 1695 -24 -1.396%
crypto/aes.s 11014 11002 -12 -0.109%
os/exec.s 29388 29231 -157 -0.534%
cmd/internal/browser.s 2266 2260 -6 -0.265%
internal/goroot.s 4601 4592 -9 -0.196%
vendor/golang.org/x/crypto/chacha20poly1305.s 8945 8942 -3 -0.034%
cmd/vendor/golang.org/x/crypto/ssh/terminal.s 27226 27195 -31 -0.114%
index/suffixarray.s 36431 36411 -20 -0.055%
fmt.s 77017 76709 -308 -0.400%
encoding/hex.s 6241 6154 -87 -1.394%
compress/lzw.s 7133 7069 -64 -0.897%
database/sql/driver.s 18888 18877 -11 -0.058%
net/url.s 29838 29739 -99 -0.332%
debug/plan9obj.s 8329 8279 -50 -0.600%
encoding/csv.s 12986 12902 -84 -0.647%
debug/gosym.s 25403 25330 -73 -0.287%
compress/flate.s 51192 50970 -222 -0.434%
vendor/golang.org/x/net/dns/dnsmessage.s 86769 86208 -561 -0.647%
compress/gzip.s 9791 9758 -33 -0.337%
compress/zlib.s 7310 7277 -33 -0.451%
archive/zip.s 42356 42166 -190 -0.449%
debug/dwarf.s 108259 107730 -529 -0.489%
encoding/json.s 106378 105910 -468 -0.440%
os/user.s 14751 14724 -27 -0.183%
database/sql.s 99011 98404 -607 -0.613%
log.s 9466 9423 -43 -0.454%
debug/pe.s 31272 31182 -90 -0.288%
debug/macho.s 32764 32608 -156 -0.476%
encoding/gob.s 136976 136517 -459 -0.335%
vendor/golang.org/x/text/unicode/bidi.s 27318 27276 -42 -0.154%
archive/tar.s 71416 70975 -441 -0.618%
vendor/golang.org/x/net/http2/hpack.s 23892 23848 -44 -0.184%
vendor/golang.org/x/text/secure/bidirule.s 3354 3351 -3 -0.089%
mime/quotedprintable.s 5960 5925 -35 -0.587%
net/http/internal.s 5874 5853 -21 -0.358%
math/big.s 184147 183692 -455 -0.247%
debug/elf.s 63775 63567 -208 -0.326%
mime.s 39802 39709 -93 -0.234%
encoding/xml.s 111038 110713 -325 -0.293%
crypto/dsa.s 6044 6029 -15 -0.248%
go/token.s 12139 12077 -62 -0.511%
crypto/rand.s 6889 6866 -23 -0.334%
go/scanner.s 19030 19008 -22 -0.116%
flag.s 22320 22236 -84 -0.376%
vendor/golang.org/x/text/unicode/norm.s 66652 66391 -261 -0.392%
crypto/rsa.s 31671 31650 -21 -0.066%
crypto/elliptic.s 51553 51403 -150 -0.291%
internal/xcoff.s 22950 22822 -128 -0.558%
go/constant.s 43750 43689 -61 -0.139%
encoding/asn1.s 57086 57035 -51 -0.089%
runtime/trace.s 2609 2603 -6 -0.230%
crypto/x509/pkix.s 10458 10471 +13 +0.124%
image/gif.s 27544 27385 -159 -0.577%
vendor/golang.org/x/net/idna.s 24558 24502 -56 -0.228%
image/png.s 42775 42685 -90 -0.210%
vendor/golang.org/x/crypto/cryptobyte.s 33616 33493 -123 -0.366%
go/ast.s 80684 80449 -235 -0.291%
net/internal/socktest.s 16571 16535 -36 -0.217%
crypto/ecdsa.s 11948 11936 -12 -0.100%
text/template/parse.s 95138 94002 -1136 -1.194%
runtime/pprof.s 59702 59639 -63 -0.106%
testing.s 68427 68088 -339 -0.495%
internal/testenv.s 5620 5596 -24 -0.427%
testing/internal/testdeps.s 3312 3294 -18 -0.543%
internal/trace.s 78473 78239 -234 -0.298%
testing/iotest.s 4968 4908 -60 -1.208%
os/signal/internal/pty.s 3011 2990 -21 -0.697%
testing/quick.s 12179 12125 -54 -0.443%
cmd/internal/bio.s 9286 9274 -12 -0.129%
cmd/internal/src.s 17684 17663 -21 -0.119%
cmd/internal/goobj2.s 12588 12558 -30 -0.238%
cmd/internal/objabi.s 16408 16390 -18 -0.110%
go/printer.s 77417 77308 -109 -0.141%
go/parser.s 80045 79113 -932 -1.164%
go/format.s 5434 5419 -15 -0.276%
cmd/internal/goobj.s 26146 25954 -192 -0.734%
runtime/pprof/internal/profile.s 102518 102178 -340 -0.332%
text/template.s 95343 94935 -408 -0.428%
cmd/internal/dwarf.s 31718 31572 -146 -0.460%
cmd/vendor/golang.org/x/arch/arm/armasm.s 45240 45151 -89 -0.197%
internal/lazytemplate.s 1470 1457 -13 -0.884%
cmd/vendor/golang.org/x/arch/ppc64/ppc64asm.s 37253 37220 -33 -0.089%
cmd/asm/internal/flags.s 2593 2590 -3 -0.116%
cmd/asm/internal/lex.s 25068 24921 -147 -0.586%
cmd/internal/buildid.s 18536 18263 -273 -1.473%
cmd/vendor/golang.org/x/arch/x86/x86asm.s 80209 80105 -104 -0.130%
go/doc.s 75140 74585 -555 -0.739%
cmd/internal/edit.s 3893 3899 +6 +0.154%
html/template.s 89377 88809 -568 -0.636%
cmd/vendor/golang.org/x/arch/arm64/arm64asm.s 117998 117824 -174 -0.147%
cmd/internal/obj.s 115015 114290 -725 -0.630%
go/build.s 69379 68862 -517 -0.745%
cmd/internal/objfile.s 48106 47982 -124 -0.258%
cmd/cover.s 46239 46113 -126 -0.272%
cmd/addr2line.s 2845 2833 -12 -0.422%
cmd/internal/obj/arm.s 68658 66855 -1803 -2.626%
cmd/internal/obj/mips.s 57486 56272 -1214 -2.112%
cmd/internal/obj/riscv.s 63834 63006 -828 -1.297%
cmd/compile/internal/syntax.s 146582 145456 -1126 -0.768%
cmd/internal/obj/wasm.s 44117 44066 -51 -0.116%
cmd/cgo.s 242645 241653 -992 -0.409%
cmd/internal/obj/arm64.s 152107 147163 -4944 -3.250%
net.s 295972 292010 -3962 -1.339%
go/types.s 321371 319432 -1939 -0.603%
vendor/golang.org/x/net/http/httpproxy.s 9450 9423 -27 -0.286%
net/textproto.s 19455 19406 -49 -0.252%
cmd/internal/obj/ppc64.s 125544 120456 -5088 -4.053%
go/internal/srcimporter.s 6475 6409 -66 -1.019%
log/syslog.s 8017 7929 -88 -1.098%
cmd/compile/internal/logopt.s 10183 10162 -21 -0.206%
net/mail.s 24085 23948 -137 -0.569%
mime/multipart.s 21527 21420 -107 -0.497%
cmd/internal/obj/s390x.s 127610 127757 +147 +0.115%
go/internal/gcimporter.s 34913 34548 -365 -1.045%
vendor/golang.org/x/net/nettest.s 28103 28016 -87 -0.310%
cmd/go/internal/cfg.s 9967 9916 -51 -0.512%
cmd/api.s 39703 39603 -100 -0.252%
go/internal/gccgoimporter.s 56470 56120 -350 -0.620%
go/importer.s 2077 2056 -21 -1.011%
cmd/compile/internal/types.s 48202 47282 -920 -1.909%
cmd/go/internal/str.s 4341 4320 -21 -0.484%
cmd/internal/obj/x86.s 89440 88625 -815 -0.911%
cmd/go/internal/base.s 12667 12580 -87 -0.687%
cmd/go/internal/cache.s 30754 30571 -183 -0.595%
cmd/doc.s 62976 62755 -221 -0.351%
cmd/go/internal/search.s 20114 19993 -121 -0.602%
cmd/vendor/golang.org/x/xerrors.s 17923 17855 -68 -0.379%
cmd/go/internal/lockedfile.s 16451 16415 -36 -0.219%
cmd/vendor/golang.org/x/mod/sumdb/note.s 18200 18150 -50 -0.275%
cmd/vendor/golang.org/x/mod/module.s 17869 17851 -18 -0.101%
cmd/asm/internal/arch.s 37533 37482 -51 -0.136%
cmd/fix.s 87728 87492 -236 -0.269%
cmd/vendor/golang.org/x/mod/sumdb/tlog.s 36394 36367 -27 -0.074%
cmd/vendor/golang.org/x/mod/sumdb/dirhash.s 4990 4963 -27 -0.541%
cmd/go/internal/imports.s 16499 16469 -30 -0.182%
cmd/vendor/golang.org/x/mod/zip.s 18816 18745 -71 -0.377%
cmd/go/internal/cmdflag.s 5126 5123 -3 -0.059%
cmd/internal/test2json.s 9540 9452 -88 -0.922%
cmd/go/internal/tool.s 3629 3623 -6 -0.165%
cmd/go/internal/version.s 11232 11220 -12 -0.107%
cmd/go/internal/mvs.s 25383 25179 -204 -0.804%
cmd/nm.s 5815 5803 -12 -0.206%
cmd/dist.s 210146 209140 -1006 -0.479%
cmd/asm/internal/asm.s 68655 68549 -106 -0.154%
cmd/vendor/golang.org/x/mod/modfile.s 72974 72510 -464 -0.636%
cmd/go/internal/load.s 107548 106861 -687 -0.639%
cmd/link/internal/sym.s 18708 18581 -127 -0.679%
cmd/asm.s 3367 3343 -24 -0.713%
cmd/gofmt.s 30795 30698 -97 -0.315%
cmd/link/internal/objfile.s 21828 21630 -198 -0.907%
cmd/pack.s 14878 14869 -9 -0.060%
cmd/vendor/github.com/google/pprof/internal/elfexec.s 6788 6782 -6 -0.088%
cmd/test2json.s 1647 1641 -6 -0.364%
cmd/link/internal/loader.s 48677 48483 -194 -0.399%
cmd/vendor/golang.org/x/tools/go/analysis/internal/analysisflags.s 16783 16773 -10 -0.060%
cmd/link/internal/loadelf.s 35464 35126 -338 -0.953%
cmd/link/internal/loadmacho.s 29438 29180 -258 -0.876%
cmd/link/internal/loadpe.s 16440 16371 -69 -0.420%
cmd/vendor/golang.org/x/tools/go/analysis/passes/internal/analysisutil.s 2106 2100 -6 -0.285%
cmd/link/internal/loadxcoff.s 11711 11615 -96 -0.820%
cmd/vendor/golang.org/x/tools/go/analysis/internal/facts.s 14954 14883 -71 -0.475%
cmd/vendor/golang.org/x/tools/go/ast/inspector.s 5394 5374 -20 -0.371%
cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl.s 37029 36822 -207 -0.559%
cmd/vendor/golang.org/x/tools/go/analysis/passes/inspect.s 340 337 -3 -0.882%
cmd/vendor/golang.org/x/tools/go/analysis/passes/cgocall.s 9919 9858 -61 -0.615%
cmd/vendor/golang.org/x/tools/go/analysis/passes/bools.s 6705 6690 -15 -0.224%
cmd/vendor/golang.org/x/tools/go/analysis/passes/copylock.s 9783 9741 -42 -0.429%
cmd/vendor/golang.org/x/tools/go/cfg.s 31699 30742 -957 -3.019%
cmd/vendor/golang.org/x/tools/go/analysis/passes/ifaceassert.s 2768 2762 -6 -0.217%
cmd/vendor/golang.org/x/tools/go/analysis/passes/loopclosure.s 3031 2998 -33 -1.089%
cmd/vendor/golang.org/x/tools/go/analysis/passes/shift.s 4382 4376 -6 -0.137%
cmd/vendor/golang.org/x/tools/go/analysis/passes/stdmethods.s 8654 8642 -12 -0.139%
cmd/vendor/golang.org/x/tools/go/analysis/passes/stringintconv.s 3458 3446 -12 -0.347%
cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag.s 8011 7995 -16 -0.200%
cmd/vendor/golang.org/x/tools/go/analysis/passes/tests.s 6205 6193 -12 -0.193%
cmd/vendor/golang.org/x/tools/go/ast/astutil.s 66183 65861 -322 -0.487%
cmd/vendor/github.com/google/pprof/profile.s 150844 150261 -583 -0.386%
cmd/vendor/golang.org/x/tools/go/analysis/passes/unreachable.s 8057 8054 -3 -0.037%
cmd/vendor/golang.org/x/tools/go/analysis/passes/unusedresult.s 3670 3667 -3 -0.082%
cmd/vendor/github.com/google/pprof/internal/measurement.s 10464 10440 -24 -0.229%
cmd/vendor/golang.org/x/tools/go/types/typeutil.s 12319 12274 -45 -0.365%
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.s 13503 13342 -161 -1.192%
cmd/vendor/golang.org/x/tools/go/analysis/passes/ctrlflow.s 5261 5218 -43 -0.817%
cmd/vendor/golang.org/x/tools/go/analysis/passes/errorsas.s 1462 1459 -3 -0.205%
cmd/vendor/golang.org/x/tools/go/analysis/passes/lostcancel.s 9594 9582 -12 -0.125%
cmd/vendor/golang.org/x/tools/go/analysis/passes/printf.s 34397 34338 -59 -0.172%
cmd/vendor/github.com/google/pprof/internal/graph.s 53225 52936 -289 -0.543%
cmd/vendor/github.com/ianlancetaylor/demangle.s 177450 175329 -2121 -1.195%
crypto/x509.s 147892 147388 -504 -0.341%
cmd/go/internal/work.s 306465 304950 -1515 -0.494%
cmd/go/internal/run.s 4664 4657 -7 -0.150%
crypto/tls.s 313130 311833 -1297 -0.414%
net/http/httptrace.s 3979 3905 -74 -1.860%
net/smtp.s 14413 14344 -69 -0.479%
cmd/link/internal/ld.s 545343 542279 -3064 -0.562%
cmd/link/internal/mips.s 6218 6215 -3 -0.048%
cmd/link/internal/mips64.s 6108 6103 -5 -0.082%
cmd/link/internal/amd64.s 18154 18112 -42 -0.231%
cmd/link/internal/arm64.s 22527 22494 -33 -0.146%
cmd/link/internal/arm.s 22574 22494 -80 -0.354%
cmd/link/internal/s390x.s 20779 20746 -33 -0.159%
cmd/link/internal/wasm.s 16531 16493 -38 -0.230%
cmd/link/internal/x86.s 18906 18849 -57 -0.301%
cmd/link/internal/ppc64.s 26856 26778 -78 -0.290%
net/http.s 559101 556513 -2588 -0.463%
net/http/cookiejar.s 15912 15885 -27 -0.170%
expvar.s 9531 9525 -6 -0.063%
net/http/httptest.s 16616 16475 -141 -0.849%
net/http/cgi.s 23624 23458 -166 -0.703%
cmd/go/internal/web.s 16546 16489 -57 -0.344%
cmd/vendor/golang.org/x/mod/sumdb.s 33197 33117 -80 -0.241%
net/http/fcgi.s 19266 19169 -97 -0.503%
net/http/httputil.s 39875 39728 -147 -0.369%
cmd/vendor/github.com/google/pprof/internal/symbolz.s 5888 5867 -21 -0.357%
net/rpc.s 34154 34003 -151 -0.442%
cmd/vendor/github.com/google/pprof/internal/transport.s 2746 2716 -30 -1.092%
cmd/vendor/github.com/google/pprof/internal/binutils.s 35999 35875 -124 -0.344%
net/rpc/jsonrpc.s 6637 6598 -39 -0.588%
cmd/vendor/github.com/google/pprof/internal/symbolizer.s 11533 11458 -75 -0.650%
cmd/go/internal/get.s 62921 62803 -118 -0.188%
cmd/vendor/github.com/google/pprof/internal/report.s 80364 80058 -306 -0.381%
cmd/go/internal/modfetch/codehost.s 89680 89066 -614 -0.685%
cmd/trace.s 117171 116701 -470 -0.401%
cmd/vendor/github.com/google/pprof/internal/driver.s 144268 143297 -971 -0.673%
cmd/go/internal/modfetch.s 126299 125860 -439 -0.348%
cmd/vendor/github.com/google/pprof/driver.s 9042 9000 -42 -0.464%
cmd/go/internal/modconv.s 17947 17889 -58 -0.323%
cmd/pprof.s 12399 12326 -73 -0.589%
cmd/go/internal/modload.s 151182 150389 -793 -0.525%
cmd/go/internal/generate.s 11738 11636 -102 -0.869%
cmd/go/internal/help.s 6571 6531 -40 -0.609%
cmd/go/internal/clean.s 11174 11142 -32 -0.286%
cmd/go/internal/vet.s 7897 7867 -30 -0.380%
cmd/go/internal/envcmd.s 22176 22095 -81 -0.365%
cmd/go/internal/list.s 15216 15067 -149 -0.979%
cmd/go/internal/modget.s 38698 38519 -179 -0.463%
cmd/go/internal/modcmd.s 46674 46441 -233 -0.499%
cmd/go/internal/test.s 64664 64456 -208 -0.322%
cmd/go.s 6730 6703 -27 -0.401%
cmd/compile/internal/ssa.s 3592565 3582500 -10065 -0.280%
cmd/compile/internal/gc.s 1549123 1537123 -12000 -0.775%
cmd/compile/internal/riscv64.s 14579 14483 -96 -0.658%
cmd/compile/internal/mips.s 20578 20419 -159 -0.773%
cmd/compile/internal/ppc64.s 25524 25359 -165 -0.646%
cmd/compile/internal/mips64.s 19795 19636 -159 -0.803%
cmd/compile/internal/wasm.s 13329 13290 -39 -0.293%
cmd/compile/internal/s390x.s 28097 27892 -205 -0.730%
cmd/compile/internal/arm.s 31489 31321 -168 -0.534%
cmd/compile/internal/arm64.s 29803 29590 -213 -0.715%
cmd/compile/internal/amd64.s 32961 33221 +260 +0.789%
cmd/compile/internal/x86.s 31029 30878 -151 -0.487%
total 18534966 18440341 -94625 -0.511%
Change-Id: I830d37364f14f0297800adc42c99f60a74c51aca
Reviewed-on: https://go-review.googlesource.com/c/go/+/226367
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-03-24 22:14:02 -07:00
|
|
|
|
|
|
|
|
// GCWriteBarrierReg maps from registers to gcWriteBarrier implementation LSyms.
|
|
|
|
|
var GCWriteBarrierReg map[int16]*obj.LSym
|