diff mbox

libgo patch committed: Align stack bottom pointer for GC

Message ID mcroaxwdill.fsf@iant-glaptop.roam.corp.google.com
State New
Headers show

Commit Message

Ian Lance Taylor June 13, 2014, 1:50 p.m. UTC
This patch to libgo: always sets gcnext_sp to a pointer-aligned address.

The gcnext_sp field is only used on systems that do not use split
stacks.  It marks the bottom of the stack for the garbage collector.
This change makes sure that the stack bottom is always aligned to a
pointer value.

Previously the garbage collector would align all the addresses that it
scanned, but it now expects them to be aligned before scanning.

This should fix PR go/61498.

Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian
diff mbox

Patch

diff -r 07d3bcf45181 libgo/runtime/proc.c
--- a/libgo/runtime/proc.c	Mon Jun 09 17:35:15 2014 -0700
+++ b/libgo/runtime/proc.c	Fri Jun 13 06:45:38 2014 -0700
@@ -255,9 +255,6 @@ 
 {
 	M *mp;
 	G *gp;
-#ifndef USING_SPLIT_STACK
-	int i;
-#endif
 
 	// Ensure that all registers are on the stack for the garbage
 	// collector.
@@ -273,7 +270,7 @@ 
 #ifdef USING_SPLIT_STACK
 		__splitstack_getcontext(&g->stack_context[0]);
 #else
-		gp->gcnext_sp = &i;
+		gp->gcnext_sp = &pfn;
 #endif
 		gp->fromgogo = false;
 		getcontext(&gp->context);
@@ -1933,7 +1930,7 @@ 
 				       &g->gcinitial_sp);
 #else
 	{
-		uint32 v;
+		void *v;
 
 		g->gcnext_sp = (byte *) &v;
 	}