Commit 68c1c6af authored by Russ Cox's avatar Russ Cox

cmd/cc, cmd/gc: stop generating 'argsize' PCDATA

The argsize PCDATA was specifying the number of
bytes passed to a function call, so that if the function
did not specify its argument count, the garbage collector
could use the call site information to scan those bytes
conservatively. We don't do that anymore, so stop
generating the information.

LGTM=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/139530043
parent e844f53a
......@@ -366,14 +366,12 @@ _cgen(Node *n, Node *nn, int inrel)
if(REGARG >= 0)
o = reg[REGARG];
gargs(r, &nod, &nod1);
gpcdata(PCDATA_ArgSize, curarg);
if(l->addable < INDEXED) {
reglcgen(&nod, l, Z);
gopcode(OFUNC, Z, Z, &nod);
regfree(&nod);
} else
gopcode(OFUNC, Z, Z, l);
gpcdata(PCDATA_ArgSize, -1);
if(REGARG >= 0)
if(o != reg[REGARG])
reg[REGARG]--;
......
......@@ -109,7 +109,6 @@ void split64(Node*, Node*, Node*);
void splitclean(void);
Node* ncon(uint32 i);
void gtrack(Sym*);
void gargsize(int32);
/*
* obj.c
......
......@@ -179,28 +179,12 @@ fixautoused(Prog* p)
void
ginscall(Node *f, int proc)
{
int32 arg;
Prog *p;
Node n1, r, r1, con;
if(f->type != T)
setmaxarg(f->type);
arg = -1;
// Most functions have a fixed-size argument block, so traceback uses that during unwind.
// Not all, though: there are some variadic functions in package runtime,
// and for those we emit call-specific metadata recorded by caller.
// Reflect generates functions with variable argsize (see reflect.methodValueCall/makeFuncStub),
// so we do this for all indirect calls as well.
if(f->type != T && (f->sym == S || (f->sym != S && f->sym->pkg == runtimepkg) || proc == 1 || proc == 2)) {
arg = f->type->argwid;
if(proc == 1 || proc == 2)
arg += 3*widthptr;
}
if(arg != -1)
gargsize(arg);
switch(proc) {
default:
fatal("ginscall: bad proc %d", proc);
......@@ -297,9 +281,6 @@ ginscall(Node *f, int proc)
}
break;
}
if(arg != -1)
gargsize(-1);
}
/*
......
......@@ -205,16 +205,6 @@ ggloblnod(Node *nam)
p->reg |= NOPTR;
}
void
gargsize(int32 size)
{
Node n1, n2;
nodconst(&n1, types[TINT32], PCDATA_ArgSize);
nodconst(&n2, types[TINT32], size);
gins(APCDATA, &n1, &n2);
}
void
ggloblsym(Sym *s, int32 width, int8 flags)
{
......
......@@ -945,7 +945,6 @@ cgen(Node *n, Node *nn)
return;
}
gargs(r, &nod, &nod1);
gpcdata(PCDATA_ArgSize, curarg);
if(l->addable < INDEXED) {
reglcgen(&nod, l, nn);
nod.op = OREGISTER;
......@@ -953,12 +952,9 @@ cgen(Node *n, Node *nn)
regfree(&nod);
} else
gopcode(OFUNC, n->type, Z, l);
gpcdata(PCDATA_ArgSize, -1);
if(REGARG >= 0 && reg[REGARG])
reg[REGARG]--;
regret(&nod, n, l->type, 1); // update maxarg if nothing else
gpcdata(PCDATA_ArgSize, curarg);
gpcdata(PCDATA_ArgSize, -1);
if(nn != Z)
gmove(&nod, nn);
if(nod.op == OREGISTER)
......
......@@ -99,7 +99,6 @@ int sudoaddable(int, Node*, Addr*);
void afunclit(Addr*, Node*);
void nodfconst(Node*, Type*, Mpflt*);
void gtrack(Sym*);
void gargsize(vlong);
void fixlargeoffset(Node *n);
/*
......
......@@ -175,7 +175,6 @@ fixautoused(Prog *p)
void
ginscall(Node *f, int proc)
{
int32 arg;
Prog *p;
Node reg, con;
Node r1;
......@@ -183,21 +182,6 @@ ginscall(Node *f, int proc)
if(f->type != T)
setmaxarg(f->type);
arg = -1;
// Most functions have a fixed-size argument block, so traceback uses that during unwind.
// Not all, though: there are some variadic functions in package runtime,
// and for those we emit call-specific metadata recorded by caller.
// Reflect generates functions with variable argsize (see reflect.methodValueCall/makeFuncStub),
// so we do this for all indirect calls as well.
if(f->type != T && (f->sym == S || (f->sym != S && f->sym->pkg == runtimepkg) || proc == 1 || proc == 2)) {
arg = f->type->argwid;
if(proc == 1 || proc == 2)
arg += 2*widthptr;
}
if(arg != -1)
gargsize(arg);
switch(proc) {
default:
fatal("ginscall: bad proc %d", proc);
......@@ -275,9 +259,6 @@ ginscall(Node *f, int proc)
}
break;
}
if(arg != -1)
gargsize(-1);
}
/*
......
......@@ -214,16 +214,6 @@ gtrack(Sym *s)
p->from.sym = linksym(s);
}
void
gargsize(vlong size)
{
Node n1, n2;
nodconst(&n1, types[TINT32], PCDATA_ArgSize);
nodconst(&n2, types[TINT32], size);
gins(APCDATA, &n1, &n2);
}
void
ggloblsym(Sym *s, int32 width, int8 flags)
{
......
......@@ -938,7 +938,6 @@ cgen(Node *n, Node *nn)
return;
}
gargs(r, &nod, &nod1);
gpcdata(PCDATA_ArgSize, curarg);
if(l->addable < INDEXED) {
reglcgen(&nod, l, nn);
nod.op = OREGISTER;
......@@ -946,7 +945,6 @@ cgen(Node *n, Node *nn)
regfree(&nod);
} else
gopcode(OFUNC, n->type, Z, l);
gpcdata(PCDATA_ArgSize, -1);
if(REGARG >= 0 && reg[REGARG])
reg[REGARG]--;
regret(&nod, n, l->type, 1); // update maxarg if nothing else
......
......@@ -114,7 +114,6 @@ void split64(Node*, Node*, Node*);
void splitclean(void);
void nswap(Node*, Node*);
void gtrack(Sym*);
void gargsize(int32);
/*
* cplx.c
*/
......
......@@ -217,21 +217,6 @@ ginscall(Node *f, int proc)
if(f->type != T)
setmaxarg(f->type);
arg = -1;
// Most functions have a fixed-size argument block, so traceback uses that during unwind.
// Not all, though: there are some variadic functions in package runtime,
// and for those we emit call-specific metadata recorded by caller.
// Reflect generates functions with variable argsize (see reflect.methodValueCall/makeFuncStub),
// so we do this for all indirect calls as well.
if(f->type != T && (f->sym == S || (f->sym != S && f->sym->pkg == runtimepkg) || proc == 1 || proc == 2)) {
arg = f->type->argwid;
if(proc == 1 || proc == 2)
arg += 2*widthptr;
}
if(arg != -1)
gargsize(arg);
switch(proc) {
default:
fatal("ginscall: bad proc %d", proc);
......@@ -293,9 +278,6 @@ ginscall(Node *f, int proc)
}
break;
}
if(arg != -1)
gargsize(-1);
}
/*
......
......@@ -205,16 +205,6 @@ ggloblnod(Node *nam)
p->from.scale |= NOPTR;
}
void
gargsize(int32 size)
{
Node n1, n2;
nodconst(&n1, types[TINT32], PCDATA_ArgSize);
nodconst(&n2, types[TINT32], size);
gins(APCDATA, &n1, &n2);
}
void
ggloblsym(Sym *s, int32 width, int8 flags)
{
......
......@@ -9,18 +9,12 @@
//
// symtab.go also contains a copy of these constants.
// TODO(rsc): Remove PCDATA_ArgSize, renumber StackMapIndex to 0.
#define PCDATA_ArgSize 0 /* argument size at CALL instruction */
#define PCDATA_StackMapIndex 1
#define PCDATA_StackMapIndex 0
#define FUNCDATA_ArgsPointerMaps 0 /* garbage collector blocks */
#define FUNCDATA_LocalsPointerMaps 1
#define FUNCDATA_DeadValueMaps 2
// TODO(rsc): Remove ARGSIZE.
// To be used in assembly.
#define ARGSIZE(n) PCDATA $PCDATA_ArgSize, $n
// Pseudo-assembly statements.
// GO_ARGS, GO_RESULTS_INITIALIZED, and NO_LOCAL_POINTERS are macros
......
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