cmd/compile: escape analysis too pessimistic for value-captures at closure evaluation. #17388
Labels
early-in-cycle
A change that should be done early in the 3 month dev cycle.
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
Performance
Milestone
The parameter
ops
toqux
is inferred to escape, incorrectly,compared to the equivalent rewriting into
bar
andbarfun
.go build -gcflags '-m -l' e2.go
yieldsI think this results from a very simple model of closure behavior; anything captured is regarded as transmitted to any result, regardless of the actual behavior of the closure.
It is plausible that the escape behavior of closures could be modeled in the same way as the escape behavior for ordinary functions, with captured-by-value parameters treated equivalently.
The text was updated successfully, but these errors were encountered: