mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: allocate at desired address when race detector is on
Currently, on all supported platforms, the race detector (LLVM TSAN) expects the Go heap is at 0xc000000000 - 0xe000000000. Move the raceenabled condition first, so we always allocate there. This means on Linux/ARM64 when race detector is on we will allocate to 0xc000000000 - 0xe000000000, instead of 0x4000000000. The old address is meant for 39-bit VMA. But the race detector only supports 48-bit VMA anyway. So this is fine. Change-Id: I51ac8eff68297b37c8c651a93145cc94f83a939d Reviewed-on: https://go-review.googlesource.com/c/go/+/266372 Trust: Cherry Zhang <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
e62adb1c0b
commit
f7e26467b4
1 changed files with 8 additions and 8 deletions
|
|
@ -521,6 +521,14 @@ func mallocinit() {
|
|||
for i := 0x7f; i >= 0; i-- {
|
||||
var p uintptr
|
||||
switch {
|
||||
case raceenabled:
|
||||
// The TSAN runtime requires the heap
|
||||
// to be in the range [0x00c000000000,
|
||||
// 0x00e000000000).
|
||||
p = uintptr(i)<<32 | uintptrMask&(0x00c0<<32)
|
||||
if p >= uintptrMask&0x00e000000000 {
|
||||
continue
|
||||
}
|
||||
case GOARCH == "arm64" && GOOS == "ios":
|
||||
p = uintptr(i)<<40 | uintptrMask&(0x0013<<28)
|
||||
case GOARCH == "arm64":
|
||||
|
|
@ -532,14 +540,6 @@ func mallocinit() {
|
|||
continue
|
||||
}
|
||||
p = uintptr(i)<<40 | uintptrMask&(0xa0<<52)
|
||||
case raceenabled:
|
||||
// The TSAN runtime requires the heap
|
||||
// to be in the range [0x00c000000000,
|
||||
// 0x00e000000000).
|
||||
p = uintptr(i)<<32 | uintptrMask&(0x00c0<<32)
|
||||
if p >= uintptrMask&0x00e000000000 {
|
||||
continue
|
||||
}
|
||||
default:
|
||||
p = uintptr(i)<<40 | uintptrMask&(0x00c0<<32)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue