Commit 266d350f authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

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
parent 5d407427
...@@ -164,6 +164,10 @@ func TestGcLastTime(t *testing.T) { ...@@ -164,6 +164,10 @@ func TestGcLastTime(t *testing.T) {
if t0 > last || last > t1 { if t0 > last || last > t1 {
t.Fatalf("bad last GC time: got %v, want [%v, %v]", last, t0, 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{} var hugeSink interface{}
......
...@@ -477,11 +477,12 @@ func gogc(force int32) { ...@@ -477,11 +477,12 @@ func gogc(force int32) {
startTime = gonanotime() startTime = gonanotime()
} }
// switch to g0, call gc, then switch back // 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 { if force >= 2 {
mp.scalararg[1] = 1 // eagersweep mp.scalararg[2] = 1 // eagersweep
} else { } else {
mp.scalararg[1] = 0 mp.scalararg[2] = 0
} }
onM(&gc_m) onM(&gc_m)
} }
......
...@@ -1401,8 +1401,8 @@ runtime·gc_m(void) ...@@ -1401,8 +1401,8 @@ runtime·gc_m(void)
gp->status = Gwaiting; gp->status = Gwaiting;
gp->waitreason = "garbage collection"; gp->waitreason = "garbage collection";
a.start_time = g->m->scalararg[0]; a.start_time = (uint64)(g->m->scalararg[0]) | ((uint64)(g->m->scalararg[1]) << 32);
a.eagersweep = g->m->scalararg[1]; a.eagersweep = g->m->scalararg[2];
gc(&a); gc(&a);
gp->status = Grunning; gp->status = Grunning;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment