You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
adds an optimization to transform captured variables (PPARAMREF) to plain PAUTO variables:
cmd/gc/closure.c:transformclosure:
if(v->byval&&v->type->width <= 2*widthptr&&arch.thechar=='6') {
// If it is a small variable captured by value,// downgrade it to PAUTO.v->class=PAUTO;
v->ullman=1;
xfunc->dcl=list(xfunc->dcl, v);
body=list(body, nod(OAS, v, cv));
} else {
However, it is enabled only for amd64 because of issues with codegen on at least 386 (have not tested arm,power,etc). The problem is that local vars created during copyout smash context.
The following code in cmd/internal/objfile/disass.go:
I agree we need to fix this for the other architectures. If we can't, we should disable it entirely. I don't want to be seen as favoring amd64 in this way.
rsc
changed the title
cmd/gc: enable PAUTO captured variables on arch != 6
cmd/compile: enable PAUTO captured variables on arch != 6
Jun 8, 2015
The following changelist:
cmd/gc: transform closure calls to function calls
https://go-review.googlesource.com/#/c/4050/
adds an optimization to transform captured variables (PPARAMREF) to plain PAUTO variables:
cmd/gc/closure.c:transformclosure:
However, it is enabled only for amd64 because of issues with codegen on at least 386 (have not tested arm,power,etc). The problem is that local vars created during copyout smash context.
The following code in cmd/internal/objfile/disass.go:
Generates the following code on 386 with the optimization enabled:
We need to fix codegen on 386 and test other archs.
@rsc @minux @DanielMorsing @aclements @josharian
The text was updated successfully, but these errors were encountered: