aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/symtab.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2020-04-16 08:13:58 -0400
committerAustin Clements <austin@google.com>2020-04-29 21:29:21 +0000
commit9d812cfa5cbb1f573d61c452c864072270526753 (patch)
treebf2731ef44747066f0482780f2cb336cbb6b4f71 /src/runtime/symtab.go
parentee7d9f1c37c768b859c27dec2a897b12fa928c4e (diff)
downloadgo-9d812cfa5cbb1f573d61c452c864072270526753.tar.gz
go-9d812cfa5cbb1f573d61c452c864072270526753.zip
cmd/compile,runtime: stack maps only at calls, remove register maps
Currently, we emit stack maps and register maps at almost every instruction. This was originally intended to support non-cooperative preemption, but was only ever used for debug call injection. Now debug call injection also uses conservative frame scanning. As a result, stack maps are only needed at call sites and register maps aren't needed at all except that we happen to also encode unsafe-point information in the register map PCDATA stream. This CL reduces stack maps to only appear at calls, and replace full register maps with just safe/unsafe-point information. This is all protected by the go115ReduceLiveness feature flag, which is defined in both runtime and cmd/compile. This CL significantly reduces binary sizes and also speeds up compiles and links: name old exe-bytes new exe-bytes delta BinGoSize 15.0MB ± 0% 14.1MB ± 0% -5.72% name old pcln-bytes new pcln-bytes delta BinGoSize 3.14MB ± 0% 2.48MB ± 0% -21.08% name old time/op new time/op delta Template 178ms ± 7% 172ms ±14% -3.59% (p=0.005 n=19+19) Unicode 71.0ms ±12% 69.8ms ±10% ~ (p=0.126 n=18+18) GoTypes 655ms ± 8% 615ms ± 8% -6.11% (p=0.000 n=19+19) Compiler 3.27s ± 6% 3.15s ± 7% -3.69% (p=0.001 n=20+20) SSA 7.10s ± 5% 6.85s ± 8% -3.53% (p=0.001 n=19+20) Flate 124ms ±15% 116ms ±22% -6.57% (p=0.024 n=18+19) GoParser 156ms ±26% 147ms ±34% ~ (p=0.070 n=19+19) Reflect 406ms ± 9% 387ms ±21% -4.69% (p=0.028 n=19+20) Tar 163ms ±15% 162ms ±27% ~ (p=0.370 n=19+19) XML 223ms ±13% 218ms ±14% ~ (p=0.157 n=20+20) LinkCompiler 503ms ±21% 484ms ±23% ~ (p=0.072 n=20+20) ExternalLinkCompiler 1.27s ± 7% 1.22s ± 8% -3.85% (p=0.005 n=20+19) LinkWithoutDebugCompiler 294ms ±17% 273ms ±11% -7.16% (p=0.001 n=19+18) (https://perf.golang.org/search?q=upload:20200428.8) The binary size improvement is even slightly better when you include the CLs leading up to this. Relative to the parent of "cmd/compile: mark PanicBounds/Extend as calls": name old exe-bytes new exe-bytes delta BinGoSize 15.0MB ± 0% 14.1MB ± 0% -6.18% name old pcln-bytes new pcln-bytes delta BinGoSize 3.22MB ± 0% 2.48MB ± 0% -22.92% (https://perf.golang.org/search?q=upload:20200428.9) For #36365. Change-Id: I69448e714f2a44430067ca97f6b78e08c0abed27 Reviewed-on: https://go-review.googlesource.com/c/go/+/230544 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/runtime/symtab.go')
-rw-r--r--src/runtime/symtab.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go
index b2147c4cb4..04aa90e077 100644
--- a/src/runtime/symtab.go
+++ b/src/runtime/symtab.go
@@ -268,13 +268,14 @@ func (f *Func) funcInfo() funcInfo {
//
// See funcdata.h and ../cmd/internal/objabi/funcdata.go.
const (
- _PCDATA_RegMapIndex = 0
+ _PCDATA_RegMapIndex = 0 // if !go115ReduceLiveness
+ _PCDATA_UnsafePoint = 0 // if go115ReduceLiveness
_PCDATA_StackMapIndex = 1
_PCDATA_InlTreeIndex = 2
_FUNCDATA_ArgsPointerMaps = 0
_FUNCDATA_LocalsPointerMaps = 1
- _FUNCDATA_RegPointerMaps = 2
+ _FUNCDATA_RegPointerMaps = 2 // if !go115ReduceLiveness
_FUNCDATA_StackObjects = 3
_FUNCDATA_InlTree = 4
_FUNCDATA_OpenCodedDeferInfo = 5
@@ -282,6 +283,12 @@ const (
_ArgsSizeUnknown = -0x80000000
)
+const (
+ // PCDATA_UnsafePoint values.
+ _PCDATA_UnsafePointSafe = -1 // Safe for async preemption
+ _PCDATA_UnsafePointUnsafe = -2 // Unsafe for async preemption
+)
+
// A FuncID identifies particular functions that need to be treated
// specially by the runtime.
// Note that in some situations involving plugins, there may be multiple