Commit cc817121 authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

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://golang.org/cl/96580045
parent 26282e40
...@@ -1434,12 +1434,12 @@ runtime·stackmapdata(StackMap *stackmap, int32 n) ...@@ -1434,12 +1434,12 @@ runtime·stackmapdata(StackMap *stackmap, int32 n)
// Scans an interface data value when the interface type indicates // Scans an interface data value when the interface type indicates
// that it is a pointer. // that it is a pointer.
static void static void
scaninterfacedata(uintptr bits, byte *scanp, bool afterprologue, void *wbufp) scaninterfacedata(uintptr bits, byte *scanp, void *wbufp)
{ {
Itab *tab; Itab *tab;
Type *type; Type *type;
if(runtime·precisestack && afterprologue) { if(runtime·precisestack) {
if(bits == BitsIface) { if(bits == BitsIface) {
tab = *(Itab**)scanp; tab = *(Itab**)scanp;
if(tab->type->size <= sizeof(void*) && (tab->type->kind & KindNoPointers)) if(tab->type->size <= sizeof(void*) && (tab->type->kind & KindNoPointers))
...@@ -1455,7 +1455,7 @@ scaninterfacedata(uintptr bits, byte *scanp, bool afterprologue, void *wbufp) ...@@ -1455,7 +1455,7 @@ scaninterfacedata(uintptr bits, byte *scanp, bool afterprologue, void *wbufp)
// Starting from scanp, scans words corresponding to set bits. // Starting from scanp, scans words corresponding to set bits.
static void 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; uintptr word, bits;
uint32 *wordp; uint32 *wordp;
...@@ -1549,7 +1549,7 @@ scanbitvector(Func *f, bool precise, byte *scanp, BitVector *bv, bool afterprolo ...@@ -1549,7 +1549,7 @@ scanbitvector(Func *f, bool precise, byte *scanp, BitVector *bv, bool afterprolo
else else
runtime·printf("frame %s @%p: iface %p %p\n", runtime·funcname(f), p, ((uintptr*)p)[0], ((uintptr*)p)[1]); 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; break;
} }
...@@ -1570,7 +1570,6 @@ scanframe(Stkframe *frame, void *wbufp) ...@@ -1570,7 +1570,6 @@ scanframe(Stkframe *frame, void *wbufp)
uintptr size; uintptr size;
uintptr targetpc; uintptr targetpc;
int32 pcdata; int32 pcdata;
bool afterprologue;
bool precise; bool precise;
f = frame->fn; f = frame->fn;
...@@ -1591,9 +1590,7 @@ scanframe(Stkframe *frame, void *wbufp) ...@@ -1591,9 +1590,7 @@ scanframe(Stkframe *frame, void *wbufp)
// Scan local variables if stack frame has been allocated. // Scan local variables if stack frame has been allocated.
// Use pointer information if known. // Use pointer information if known.
afterprologue = (frame->varp > (byte*)frame->sp);
precise = false; precise = false;
if(afterprologue) {
stackmap = runtime·funcdata(f, FUNCDATA_LocalsPointerMaps); stackmap = runtime·funcdata(f, FUNCDATA_LocalsPointerMaps);
if(stackmap == nil) { if(stackmap == nil) {
// No locals information, scan everything. // No locals information, scan everything.
...@@ -1619,8 +1616,7 @@ scanframe(Stkframe *frame, void *wbufp) ...@@ -1619,8 +1616,7 @@ scanframe(Stkframe *frame, void *wbufp)
bv = runtime·stackmapdata(stackmap, pcdata); bv = runtime·stackmapdata(stackmap, pcdata);
size = (bv.n * PtrSize) / BitsPerPointer; size = (bv.n * PtrSize) / BitsPerPointer;
precise = true; precise = true;
scanbitvector(f, true, frame->varp - size, &bv, afterprologue, wbufp); scanbitvector(f, true, frame->varp - size, &bv, wbufp);
}
} }
// Scan arguments. // Scan arguments.
...@@ -1628,7 +1624,7 @@ scanframe(Stkframe *frame, void *wbufp) ...@@ -1628,7 +1624,7 @@ scanframe(Stkframe *frame, void *wbufp)
stackmap = runtime·funcdata(f, FUNCDATA_ArgsPointerMaps); stackmap = runtime·funcdata(f, FUNCDATA_ArgsPointerMaps);
if(stackmap != nil) { if(stackmap != nil) {
bv = runtime·stackmapdata(stackmap, pcdata); bv = runtime·stackmapdata(stackmap, pcdata);
scanbitvector(f, precise, frame->argp, &bv, true, wbufp); scanbitvector(f, precise, frame->argp, &bv, wbufp);
} else { } else {
if(Debug > 2) if(Debug > 2)
runtime·printf("frame %s conservative args %p+%p\n", runtime·funcname(f), frame->argp, (uintptr)frame->arglen); runtime·printf("frame %s conservative args %p+%p\n", runtime·funcname(f), frame->argp, (uintptr)frame->arglen);
......
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