Commit fc7b75f2 authored by Rémy Oudompheng's avatar Rémy Oudompheng

cmd/gc: fix export data for aggressive inlining.

Export data was broken after revision 6b602ab487d6
when -l is specified at least 3 times: it makes the compiler
write out func (*T).Method() declarations in export data, which
is not supported.

Also fix the formatting of recover() in export data. It was
not treated like panic() and was rendered as "<node RECOVER>".

R=golang-dev, lvd, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7067051
parent ba05a436
...@@ -106,12 +106,19 @@ reexportdep(Node *n) ...@@ -106,12 +106,19 @@ reexportdep(Node *n)
switch(n->class&~PHEAP) { switch(n->class&~PHEAP) {
case PFUNC: case PFUNC:
// methods will be printed along with their type // methods will be printed along with their type
// nodes for T.Method expressions
if(n->left && n->left->op == OTYPE) if(n->left && n->left->op == OTYPE)
break; break;
// nodes for method calls.
if(!n->type || n->type->thistuple > 0)
break;
// fallthrough // fallthrough
case PEXTERN: case PEXTERN:
if(n->sym && !exportedsym(n->sym)) if(n->sym && !exportedsym(n->sym)) {
if(debug['E'])
print("reexport name %S\n", n->sym);
exportlist = list(exportlist, n); exportlist = list(exportlist, n);
}
} }
break; break;
...@@ -122,6 +129,8 @@ reexportdep(Node *n) ...@@ -122,6 +129,8 @@ reexportdep(Node *n)
if(isptr[t->etype]) if(isptr[t->etype])
t = t->type; t = t->type;
if(t && t->sym && t->sym->def && !exportedsym(t->sym)) { if(t && t->sym && t->sym->def && !exportedsym(t->sym)) {
if(debug['E'])
print("reexport type %S from declaration\n", t->sym);
exportlist = list(exportlist, t->sym->def); exportlist = list(exportlist, t->sym->def);
} }
} }
......
...@@ -228,6 +228,7 @@ goopnames[] = ...@@ -228,6 +228,7 @@ goopnames[] =
[ORANGE] = "range", [ORANGE] = "range",
[OREAL] = "real", [OREAL] = "real",
[ORECV] = "<-", [ORECV] = "<-",
[ORECOVER] = "recover",
[ORETURN] = "return", [ORETURN] = "return",
[ORSH] = ">>", [ORSH] = ">>",
[OSELECT] = "select", [OSELECT] = "select",
...@@ -1290,6 +1291,7 @@ exprfmt(Fmt *f, Node *n, int prec) ...@@ -1290,6 +1291,7 @@ exprfmt(Fmt *f, Node *n, int prec)
case OMAKE: case OMAKE:
case ONEW: case ONEW:
case OPANIC: case OPANIC:
case ORECOVER:
case OPRINT: case OPRINT:
case OPRINTN: case OPRINTN:
if(n->left) if(n->left)
......
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