diff mbox

libgo patch committed: Save all registers on stack for GC scan

Message ID mcrpqdmn0s8.fsf@dhcp-172-18-216-180.mtv.corp.google.com
State New
Headers show

Commit Message

Ian Lance Taylor Feb. 10, 2012, 3:52 p.m. UTC
This patch to the libgo garbage collector ensures that we save all the
registers on the stack when starting a GC.  Otherwise we could sometimes
miss a value held in a register while scanning the stack of the
goroutine running the GC.  This never happened on x86, but it did happen
on SPARC.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian
diff mbox

Patch

diff -r 1f6696441eeb libgo/runtime/mgc0.c
--- a/libgo/runtime/mgc0.c	Fri Feb 10 06:07:07 2012 -0800
+++ b/libgo/runtime/mgc0.c	Fri Feb 10 07:50:20 2012 -0800
@@ -936,6 +936,10 @@ 
 	const byte *p;
 	bool extra;
 
+	// Make sure all registers are saved on stack so that
+	// scanstack sees them.
+	__builtin_unwind_init();
+
 	// The gc is turned off (via enablegc) until
 	// the bootstrap has completed.
 	// Also, malloc gets called in the guts