]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/gc: fix export data for aggressive inlining.
authorRémy Oudompheng <oudomphe@phare.normalesup.org>
Wed, 30 Jan 2013 20:10:19 +0000 (21:10 +0100)
committerRémy Oudompheng <oudomphe@phare.normalesup.org>
Wed, 30 Jan 2013 20:10:19 +0000 (21:10 +0100)
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

src/cmd/gc/export.c
src/cmd/gc/fmt.c

index b235f676cdc13e01d3cb71848af842e8f2969143..6cbd5c8fffcfbbc0da95d18c212da6f8da6bbe45 100644 (file)
@@ -106,12 +106,19 @@ reexportdep(Node *n)
                switch(n->class&~PHEAP) {
                case PFUNC:
                        // methods will be printed along with their type
+                       // nodes for T.Method expressions
                        if(n->left && n->left->op == OTYPE)
                                break;
+                       // nodes for method calls.
+                       if(!n->type || n->type->thistuple > 0)
+                               break;
                        // fallthrough
                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);
+                       }
                }
                break;
 
@@ -122,6 +129,8 @@ reexportdep(Node *n)
                        if(isptr[t->etype])
                                t = t->type;
                        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);
                        }
                }
index 3ff212ea335ca11c774563c87345566aadcf5e39..ce6ee729bd3803c6ddc5a6604c0a55d6fbaa4f71 100644 (file)
@@ -228,6 +228,7 @@ goopnames[] =
        [ORANGE]        = "range",
        [OREAL]         = "real",
        [ORECV]         = "<-",
+       [ORECOVER]      = "recover",
        [ORETURN]       = "return",
        [ORSH]          = ">>",
        [OSELECT]       = "select",
@@ -1290,6 +1291,7 @@ exprfmt(Fmt *f, Node *n, int prec)
        case OMAKE:
        case ONEW:
        case OPANIC:
+       case ORECOVER:
        case OPRINT:
        case OPRINTN:
                if(n->left)