From 48769bf546ba7ad830c2edc05656e217d15a20c8 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 19 Jul 2013 16:04:09 -0400 Subject: runtime: use funcdata to supply garbage collection information This CL introduces a FUNCDATA number for runtime-specific garbage collection metadata, changes the C and Go compilers to emit that metadata, and changes the runtime to expect it. The old pseudo-instructions that carried this information are gone, as is the linker code to process them. R=golang-dev, dvyukov, cshapiro CC=golang-dev https://golang.org/cl/11406044 --- src/pkg/runtime/traceback_arm.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) (limited to 'src/pkg/runtime/traceback_arm.c') diff --git a/src/pkg/runtime/traceback_arm.c b/src/pkg/runtime/traceback_arm.c index 5aea699e34..563ba28c94 100644 --- a/src/pkg/runtime/traceback_arm.c +++ b/src/pkg/runtime/traceback_arm.c @@ -95,7 +95,9 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip, runtime·throw("unknown caller pc"); } } - + + frame.varp = (byte*)frame.fp; + // Derive size of arguments. // Most functions have a fixed-size argument block, // so we can use metadata about the function f. @@ -121,27 +123,6 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip, } } - // Derive location and size of local variables. - if(frame.fp == frame.sp) { - // Function has not created a frame for itself yet. - frame.varp = nil; - frame.varlen = 0; - } else if(f->locals == 0) { - // Assume no information, so use whole frame. - // TODO: Distinguish local==0 from local==unknown. - frame.varp = (byte*)frame.sp; - frame.varlen = frame.fp - frame.sp; - } else { - if(f->locals > frame.fp - frame.sp) { - runtime·printf("runtime: inconsistent locals=%p frame=%p fp=%p sp=%p for %s\n", (uintptr)f->locals, (uintptr)f->frame, frame.fp, frame.sp, runtime·funcname(f)); - if(callback != nil) - runtime·throw("invalid stack"); - } - frame.varp = (byte*)frame.fp - f->locals; - frame.varlen = f->locals; - } - - if(skip > 0) { skip--; goto skipped; @@ -203,7 +184,7 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip, frame.fn = f = runtime·findfunc(frame.pc); if(f == nil) frame.pc = x; - else if (f->frame == 0) + else if(f->frame == 0) frame.lr = x; } } -- cgit v1.3-5-g9baa