diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-06-22 14:44:30 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-06-22 14:44:30 +0000 |
commit | 3b0ddadf74ec9c7aa404765ec50bb55d255dbec7 (patch) | |
tree | 0c76bd6000837d9b83d3a57a300d41d87eaf3fb1 /libgo/go | |
parent | a055692a25c10bcd8fd90825cc39709f455335b2 (diff) | |
download | gcc-3b0ddadf74ec9c7aa404765ec50bb55d255dbec7.zip gcc-3b0ddadf74ec9c7aa404765ec50bb55d255dbec7.tar.gz gcc-3b0ddadf74ec9c7aa404765ec50bb55d255dbec7.tar.bz2 |
runtime: change some stack fields to uintptr
Because of how gccgo implements cgo calls, the code in dropm may not
have any write barriers. As a step toward implementing that, change
the gcstack, gcnextsegment, and gcnextsp fields of the g struct to
uintptr, so that assignments to them do not require write barriers.
The gcinitialsp field remains unsafe.Pointer, as on 32-bit systems
that do not support split stack it points to a heap allocated space
used for the goroutine stack.
The test for this is runtime tests like TestCgoCallbackGC, which are
not run today but will be run with a future gotools patch.
Reviewed-on: https://go-review.googlesource.com/46396
From-SVN: r249561
Diffstat (limited to 'libgo/go')
-rw-r--r-- | libgo/go/runtime/proc.go | 8 | ||||
-rw-r--r-- | libgo/go/runtime/runtime2.go | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/libgo/go/runtime/proc.go b/libgo/go/runtime/proc.go index 32bc148..066d0e5 100644 --- a/libgo/go/runtime/proc.go +++ b/libgo/go/runtime/proc.go @@ -1460,8 +1460,8 @@ func dropm() { // gccgo sets the stack to Gdead here, because the splitstack // context is not initialized. atomic.Store(&mp.curg.atomicstatus, _Gdead) - mp.curg.gcstack = nil - mp.curg.gcnextsp = nil + mp.curg.gcstack = 0 + mp.curg.gcnextsp = 0 mnext := lockextra(true) mp.schedlink.set(mnext) @@ -2591,8 +2591,8 @@ func exitsyscallclear(gp *g) { // clear syscallsp. gp.syscallsp = 0 - gp.gcstack = nil - gp.gcnextsp = nil + gp.gcstack = 0 + gp.gcnextsp = 0 memclrNoHeapPointers(unsafe.Pointer(&gp.gcregs), unsafe.Sizeof(gp.gcregs)) } diff --git a/libgo/go/runtime/runtime2.go b/libgo/go/runtime/runtime2.go index f532a3b..96a4edb 100644 --- a/libgo/go/runtime/runtime2.go +++ b/libgo/go/runtime/runtime2.go @@ -402,10 +402,10 @@ type g struct { isforeign bool // whether current exception is not from Go // Fields that hold stack and context information if status is Gsyscall - gcstack unsafe.Pointer + gcstack uintptr gcstacksize uintptr - gcnextsegment unsafe.Pointer - gcnextsp unsafe.Pointer + gcnextsegment uintptr + gcnextsp uintptr gcinitialsp unsafe.Pointer gcregs g_ucontext_t |