mirror of
https://github.com/golang/go
synced 2024-11-19 07:04:43 -07:00
runtime: fix MemStats on 32-bits
Int64's do not fit into uintptr's. LGTM=khr R=golang-codereviews, khr, rsc CC=golang-codereviews, rlh https://golang.org/cl/128380043
This commit is contained in:
parent
5d40742728
commit
266d350f5e
@ -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{}
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user