]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/ld, runtime: remove unused fields from Func
authorRuss Cox <rsc@golang.org>
Fri, 19 Jul 2013 22:52:35 +0000 (18:52 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 19 Jul 2013 22:52:35 +0000 (18:52 -0400)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/11604043

src/cmd/ld/lib.c
src/libmach/sym.c
src/pkg/debug/gosym/pclntab.go
src/pkg/runtime/runtime.h

index 674a1297759af8d6859bcf3e08d1175f74d5caa3..49f2bc304c8858609e810319a2d38fb8fc21e094 100644 (file)
@@ -2400,7 +2400,7 @@ pclntab(void)
 
                // fixed size of struct, checked below
                off = funcstart;
-               end = funcstart + PtrSize + 6*4 + 5*4 + npcdata*4 + nfuncdata*PtrSize;
+               end = funcstart + PtrSize + 3*4 + 5*4 + npcdata*4 + nfuncdata*PtrSize;
                if(nfuncdata > 0 && (end&(PtrSize-1)))
                        end += 4;
                symgrow(ftab, end);
@@ -2417,9 +2417,6 @@ pclntab(void)
                        off = setuint32(ftab, off, ArgsSizeUnknown);
                else
                        off = setuint32(ftab, off, cursym->args);
-
-               // Dead space. TODO: Delete (and update all parsers).
-               off = setuint32(ftab, off, 0);
        
                // frame int32
                // TODO: Remove entirely. The pcsp table is more precise.
@@ -2432,10 +2429,6 @@ pclntab(void)
                else
                        off = setuint32(ftab, off, (uint32)cursym->text->to.offset+PtrSize);
 
-               // Dead space. TODO: Delete (and update all parsers).
-               off = setuint32(ftab, off, 0);
-               off = setuint32(ftab, off, 0);
-
                // pcsp table (offset int32)
                off = addpctab(ftab, off, cursym, "pctospadj", pctospadj, 0);
 
index d8cd8ea1d9ebc9b77c83c227680e38c9d38bd2a8..b9732012f2cb90f5e588c86c8ec7cc633161a89f 100644 (file)
@@ -1563,6 +1563,15 @@ dumphist(char *name)
 // Go 1.2 pcln table
 // See golang.org/s/go12symtab.
 
+// Func layout
+#define FuncEntry (0)
+#define FuncName (pcptrsize)
+#define FuncArgs (pcptrsize+4)
+#define FuncFrame (pcptrsize+2*4)
+#define FuncPCSP (pcptrsize+3*4)
+#define FuncPCFile (pcptrsize+4*4)
+#define FuncPCLine (pcptrsize+5*4)
+
 static int32 pcquantum;
 static int32 pcptrsize;
 static uvlong (*pcswav)(uvlong);
@@ -1788,8 +1797,8 @@ go12pc2sp(uvlong pc)
        f = go12findfunc(pc);
        if(f == nil)
                return ~(uvlong)0;
-       entry = pcuintptr(f);
-       off = pcswal(*(uint32*)(f+pcptrsize+6*4));
+       entry = pcuintptr(f+FuncEntry);
+       off = pcswal(*(uint32*)(f+FuncPCSP));
        sp = pcvalue(off, entry, pc);
        if(sp < 0)
                return ~(uvlong)0;
@@ -1807,9 +1816,9 @@ go12fileline(char *str, int n, uvlong pc)
        f = go12findfunc(pc);
        if(f == nil)
                return 0;
-       entry = pcuintptr(f);
-       fileoff = pcswal(*(uint32*)(f+pcptrsize+7*4));
-       lineoff = pcswal(*(uint32*)(f+pcptrsize+8*4));
+       entry = pcuintptr(f+FuncEntry);
+       fileoff = pcswal(*(uint32*)(f+FuncPCFile));
+       lineoff = pcswal(*(uint32*)(f+FuncPCLine));
        lno = pcvalue(lineoff, entry, pc);
        fno = pcvalue(fileoff, entry, pc);
        if(lno < 0 || fno <= 0 || fno >= nfiletab) {
@@ -1845,9 +1854,9 @@ havefile:
        // quick.
        for(i=0; i<nfunctab; i++) {
                func = pcline + pcuintptr(functab+i*2*pcptrsize+pcptrsize);
-               entry = pcuintptr(func);
-               fp = pcline + pcswal(*(uint32*)(func+pcptrsize+7*4));
-               lp = pcline + pcswal(*(uint32*)(func+pcptrsize+8*4));
+               entry = pcuintptr(func+FuncEntry);
+               fp = pcline + pcswal(*(uint32*)(func+FuncPCFile));
+               lp = pcline + pcswal(*(uint32*)(func+FuncPCLine));
                fval = lval = -1;
                fpc = lpc = entry;
                fstartpc = fpc;
index 2b9bedb45bc598ad4a394118d5bab2b5534e9df3..3e6a8046b3e35e45beb591b747532ba92a6673d8 100644 (file)
@@ -339,7 +339,7 @@ func (t *LineTable) go12PCToLine(pc uint64) (line int) {
                return -1
        }
        entry := t.uintptr(f)
-       linetab := t.binary.Uint32(f[t.ptrsize+8*4:])
+       linetab := t.binary.Uint32(f[t.ptrsize+5*4:])
        return int(t.pcvalue(linetab, entry, pc))
 }
 
@@ -356,7 +356,7 @@ func (t *LineTable) go12PCToFile(pc uint64) (file string) {
                return ""
        }
        entry := t.uintptr(f)
-       filetab := t.binary.Uint32(f[t.ptrsize+7*4:])
+       filetab := t.binary.Uint32(f[t.ptrsize+4*4:])
        fno := t.pcvalue(filetab, entry, pc)
        if fno <= 0 {
                return ""
@@ -384,8 +384,8 @@ func (t *LineTable) go12LineToPC(file string, line int) (pc uint64) {
        for i := uint32(0); i < t.nfunctab; i++ {
                f := t.Data[t.uintptr(t.functab[2*t.ptrsize*i+t.ptrsize:]):]
                entry := t.uintptr(f)
-               filetab := t.binary.Uint32(f[t.ptrsize+7*4:])
-               linetab := t.binary.Uint32(f[t.ptrsize+8*4:])
+               filetab := t.binary.Uint32(f[t.ptrsize+4*4:])
+               linetab := t.binary.Uint32(f[t.ptrsize+5*4:])
                pc := t.findFileLine(entry, filetab, linetab, int32(filenum), int32(line))
                if pc != 0 {
                        return pc
index f405287aa862c7e77242441266c37f0a074a0ba3..36aff04ad381fc5b53218c21999ca6dc96800b90 100644 (file)
@@ -405,12 +405,9 @@ struct     Func
        uintptr entry;  // start pc
        int32   nameoff;        // function name
        
-       // TODO: Remove these fields.
+       // TODO: Perhaps remove these fields.
        int32   args;   // in/out args size
-       int32   x1;     // locals size
        int32   frame;  // legacy frame size; use pcsp if possible
-       int32   x2;
-       int32   x3;
 
        int32   pcsp;
        int32   pcfile;