aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/runtime/malloc.go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2017-06-27 22:36:48 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2017-06-27 22:36:48 +0000
commit7fd19291a5393d200470b8bd79de3ce21c4e4bee (patch)
treec105247981108997e8faf34d6055638c1d52e2a1 /libgo/go/runtime/malloc.go
parentf9dedc3f21020bcc704fcfb7caa1b04b5dc874e7 (diff)
downloadgcc-7fd19291a5393d200470b8bd79de3ce21c4e4bee.zip
gcc-7fd19291a5393d200470b8bd79de3ce21c4e4bee.tar.gz
gcc-7fd19291a5393d200470b8bd79de3ce21c4e4bee.tar.bz2
runtime: adapt memory management to AIX mmap
On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes This is adapted from change 37845. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/46772 From-SVN: r249713
Diffstat (limited to 'libgo/go/runtime/malloc.go')
-rw-r--r--libgo/go/runtime/malloc.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/libgo/go/runtime/malloc.go b/libgo/go/runtime/malloc.go
index 05a69c9..3912fc2 100644
--- a/libgo/go/runtime/malloc.go
+++ b/libgo/go/runtime/malloc.go
@@ -291,6 +291,8 @@ func mallocinit() {
// allocation at 0x40 << 32 because when using 4k pages with 3-level
// translation buffers, the user address space is limited to 39 bits
// On darwin/arm64, the address space is even smaller.
+ // On AIX, mmap adresses range start at 0x07000000_00000000 for 64 bits
+ // processes.
arenaSize := round(_MaxMem, _PageSize)
bitmapSize = arenaSize / (sys.PtrSize * 8 / 2)
spansSize = arenaSize / _PageSize * sys.PtrSize
@@ -301,12 +303,15 @@ func mallocinit() {
p = uintptr(i)<<40 | uintptrMask&(0x0013<<28)
case GOARCH == "arm64":
p = uintptr(i)<<40 | uintptrMask&(0x0040<<32)
+ case GOOS == "aix":
+ i = 1
+ p = uintptr(i)<<32 | uintptrMask&(0x70<<52)
default:
p = uintptr(i)<<40 | uintptrMask&(0x00c0<<32)
}
pSize = bitmapSize + spansSize + arenaSize + _PageSize
p = uintptr(sysReserve(unsafe.Pointer(p), pSize, &reserved))
- if p != 0 {
+ if p != 0 || GOOS == "aix" { // Useless to loop on AIX, as i is forced to 1
break
}
}