mirror of https://github.com/golang/go.git
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/2278 Reviewed-by: Rick Hudson <rlh@golang.org>
This commit is contained in:
parent
54bb4dc390
commit
e5ef657264
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue