diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-01-07 22:07:26 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-01-07 22:07:26 +0000 |
commit | 33a5d8ccb5482e446410ffbba30f0b560fc1c8fc (patch) | |
tree | 709c96bb2f7fb7e7419f59a1b0f0044acb36ce47 /libgo | |
parent | fdcef314bcb0728d883cd87d6950d85217e82755 (diff) | |
download | gcc-33a5d8ccb5482e446410ffbba30f0b560fc1c8fc.zip gcc-33a5d8ccb5482e446410ffbba30f0b560fc1c8fc.tar.gz gcc-33a5d8ccb5482e446410ffbba30f0b560fc1c8fc.tar.bz2 |
runtime: in doscanstackswitch, set gp->m before gogo
This is following CL 156038. doscanstackswitch uses the same
mechanism of switching goroutines as getTraceback, and so has
the same problem as described in issue golang/go#29448. This CL
applies the same fix.
Reviewed-on: https://go-review.googlesource.com/c/156697
From-SVN: r267661
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/runtime/proc.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c index 4004df4..1569b5b 100644 --- a/libgo/runtime/proc.c +++ b/libgo/runtime/proc.c @@ -482,9 +482,14 @@ void doscanstackswitch(G*, G*) __asm__(GOSYM_PREFIX "runtime.doscanstackswitch") void doscanstackswitch(G* me, G* gp) { + M* holdm; + __go_assert(me->entry == nil); me->fromgogo = false; + holdm = gp->m; + gp->m = me->m; + #ifdef USING_SPLIT_STACK __splitstack_getcontext((void*)(&me->stackcontext[0])); #endif @@ -507,6 +512,8 @@ doscanstackswitch(G* me, G* gp) if (gp->scang != 0) runtime_gogo(gp); + + gp->m = holdm; } // Do a stack scan, then switch back to the g that triggers this scan. @@ -515,21 +522,15 @@ static void gscanstack(G *gp) { G *oldg, *oldcurg; - M* holdm; oldg = (G*)gp->scang; oldcurg = oldg->m->curg; - holdm = gp->m; - if(holdm != nil && holdm != g->m) - runtime_throw("gscanstack: m is not nil"); oldg->m->curg = gp; - gp->m = oldg->m; gp->scang = 0; doscanstack(gp, (void*)gp->scangcw); gp->scangcw = 0; - gp->m = holdm; oldg->m->curg = oldcurg; runtime_gogo(oldg); } |