aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/stack1.go
diff options
context:
space:
mode:
authorShenghou Ma <minux@golang.org>2014-12-29 01:08:40 -0500
committerKeith Randall <khr@golang.org>2014-12-29 07:36:07 +0000
commitab0535ae3fb45ba734d47542cc4845f27f708d1b (patch)
tree0357ccba7c596a90470785ebd189416d15b6d74e /src/runtime/stack1.go
parent3b76b017cabb0ea29a184670e081edfe11afb8de (diff)
downloadgo-ab0535ae3fb45ba734d47542cc4845f27f708d1b.tar.xz
liblink, cmd/ld, runtime: remove stackguard1
Now that we've removed all the C code in runtime and the C compilers, there is no need to have a separate stackguard field to check for C code on Go stack. Remove field g.stackguard1 and rename g.stackguard0 to g.stackguard. Adjust liblink and cmd/ld as necessary. Change-Id: I54e75db5a93d783e86af5ff1a6cd497d669d8d33 Reviewed-on: https://go-review.googlesource.com/2144 Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/stack1.go')
-rw-r--r--src/runtime/stack1.go21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/runtime/stack1.go b/src/runtime/stack1.go
index 198aa50a76..6e6569f55e 100644
--- a/src/runtime/stack1.go
+++ b/src/runtime/stack1.go
@@ -26,13 +26,13 @@ const (
poisonStack = uintptrMask & 0x6868686868686868
// Goroutine preemption request.
- // Stored into g->stackguard0 to cause split stack check failure.
+ // Stored into g->stackguard to cause split stack check failure.
// Must be greater than any real sp.
// 0xfffffade in hex.
stackPreempt = uintptrMask & -1314
// Thread is forking.
- // Stored into g->stackguard0 to cause split stack check failure.
+ // Stored into g->stackguard to cause split stack check failure.
// Must be greater than any real sp.
stackFork = uintptrMask & -1234
)
@@ -566,7 +566,7 @@ func copystack(gp *g, newsize uintptr) {
// Swap out old stack for new one
gp.stack = new
- gp.stackguard0 = new.lo + _StackGuard // NOTE: might clobber a preempt request
+ gp.stackguard = new.lo + _StackGuard // NOTE: might clobber a preempt request
gp.sched.sp = new.hi - used
// free old stack
@@ -611,7 +611,7 @@ func round2(x int32) int32 {
func newstack() {
thisg := getg()
// TODO: double check all gp. shouldn't be getg().
- if thisg.m.morebuf.g.stackguard0 == stackFork {
+ if thisg.m.morebuf.g.stackguard == stackFork {
throw("stack growth after fork")
}
if thisg.m.morebuf.g != thisg.m.curg {
@@ -674,7 +674,7 @@ func newstack() {
writebarrierptr_nostore((*uintptr)(unsafe.Pointer(&gp.sched.ctxt)), uintptr(gp.sched.ctxt))
}
- if gp.stackguard0 == stackPreempt {
+ if gp.stackguard == stackPreempt {
if gp == thisg.m.g0 {
throw("runtime: preempt g0")
}
@@ -689,7 +689,7 @@ func newstack() {
gcphasework(gp)
casfrom_Gscanstatus(gp, _Gscanwaiting, _Gwaiting)
casgstatus(gp, _Gwaiting, _Grunning)
- gp.stackguard0 = gp.stack.lo + _StackGuard
+ gp.stackguard = gp.stack.lo + _StackGuard
gp.preempt = false
gp.preemptscan = false // Tells the GC premption was successful.
gogo(&gp.sched) // never return
@@ -700,7 +700,7 @@ func newstack() {
if thisg.m.locks != 0 || thisg.m.mallocing != 0 || thisg.m.gcing != 0 || thisg.m.p.status != _Prunning {
// Let the goroutine keep running for now.
// gp->preempt is set, so it will be preempted next time.
- gp.stackguard0 = gp.stack.lo + _StackGuard
+ gp.stackguard = gp.stack.lo + _StackGuard
casgstatus(gp, _Gwaiting, _Grunning)
gogo(&gp.sched) // never return
}
@@ -804,10 +804,3 @@ func shrinkfinish() {
s = t
}
}
-
-//go:nosplit
-func morestackc() {
- systemstack(func() {
- throw("attempt to execute C code on Go stack")
- })
-}