1
0
mirror of https://github.com/golang/go synced 2024-11-26 14:46:47 -07:00

cmd/ld, runtime: remove unused fields from Func

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/11604043
This commit is contained in:
Russ Cox 2013-07-19 18:52:35 -04:00
parent 7666f24a84
commit c758841853
4 changed files with 23 additions and 24 deletions

View 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);

View 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;

View 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

View 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;