diff --git a/src/pkg/runtime/gc_test.go b/src/pkg/runtime/gc_test.go index 073d9fa7584..383af5be3dd 100644 --- a/src/pkg/runtime/gc_test.go +++ b/src/pkg/runtime/gc_test.go @@ -164,6 +164,10 @@ func TestGcLastTime(t *testing.T) { if t0 > last || last > t1 { t.Fatalf("bad last GC time: got %v, want [%v, %v]", last, t0, t1) } + pause := ms.PauseNs[(ms.NumGC+255)%256] + if pause == 0 || pause > 10e9 { + t.Fatalf("bad last GC pause: got %v, want [0, 10e9]", pause) + } } var hugeSink interface{} diff --git a/src/pkg/runtime/malloc.go b/src/pkg/runtime/malloc.go index ce7e0621092..84c69abde70 100644 --- a/src/pkg/runtime/malloc.go +++ b/src/pkg/runtime/malloc.go @@ -477,11 +477,12 @@ func gogc(force int32) { startTime = gonanotime() } // switch to g0, call gc, then switch back - mp.scalararg[0] = uint(startTime) + mp.scalararg[0] = uint(uint32(startTime)) // low 32 bits + mp.scalararg[1] = uint(startTime >> 32) // high 32 bits if force >= 2 { - mp.scalararg[1] = 1 // eagersweep + mp.scalararg[2] = 1 // eagersweep } else { - mp.scalararg[1] = 0 + mp.scalararg[2] = 0 } onM(&gc_m) } diff --git a/src/pkg/runtime/mgc0.c b/src/pkg/runtime/mgc0.c index 3583d77d195..60a6181fc94 100644 --- a/src/pkg/runtime/mgc0.c +++ b/src/pkg/runtime/mgc0.c @@ -1401,8 +1401,8 @@ runtime·gc_m(void) gp->status = Gwaiting; gp->waitreason = "garbage collection"; - a.start_time = g->m->scalararg[0]; - a.eagersweep = g->m->scalararg[1]; + a.start_time = (uint64)(g->m->scalararg[0]) | ((uint64)(g->m->scalararg[1]) << 32); + a.eagersweep = g->m->scalararg[2]; gc(&a); gp->status = Grunning;