Commit c7588418 authored by Russ Cox's avatar Russ Cox

cmd/ld, runtime: remove unused fields from Func

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