diff options
author | Dmitriy Vyukov <dvyukov@google.com> | 2014-06-19 22:04:10 -0700 |
---|---|---|
committer | Dmitriy Vyukov <dvyukov@google.com> | 2014-06-19 22:04:10 -0700 |
commit | 30835a57672c04f70753a76866499e850f39b6ad (patch) | |
tree | 289c1b37817193ef8d524f0f888058ad1f12111d /src | |
parent | b8aa065e000e7e1b6e305b00393ee7de218f4df6 (diff) | |
download | go-30835a57672c04f70753a76866499e850f39b6ad.tar.gz |
runtime: remove obsolete afterprologue check
Afterprologue check was required when did not know
about return arguments of functions and/or they were not zeroed.
Now 100% precision is required for stacks due to stack copying,
so it must work w/o afterprologue one way or another.
I can limit this change for 1.3 to merely adding a TODO,
but this check is super confusing so I don't want this knowledge to get lost.
LGTM=rsc
R=golang-codereviews, gobot, rsc, khr
CC=golang-codereviews, khr, rsc
https://codereview.appspot.com/96580045
Diffstat (limited to 'src')
-rw-r--r-- | src/pkg/runtime/mgc0.c | 64 |
1 files changed, 30 insertions, 34 deletions
diff --git a/src/pkg/runtime/mgc0.c b/src/pkg/runtime/mgc0.c index 392da535b..50d9feabd 100644 --- a/src/pkg/runtime/mgc0.c +++ b/src/pkg/runtime/mgc0.c @@ -1434,12 +1434,12 @@ runtime·stackmapdata(StackMap *stackmap, int32 n) // Scans an interface data value when the interface type indicates // that it is a pointer. static void -scaninterfacedata(uintptr bits, byte *scanp, bool afterprologue, void *wbufp) +scaninterfacedata(uintptr bits, byte *scanp, void *wbufp) { Itab *tab; Type *type; - if(runtime·precisestack && afterprologue) { + if(runtime·precisestack) { if(bits == BitsIface) { tab = *(Itab**)scanp; if(tab->type->size <= sizeof(void*) && (tab->type->kind & KindNoPointers)) @@ -1455,7 +1455,7 @@ scaninterfacedata(uintptr bits, byte *scanp, bool afterprologue, void *wbufp) // Starting from scanp, scans words corresponding to set bits. static void -scanbitvector(Func *f, bool precise, byte *scanp, BitVector *bv, bool afterprologue, void *wbufp) +scanbitvector(Func *f, bool precise, byte *scanp, BitVector *bv, void *wbufp) { uintptr word, bits; uint32 *wordp; @@ -1549,7 +1549,7 @@ scanbitvector(Func *f, bool precise, byte *scanp, BitVector *bv, bool afterprolo else runtime·printf("frame %s @%p: iface %p %p\n", runtime·funcname(f), p, ((uintptr*)p)[0], ((uintptr*)p)[1]); } - scaninterfacedata(word & 3, p, afterprologue, wbufp); + scaninterfacedata(word & 3, p, wbufp); } break; } @@ -1570,7 +1570,6 @@ scanframe(Stkframe *frame, void *wbufp) uintptr size; uintptr targetpc; int32 pcdata; - bool afterprologue; bool precise; f = frame->fn; @@ -1591,36 +1590,33 @@ scanframe(Stkframe *frame, void *wbufp) // Scan local variables if stack frame has been allocated. // Use pointer information if known. - afterprologue = (frame->varp > (byte*)frame->sp); precise = false; - if(afterprologue) { - stackmap = runtime·funcdata(f, FUNCDATA_LocalsPointerMaps); - if(stackmap == nil) { - // No locals information, scan everything. - size = frame->varp - (byte*)frame->sp; - if(Debug > 2) - runtime·printf("frame %s unsized locals %p+%p\n", runtime·funcname(f), frame->varp-size, size); - enqueue1(wbufp, (Obj){frame->varp - size, size, 0}); - } 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); - enqueue1(wbufp, (Obj){frame->varp - size, size, 0}); - } else if(stackmap->n > 0) { - // Locals bitmap information, scan just the pointers in - // locals. - if(pcdata < 0 || pcdata >= stackmap->n) { - // don't know where we are - runtime·printf("pcdata is %d and %d stack map entries for %s (targetpc=%p)\n", - pcdata, stackmap->n, runtime·funcname(f), targetpc); - runtime·throw("scanframe: bad symbol table"); - } - bv = runtime·stackmapdata(stackmap, pcdata); - size = (bv.n * PtrSize) / BitsPerPointer; - precise = true; - scanbitvector(f, true, frame->varp - size, &bv, afterprologue, wbufp); + stackmap = runtime·funcdata(f, FUNCDATA_LocalsPointerMaps); + if(stackmap == nil) { + // No locals information, scan everything. + size = frame->varp - (byte*)frame->sp; + if(Debug > 2) + runtime·printf("frame %s unsized locals %p+%p\n", runtime·funcname(f), frame->varp-size, size); + enqueue1(wbufp, (Obj){frame->varp - size, size, 0}); + } 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); + enqueue1(wbufp, (Obj){frame->varp - size, size, 0}); + } else if(stackmap->n > 0) { + // Locals bitmap information, scan just the pointers in + // locals. + if(pcdata < 0 || pcdata >= stackmap->n) { + // don't know where we are + runtime·printf("pcdata is %d and %d stack map entries for %s (targetpc=%p)\n", + pcdata, stackmap->n, runtime·funcname(f), targetpc); + runtime·throw("scanframe: bad symbol table"); } + bv = runtime·stackmapdata(stackmap, pcdata); + size = (bv.n * PtrSize) / BitsPerPointer; + precise = true; + scanbitvector(f, true, frame->varp - size, &bv, wbufp); } // Scan arguments. @@ -1628,7 +1624,7 @@ scanframe(Stkframe *frame, void *wbufp) stackmap = runtime·funcdata(f, FUNCDATA_ArgsPointerMaps); if(stackmap != nil) { bv = runtime·stackmapdata(stackmap, pcdata); - scanbitvector(f, precise, frame->argp, &bv, true, wbufp); + scanbitvector(f, precise, frame->argp, &bv, wbufp); } else { if(Debug > 2) runtime·printf("frame %s conservative args %p+%p\n", runtime·funcname(f), frame->argp, (uintptr)frame->arglen); |