@@ -1614,12 +1614,7 @@ addroots(void)
1614
1614
case Gdead :
1615
1615
break ;
1616
1616
case Grunning :
1617
- if (gp != m -> curg )
1618
- runtime·throw ("mark - world not stopped" );
1619
- if (g != m -> g0 )
1620
- runtime·throw ("gc not on g0" );
1621
- addstackroots (gp );
1622
- break ;
1617
+ runtime·throw ("mark - world not stopped" );
1623
1618
case Grunnable :
1624
1619
case Gsyscall :
1625
1620
case Gwaiting :
@@ -2046,7 +2041,7 @@ runtime·gc(int32 force)
2046
2041
// problems, don't bother trying to run gc
2047
2042
// while holding a lock. The next mallocgc
2048
2043
// without a lock will do the gc instead.
2049
- if (!mstats .enablegc || m -> locks > 0 || runtime·panicking )
2044
+ if (!mstats .enablegc || g == m -> g0 || m -> locks > 0 || runtime·panicking )
2050
2045
return ;
2051
2046
2052
2047
if (gcpercent == GcpercentUnknown ) { // first time through
@@ -2077,16 +2072,11 @@ runtime·gc(int32 force)
2077
2072
// we don't need to scan gc's internal state). Also an
2078
2073
// enabler for copyable stacks.
2079
2074
for (i = 0 ; i < (runtime·debug .gctrace > 1 ? 2 : 1 ); i ++ ) {
2080
- if (g == m -> g0 ) {
2081
- // already on g0
2082
- gc (& a );
2083
- } else {
2084
- // switch to g0, call gc(&a), then switch back
2085
- g -> param = & a ;
2086
- g -> status = Gwaiting ;
2087
- g -> waitreason = "garbage collection" ;
2088
- runtime·mcall (mgc );
2089
- }
2075
+ // switch to g0, call gc(&a), then switch back
2076
+ g -> param = & a ;
2077
+ g -> status = Gwaiting ;
2078
+ g -> waitreason = "garbage collection" ;
2079
+ runtime·mcall (mgc );
2090
2080
// record a new start time in case we're going around again
2091
2081
a .start_time = runtime·nanotime ();
2092
2082
}
@@ -2110,11 +2100,8 @@ runtime·gc(int32 force)
2110
2100
}
2111
2101
runtime·unlock (& finlock );
2112
2102
}
2113
- if (g -> preempt ) // restore the preemption request in case we've cleared it in newstack
2114
- g -> stackguard0 = StackPreempt ;
2115
2103
// give the queued finalizers, if any, a chance to run
2116
- if (g != m -> g0 )
2117
- runtime·gosched ();
2104
+ runtime·gosched ();
2118
2105
}
2119
2106
2120
2107
static void
0 commit comments