aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/stack.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-09-12 07:29:19 -0400
committerRuss Cox <rsc@golang.org>2014-09-12 07:29:19 -0400
commitf0d44dbeaf28d157f8eba85ec9f9bffdc84ce3e0 (patch)
tree60896b9b1303b7ad3eb305568cb63d5e26cac032 /src/runtime/stack.c
parent70f928698b8416efa544029cfa0f0f7178cdd51b (diff)
downloadgo-f0d44dbeaf28d157f8eba85ec9f9bffdc84ce3e0.tar.xz
runtime: look up arg stackmap for makeFuncStub/methodValueStub during traceback
makeFuncStub and methodValueStub are used by reflect as generic function implementations. Each call might have different arguments. Extract those arguments from the closure data instead of assuming it is the same each time. Because the argument map is now being extracted from the function itself, we don't need the special cases in reflect.Call anymore, so delete those. Fixes an occasional crash seen when stack copying does not update makeFuncStub's arguments correctly. Will also help make it safe to require stack maps in the garbage collector. Derived from CL 142000044 by khr. LGTM=khr R=khr CC=golang-codereviews https://golang.org/cl/143890044
Diffstat (limited to 'src/runtime/stack.c')
-rw-r--r--src/runtime/stack.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/runtime/stack.c b/src/runtime/stack.c
index cc2857ac81..53ad90a5de 100644
--- a/src/runtime/stack.c
+++ b/src/runtime/stack.c
@@ -481,12 +481,16 @@ adjustframe(Stkframe *frame, void *arg)
}
// adjust inargs and outargs
if(frame->arglen != 0) {
- stackmap = runtime·funcdata(f, FUNCDATA_ArgsPointerMaps);
- if(stackmap == nil) {
- runtime·printf("size %d\n", (int32)frame->arglen);
- runtime·throw("no arg info");
+ if(frame->argmap != nil) {
+ bv = *frame->argmap;
+ } else {
+ stackmap = runtime·funcdata(f, FUNCDATA_ArgsPointerMaps);
+ if(stackmap == nil) {
+ runtime·printf("size %d\n", (int32)frame->arglen);
+ runtime·throw("no arg info");
+ }
+ bv = runtime·stackmapdata(stackmap, pcdata);
}
- bv = runtime·stackmapdata(stackmap, pcdata);
if(StackDebug >= 3)
runtime·printf(" args\n");
adjustpointers((byte**)frame->argp, &bv, adjinfo, nil);