Commit e5ef6572 authored by Russ Cox's avatar Russ Cox

cmd/gc: add write barrier in copy of function parameters to heap

Found with GODEBUG=wbshadow=2 mode.
Eventually that will run automatically, but right now
it still detects other missing write barriers.

Change-Id: I1320d5340a9e421c779f24f3b170e33974e56e4f
Reviewed-on: https://go-review.googlesource.com/2278Reviewed-by: default avatarRick Hudson <rlh@golang.org>
parent 54bb4dc3
......@@ -2786,6 +2786,7 @@ islvalue(Node *n)
case OIND:
case ODOTPTR:
case OCLOSUREVAR:
case OPARAM:
return 1;
case ODOT:
return islvalue(n->left);
......
......@@ -462,6 +462,7 @@ walkexpr(Node **np, NodeList **init)
case ONONAME:
case OINDREG:
case OEMPTY:
case OPARAM:
goto ret;
case ONOT:
......@@ -2519,7 +2520,7 @@ paramstoheap(Type **argin, int out)
{
Type *t;
Iter savet;
Node *v;
Node *v, *as;
NodeList *nn;
nn = nil;
......@@ -2544,8 +2545,13 @@ paramstoheap(Type **argin, int out)
if(v->alloc == nil)
v->alloc = callnew(v->type);
nn = list(nn, nod(OAS, v->heapaddr, v->alloc));
if((v->class & ~PHEAP) != PPARAMOUT)
nn = list(nn, nod(OAS, v, v->stackparam));
if((v->class & ~PHEAP) != PPARAMOUT) {
as = nod(OAS, v, v->stackparam);
v->stackparam->typecheck = 1;
typecheck(&as, Etop);
as = applywritebarrier(as, &nn);
nn = list(nn, as);
}
}
return nn;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment