dumpbvtypes(&child->args, (byte*)s->sp + child->argoff);
if(stackmap != nil && stackmap->n > 0) {
bv = runtime·stackmapdata(stackmap, pcdata);
- dumpbvtypes(&bv, s->varp - bv.n / BitsPerPointer * PtrSize);
+ dumpbvtypes(&bv, (byte*)(s->varp - bv.n / BitsPerPointer * PtrSize));
} else {
bv.n = -1;
}
// Dump fields in the local vars section
if(stackmap == nil) {
// No locals information, dump everything.
- for(off = child->arglen; off < s->varp - (byte*)s->sp; off += PtrSize) {
+ for(off = child->arglen; off < s->varp - s->sp; off += PtrSize) {
dumpint(FieldKindPtr);
dumpint(off);
}
} else if(stackmap->n < 0) {
// Locals size information, dump just the locals.
size = -stackmap->n;
- for(off = s->varp - size - (byte*)s->sp; off < s->varp - (byte*)s->sp; off += PtrSize) {
+ for(off = s->varp - size - s->sp; off < s->varp - s->sp; off += PtrSize) {
dumpint(FieldKindPtr);
dumpint(off);
}
} else if(stackmap->n > 0) {
// Locals bitmap information, scan just the pointers in
// locals.
- dumpbv(&bv, s->varp - bv.n / BitsPerPointer * PtrSize - (byte*)s->sp);
+ dumpbv(&bv, s->varp - bv.n / BitsPerPointer * PtrSize - s->sp);
}
dumpint(FieldKindEol);
// Record arg info for parent.
- child->argoff = s->argp - (byte*)s->fp;
+ child->argoff = s->argp - s->fp;
child->arglen = s->arglen;
child->sp = (byte*)s->sp;
child->depth++;
stackmap = runtime·funcdata(f, FUNCDATA_LocalsPointerMaps);
if(stackmap == nil) {
// No locals information, scan everything.
- size = frame->varp - (byte*)frame->sp;
+ size = frame->varp - frame->sp;
if(Debug > 2)
- runtime·printf("frame %s unsized locals %p+%p\n", runtime·funcname(f), frame->varp-size, size);
- scanblock(frame->varp - size, size, ScanConservatively);
+ runtime·printf("frame %s unsized locals %p+%p\n", runtime·funcname(f), (byte*)(frame->varp-size), size);
+ scanblock((byte*)(frame->varp - size), size, ScanConservatively);
} else if(stackmap->n < 0) {
// Locals size information, scan just the locals.
size = -stackmap->n;
if(Debug > 2)
- runtime·printf("frame %s conservative locals %p+%p\n", runtime·funcname(f), frame->varp-size, size);
- scanblock(frame->varp - size, size, ScanConservatively);
+ runtime·printf("frame %s conservative locals %p+%p\n", runtime·funcname(f), (byte*)(frame->varp-size), size);
+ scanblock((byte*)(frame->varp - size), size, ScanConservatively);
} else if(stackmap->n > 0) {
// Locals bitmap information, scan just the pointers in locals.
if(pcdata < 0 || pcdata >= stackmap->n) {
}
bv = runtime·stackmapdata(stackmap, pcdata);
size = (bv.n * PtrSize) / BitsPerPointer;
- scanblock(frame->varp - size, bv.n/BitsPerPointer*PtrSize, (byte*)bv.data);
+ scanblock((byte*)(frame->varp - size), bv.n/BitsPerPointer*PtrSize, (byte*)bv.data);
}
// Scan arguments.
stackmap = runtime·funcdata(f, FUNCDATA_ArgsPointerMaps);
if(stackmap != nil) {
bv = runtime·stackmapdata(stackmap, pcdata);
- scanblock(frame->argp, bv.n/BitsPerPointer*PtrSize, (byte*)bv.data);
+ scanblock((byte*)frame->argp, bv.n/BitsPerPointer*PtrSize, (byte*)bv.data);
} else {
if(Debug > 2)
runtime·printf("frame %s conservative args %p+%p\n", runtime·funcname(f), frame->argp, (uintptr)frame->arglen);
- scanblock(frame->argp, frame->arglen, ScanConservatively);
+ scanblock((byte*)frame->argp, frame->arglen, ScanConservatively);
}
return true;
}
Stkframe *frame0;
frame0 = ctxt;
- if(frame0->sp >= (uintptr)frame->varp - frame->sp && frame0->sp < (uintptr)frame->varp) {
+ if(frame0->sp >= frame->varp - frame->sp && frame0->sp < frame->varp) {
*frame0 = *frame;
return false;
}
*len = n/PtrSize;
*mask = runtime·mallocgc(*len, nil, 0);
for(i = 0; i < n; i += PtrSize) {
- off = (p+i-frame.varp+size)/PtrSize;
+ off = (p+i-(byte*)frame.varp+size)/PtrSize;
bits = (bv.data[off*BitsPerPointer/32] >> ((off*BitsPerPointer)%32))&BitsMask;
(*mask)[i/PtrSize] = bits;
}
d = newdefer(siz);
d->fn = fn;
- d->pc = runtime·getcallerpc(&siz);
+ d->pc = (uintptr)runtime·getcallerpc(&siz);
if(thechar == '5')
- d->argp = (byte*)(&fn+2); // skip caller's saved link register
+ d->argp = (uintptr)(&fn+2); // skip caller's saved link register
else
- d->argp = (byte*)(&fn+1);
- runtime·memmove(d->args, d->argp, d->siz);
+ d->argp = (uintptr)(&fn+1);
+ runtime·memmove(d->args, (byte*)d->argp, d->siz);
// deferproc returns 0 normally.
// a deferred func that stops a panic
runtime·deferreturn(uintptr arg0)
{
Defer *d;
- byte *argp;
+ uintptr argp;
FuncVal *fn;
d = g->defer;
if(d == nil)
return;
- argp = (byte*)&arg0;
+ argp = (uintptr)&arg0;
if(d->argp != argp)
return;
// won't know the form of the arguments until the jmpdefer can
// flip the PC over to fn.
g->m->locks++;
- runtime·memmove(argp, d->args, d->siz);
+ runtime·memmove((byte*)argp, d->args, d->siz);
fn = d->fn;
g->defer = d->link;
freedefer(d);
{
Defer *d, dabort;
Panic p;
- void *pc, *argp;
+ uintptr pc, argp;
runtime·memclr((byte*)&p, sizeof p);
p.arg = e;
{
int32 siz;
bool special; // not part of defer frame
- byte* argp; // where args were copied from
- byte* pc;
+ uintptr argp; // where args were copied from
+ uintptr pc;
FuncVal* fn;
Defer* link;
void* args[1]; // padded to actual size
};
// argp used in Defer structs when there is no argp.
-// TODO(rsc): Maybe we could use nil instead, but we've always used -1
-// and I don't want to change this days before the Go 1.3 release.
-#define NoArgs ((byte*)-1)
+#define NoArgs ((uintptr)-1)
/*
* panics
bool aborted; // the panic was aborted
};
+typedef struct XXX XXX;
+
/*
* stack traces
*/
uintptr lr; // program counter at caller aka link register
uintptr sp; // stack pointer at pc
uintptr fp; // stack pointer at caller aka frame pointer
- byte* varp; // top of local variables
- byte* argp; // pointer to function arguments
+ uintptr varp; // top of local variables
+ uintptr argp; // pointer to function arguments
uintptr arglen; // number of bytes at argp
};
int32 runtime·write(uintptr, void*, int32); // use uintptr to accommodate windows.
int32 runtime·close(int32);
int32 runtime·mincore(void*, uintptr, byte*);
-void runtime·jmpdefer(FuncVal*, void*);
+void runtime·jmpdefer(FuncVal*, uintptr);
void runtime·exit1(int32);
void runtime·ready(G*);
byte* runtime·getenv(int8*);
if(StackDebug >= 2)
runtime·printf(" checking %s frame=[%p,%p] stk=[%p,%p]\n", runtime·funcname(f), frame->sp, frame->fp, cinfo->stk, cinfo->base);
// if we're not in the segment any more, return immediately.
- if(frame->varp < cinfo->stk || frame->varp >= cinfo->base) {
+ if((byte*)frame->varp < cinfo->stk || (byte*)frame->varp >= cinfo->base) {
if(StackDebug >= 2)
runtime·printf(" <next segment>\n");
return false; // stop traceback
cinfo->frames++;
return true;
}
- if(frame->varp != (byte*)frame->sp) { // not in prologue (and has at least one local or outarg)
+ if((byte*)frame->varp != (byte*)frame->sp) { // not in prologue (and has at least one local or outarg)
stackmap = runtime·funcdata(f, FUNCDATA_LocalsPointerMaps);
if(stackmap == nil) {
cinfo->frames = -1;
// For now, this only happens with the Defer in runtime.main.
continue;
}
- if(d->argp < cinfo.stk || cinfo.base <= d->argp)
+ if((byte*)d->argp < cinfo.stk || cinfo.base <= (byte*)d->argp)
break; // a defer for the next segment
fn = d->fn;
if(fn == nil) // See issue 8047
pcdata = 0; // in prologue
// adjust local pointers
- if(frame->varp != (byte*)frame->sp) {
+ if((byte*)frame->varp != (byte*)frame->sp) {
stackmap = runtime·funcdata(f, FUNCDATA_LocalsPointerMaps);
if(stackmap == nil)
runtime·throw("no locals info");
*dp = (Defer*)((byte*)d + adjinfo->delta);
continue;
}
- if(d->argp < adjinfo->oldstk || adjinfo->oldbase <= d->argp)
+ if((byte*)d->argp < adjinfo->oldstk || adjinfo->oldbase <= (byte*)d->argp)
break; // a defer for the next segment
fn = d->fn;
if(fn == nil) {
}
}
- frame.varp = (byte*)frame.fp;
+ frame.varp = frame.fp;
// Derive size of arguments.
// Most functions have a fixed-size argument block,
// in package runtime and reflect, and for those we use call-specific
// metadata recorded by f's caller.
if(callback != nil || printing) {
- frame.argp = (byte*)frame.fp + sizeof(uintptr);
+ frame.argp = frame.fp + sizeof(uintptr);
if(f->args != ArgsSizeUnknown)
frame.arglen = f->args;
else if(flr == nil)
// returns; everything live at earlier deferprocs is still live at that one.
frame.continpc = frame.pc;
if(waspanic) {
- if(panic != nil && panic->defer->argp == (byte*)sparg)
+ if(panic != nil && panic->defer->argp == sparg)
frame.continpc = (uintptr)panic->defer->pc;
- else if(defer != nil && defer->argp == (byte*)sparg)
+ else if(defer != nil && defer->argp == sparg)
frame.continpc = (uintptr)defer->pc;
else
frame.continpc = 0;
}
// Unwind our local panic & defer stacks past this frame.
- while(panic != nil && (panic->defer == nil || panic->defer->argp == (byte*)sparg || panic->defer->argp == NoArgs))
+ while(panic != nil && (panic->defer == nil || panic->defer->argp == sparg || panic->defer->argp == NoArgs))
panic = panic->link;
- while(defer != nil && (defer->argp == (byte*)sparg || defer->argp == NoArgs))
+ while(defer != nil && (defer->argp == sparg || defer->argp == NoArgs))
defer = defer->link;
if(skip > 0) {
}
}
- frame.varp = (byte*)frame.fp - sizeof(uintreg);
+ frame.varp = frame.fp - sizeof(uintreg);
// Derive size of arguments.
// Most functions have a fixed-size argument block,
// in package runtime and reflect, and for those we use call-specific
// metadata recorded by f's caller.
if(callback != nil || printing) {
- frame.argp = (byte*)frame.fp;
+ frame.argp = frame.fp;
if(f->args != ArgsSizeUnknown)
frame.arglen = f->args;
else if(flr == nil)
// returns; everything live at earlier deferprocs is still live at that one.
frame.continpc = frame.pc;
if(waspanic) {
- if(panic != nil && panic->defer->argp == (byte*)sparg)
- frame.continpc = (uintptr)panic->defer->pc;
- else if(defer != nil && defer->argp == (byte*)sparg)
- frame.continpc = (uintptr)defer->pc;
+ if(panic != nil && panic->defer->argp == sparg)
+ frame.continpc = panic->defer->pc;
+ else if(defer != nil && defer->argp == sparg)
+ frame.continpc = defer->pc;
else
frame.continpc = 0;
}
// Unwind our local panic & defer stacks past this frame.
- while(panic != nil && (panic->defer == nil || panic->defer->argp == (byte*)sparg || panic->defer->argp == NoArgs))
+ while(panic != nil && (panic->defer == nil || panic->defer->argp == sparg || panic->defer->argp == NoArgs))
panic = panic->link;
- while(defer != nil && (defer->argp == (byte*)sparg || defer->argp == NoArgs))
+ while(defer != nil && (defer->argp == sparg || defer->argp == NoArgs))
defer = defer->link;
if(skip > 0) {