var bloc uintptr
var memlock mutex
-const memRound = _PAGESIZE - 1
+func memRound(p uintptr) uintptr {
+ return (p + _PAGESIZE - 1) &^ (_PAGESIZE - 1)
+}
func initBloc() {
- bloc = uintptr(unsafe.Pointer(&end))
+ bloc = memRound(uintptr(unsafe.Pointer(&end)))
}
func sbrk(n uintptr) unsafe.Pointer {
lock(&memlock)
// Plan 9 sbrk from /sys/src/libc/9sys/sbrk.c
- bl := (bloc + memRound) &^ memRound
+ bl := bloc
+ n = memRound(n)
if brk_(unsafe.Pointer(bl+n)) < 0 {
unlock(&memlock)
return nil
}
- bloc = bl + n
+ bloc += n
unlock(&memlock)
return unsafe.Pointer(bl)
}
// from tiny/mem.c
// Push pointer back if this is a free
// of the most recent sysAlloc.
- n += (n + memRound) &^ memRound
+ n = memRound(n)
if bloc == uintptr(v)+n {
bloc -= n
}
switch runtime.GOOS {
case "solaris":
t.Skip("skipping: solaris timer can go backwards (http://golang.org/issue/8976)")
- case "plan9":
- t.Skip("skipping: plan9 tests fail with out of memory (http://golang.org/issue/9712")
}
switch runtime.GOARCH {
for _, f := range ev.stk {
if strings.HasSuffix(f.file, "trace_test.go") &&
strings.HasSuffix(f.fn, "pprof_test.TestTraceSymbolize") &&
- f.line == 218 {
+ f.line == 216 {
found = true
break eventLoop
}