diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-05-22 16:57:23 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-05-22 16:57:23 +0000 |
commit | ef1f343258a2fba8b7ce3af5534787ed38d0ee3e (patch) | |
tree | 4519e817522fc93f7bdd2860a46165fd4ab038c5 /libgo/runtime | |
parent | 3cd50158f525564510b05c2c494f477ed42c0a0a (diff) | |
download | gcc-ef1f343258a2fba8b7ce3af5534787ed38d0ee3e.zip gcc-ef1f343258a2fba8b7ce3af5534787ed38d0ee3e.tar.gz gcc-ef1f343258a2fba8b7ce3af5534787ed38d0ee3e.tar.bz2 |
runtime: Use getcontext, not setjmp, to save regs for GC.
From-SVN: r187777
Diffstat (limited to 'libgo/runtime')
-rw-r--r-- | libgo/runtime/proc.c | 8 | ||||
-rw-r--r-- | libgo/runtime/runtime.h | 3 |
2 files changed, 4 insertions, 7 deletions
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c index 890b492..ade8b9e 100644 --- a/libgo/runtime/proc.c +++ b/libgo/runtime/proc.c @@ -1239,9 +1239,7 @@ runtime_entersyscall(void) // Save the registers in the g structure so that any pointers // held in registers will be seen by the garbage collector. - // We could use getcontext here, but setjmp is more efficient - // because it doesn't need to save the signal mask. - setjmp(g->gcregs); + getcontext(&g->gcregs); g->status = Gsyscall; @@ -1299,7 +1297,7 @@ runtime_exitsyscall(void) gp->gcstack = nil; #endif gp->gcnext_sp = nil; - runtime_memclr(gp->gcregs, sizeof gp->gcregs); + runtime_memclr(&gp->gcregs, sizeof gp->gcregs); if(m->profilehz > 0) runtime_setprof(true); @@ -1328,7 +1326,7 @@ runtime_exitsyscall(void) gp->gcstack = nil; #endif gp->gcnext_sp = nil; - runtime_memclr(gp->gcregs, sizeof gp->gcregs); + runtime_memclr(&gp->gcregs, sizeof gp->gcregs); } // Allocate a new g, with a stack big enough for stacksize bytes. diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h index 9104418..67dabd2 100644 --- a/libgo/runtime/runtime.h +++ b/libgo/runtime/runtime.h @@ -7,7 +7,6 @@ #include "config.h" #include "go-assert.h" -#include <setjmp.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> @@ -128,7 +127,7 @@ struct G void* gcnext_segment; void* gcnext_sp; void* gcinitial_sp; - jmp_buf gcregs; + ucontext_t gcregs; byte* entry; // initial function G* alllink; // on allg void* param; // passed parameter on wakeup |