diff options
Diffstat (limited to 'libgo/go/runtime/runtime1.go')
-rw-r--r-- | libgo/go/runtime/runtime1.go | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/libgo/go/runtime/runtime1.go b/libgo/go/runtime/runtime1.go index 99c0f11..dd3f7b2 100644 --- a/libgo/go/runtime/runtime1.go +++ b/libgo/go/runtime/runtime1.go @@ -112,10 +112,10 @@ var test_z64, test_x64 uint64 func testAtomic64() { test_z64 = 42 test_x64 = 0 - // prefetcht0(uintptr(unsafe.Pointer(&test_z64))) - // prefetcht1(uintptr(unsafe.Pointer(&test_z64))) - // prefetcht2(uintptr(unsafe.Pointer(&test_z64))) - // prefetchnta(uintptr(unsafe.Pointer(&test_z64))) + prefetcht0(uintptr(unsafe.Pointer(&test_z64))) + prefetcht1(uintptr(unsafe.Pointer(&test_z64))) + prefetcht2(uintptr(unsafe.Pointer(&test_z64))) + prefetchnta(uintptr(unsafe.Pointer(&test_z64))) if atomic.Cas64(&test_z64, test_x64, 1) { throw("cas64 failed") } @@ -151,14 +151,6 @@ func testAtomic64() { } func check() { - - // This doesn't currently work for gccgo. Because escape - // analysis is not turned on by default, the code below that - // takes the address of local variables causes memory - // allocation, but this function is called before the memory - // allocator has been initialized. - return - var ( a int8 b uint8 @@ -390,7 +382,18 @@ var dbgvars = []dbgVar{ func parsedebugvars() { // defaults debug.cgocheck = 1 - debug.invalidptr = 1 + + // Unfortunately, because gccgo uses conservative stack scanning, + // we can not enable invalid pointer checking. It is possible for + // memory block M1 to point to M2, and for both to be dead. + // We release M2, causing the entire span to be released. + // Before we release M1, a stack pointer appears that point into it. + // This stack pointer is presumably dead, but causes M1 to be marked. + // We scan M1 and see the pointer to M2 on a released span. + // At that point, if debug.invalidptr is set, we crash. + // This is not a problem, assuming that M1 really is dead and + // the pointer we discovered to it will not be used. + // debug.invalidptr = 1 for p := gogetenv("GODEBUG"); p != ""; { field := "" |