summaryrefslogtreecommitdiff
path: root/libgo/runtime/proc.c
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-06 17:57:23 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-06 17:57:23 +0000
commit220a902afa4e096172926d498e1efac23e80deb7 (patch)
tree4ce83ca433796a728e9fdd00af105bce158532b5 /libgo/runtime/proc.c
parent506056fd6ecd06499e2ee7f6e37dbd5fbf7f4de6 (diff)
downloadgcc-220a902afa4e096172926d498e1efac23e80deb7.tar.gz
libgo: Update to weekly.2012-03-04 release.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185010 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/runtime/proc.c')
-rw-r--r--libgo/runtime/proc.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c
index d0ae09c45a0..31e8287e704 100644
--- a/libgo/runtime/proc.c
+++ b/libgo/runtime/proc.c
@@ -416,8 +416,6 @@ runtime_schedinit(void)
// Can not enable GC until all roots are registered.
// mstats.enablegc = 1;
m->nomemprof--;
-
- scvg = __go_go(runtime_MHeap_Scavenger, nil);
}
extern void main_init(void) __asm__ ("__go_init_main");
@@ -435,6 +433,7 @@ runtime_main(void)
// to preserve the lock.
runtime_LockOSThread();
runtime_sched.init = true;
+ scvg = __go_go(runtime_MHeap_Scavenger, nil);
main_init();
runtime_sched.init = false;
if(!runtime_sched.lockmain)
@@ -548,7 +547,7 @@ mcommoninit(M *m)
m->mcache = runtime_allocmcache();
runtime_callers(1, m->createstack, nelem(m->createstack));
-
+
// Add to runtime_allm so garbage collector doesn't free m
// when it is just in a register or thread-local storage.
m->alllink = runtime_allm;
@@ -791,10 +790,11 @@ top:
mput(m);
}
- // Look for deadlock situation: one single active g which happens to be scvg.
- if(runtime_sched.grunning == 1 && runtime_sched.gwait == 0) {
- if(scvg->status == Grunning || scvg->status == Gsyscall)
- runtime_throw("all goroutines are asleep - deadlock!");
+ // Look for deadlock situation.
+ if((scvg == nil && runtime_sched.grunning == 0) ||
+ (scvg != nil && runtime_sched.grunning == 1 && runtime_sched.gwait == 0 &&
+ (scvg->status == Grunning || scvg->status == Gsyscall))) {
+ runtime_throw("all goroutines are asleep - deadlock!");
}
m->nextg = nil;
@@ -1135,6 +1135,9 @@ runtime_entersyscall(void)
{
uint32 v;
+ if(m->profilehz > 0)
+ runtime_setprof(false);
+
// Leave SP around for gc and traceback.
#ifdef USING_SPLIT_STACK
g->gcstack = __splitstack_find(NULL, NULL, &g->gcstack_size,
@@ -1205,6 +1208,9 @@ runtime_exitsyscall(void)
#endif
gp->gcnext_sp = nil;
runtime_memclr(gp->gcregs, sizeof gp->gcregs);
+
+ if(m->profilehz > 0)
+ runtime_setprof(true);
return;
}