Unreviewed changes
4 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: src/cmd/compile/internal/escape/solve.go
Insertions: 6, Deletions: 6.
@@ -17,7 +17,7 @@
// walkState contains the root properties used by a walk. Roots with equal
// states can be analyzed together.
type walkState struct {
- root *location
+ sink *location // canonical leak sink; not necessarily a walk root
curfn *ir.Func
loopDepth int
attrs locAttr
@@ -37,13 +37,13 @@
// walkState returns the normalized walk state for loc.
func (b *batch) walkState(loc *location) walkState {
s := walkState{
- root: &b.heapLoc,
+ sink: &b.heapLoc,
curfn: loc.curfn,
loopDepth: loc.loopDepth,
attrs: loc.attrs,
}
if loc.paramOut || loc == &b.mutatorLoc || loc == &b.calleeLoc {
- s.root = loc
+ s.sink = loc
return s
}
if loc.hasAttr(attrEscapes) {
@@ -228,7 +228,7 @@
fmt.Sprintf("parameter %v leaks to %s with derefs=%d", l.n, b.explainLoc(root), derefs), explanation)
}
}
- l.leakTo(s.root, derefs)
+ l.leakTo(s.sink, derefs)
}
if s.hasAttr(attrMutates) {
l.paramEsc.AddMutator(derefs)
@@ -372,14 +372,14 @@
}
// Pseudo-locations that don't really exist.
- if s.root == &b.mutatorLoc || s.root == &b.calleeLoc {
+ if s.sink == &b.mutatorLoc || s.sink == &b.calleeLoc {
return false
}
// We don't know what callers do with returned values, so
// pessimistically we need to assume they flow to the heap and
// outlive everything too.
- if s.root != nil && s.root.paramOut {
+ if s.sink != nil && s.sink.paramOut {
// Exception: Closures can return locations allocated outside of
// them without forcing them to the heap, if we can statically
// identify all call sites. For example:
```
Change information
Commit message:
cmd/compile: coalesce equivalent escape analysis walks
Escape analysis walks the graph once from every location, and repeats
those walks as location attributes change. In large recursive batches,
many roots have the same attributes and outlives behavior, so these
walks do the same work.
Group roots with equivalent analysis state into a single multi-source
walk.
The previous CL made diagnostic paths independent of the walk's mutable
state. Record the root in those paths so -m=2 and logopt can use the
same multi-source walks too.
compilebench results (this CL vs parent):
│ parent.txt │ commit.txt │
│ sec/op │ sec/op vs base │
Template 102.5m ± 12% 106.1m ± 20% ~ (p=0.589 n=6)
Unicode 57.53m ± 36% 56.18m ± 18% ~ (p=0.818 n=6)
GoTypes 567.4m ± 8% 558.4m ± 4% ~ (p=0.818 n=6)
Compiler 116.06m ± 19% 97.10m ± 9% -16.34% (p=0.002 n=6)
SSA 4.738 ± 2% 4.884 ± 3% +3.09% (p=0.041 n=6)
Flate 103.6m ± 18% 102.7m ± 15% ~ (p=0.699 n=6)
GoParser 122.5m ± 23% 132.4m ± 30% ~ (p=0.180 n=6)
Reflect 238.6m ± 7% 242.0m ± 11% ~ (p=0.818 n=6)
Tar 109.6m ± 27% 110.1m ± 9% ~ (p=0.937 n=6)
XML 128.6m ± 10% 123.8m ± 6% ~ (p=0.699 n=6)
StdCmd 27.54 ± 6% 28.19 ± 2% ~ (p=0.180 n=6)
TypeScriptGoChecker 10.480 ± 2% 5.400 ± 2% -48.47% (p=0.002 n=6)
geomean 410.2m 385.5m -6.01%
│ parent.txt │ commit.txt │
│ user-sec/op │ user-sec/op vs base │
Template 473.9m ± 9% 473.7m ± 16% ~ (p=0.937 n=6)
Unicode 88.17m ± 23% 84.17m ± 19% ~ (p=0.818 n=6)
GoTypes 3.443 ± 3% 3.459 ± 5% ~ (p=0.937 n=6)
Compiler 322.3m ± 4% 310.1m ± 8% -3.79% (p=0.026 n=6)
SSA 30.92 ± 5% 31.82 ± 4% ~ (p=0.240 n=6)
Flate 502.4m ± 18% 526.6m ± 7% ~ (p=0.818 n=6)
GoParser 529.2m ± 15% 546.7m ± 13% ~ (p=0.589 n=6)
Reflect 1.235 ± 5% 1.238 ± 4% ~ (p=0.699 n=6)
Tar 528.7m ± 9% 508.2m ± 11% ~ (p=0.818 n=6)
XML 619.4m ± 9% 659.8m ± 9% ~ (p=0.240 n=6)
TypeScriptGoChecker 25.51 ± 2% 20.84 ± 3% -18.30% (p=0.002 n=6)
geomean 1.133 1.117 -1.34%
Produces identical compiler output for internal/checker.
Change-Id: I11c5be2e60509da806b485bd9733f9c877ac25c1
Files:
- M src/cmd/compile/internal/escape/graph.go
- M src/cmd/compile/internal/escape/solve.go
Change size: M
Delta: 2 files changed, 124 insertions(+), 56 deletions(-)
Branch: refs/heads/master