Skip to content

Commit 87272bd

Browse files
aclementsgopherbot
authored andcommitted
runtime: tidy _Stack* constant naming
For #59670. Change-Id: I0efa743edc08e48dc8d906803ba45e9f641369db Reviewed-on: https://go-review.googlesource.com/c/go/+/486977 Reviewed-by: Cherry Mui <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Austin Clements <[email protected]> Run-TryBot: Austin Clements <[email protected]>
1 parent 0f099a4 commit 87272bd

21 files changed

+62
-62
lines changed

src/runtime/asm_386.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ nocpuinfo:
186186
// update stackguard after _cgo_init
187187
MOVL $runtime·g0(SB), CX
188188
MOVL (g_stack+stack_lo)(CX), AX
189-
ADDL $const__StackGuard, AX
189+
ADDL $const_stackGuard, AX
190190
MOVL AX, g_stackguard0(CX)
191191
MOVL AX, g_stackguard1(CX)
192192

src/runtime/asm_amd64.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ nocpuinfo:
222222
// update stackguard after _cgo_init
223223
MOVQ $runtime·g0(SB), CX
224224
MOVQ (g_stack+stack_lo)(CX), AX
225-
ADDQ $const__StackGuard, AX
225+
ADDQ $const_stackGuard, AX
226226
MOVQ AX, g_stackguard0(CX)
227227
MOVQ AX, g_stackguard1(CX)
228228

src/runtime/asm_arm.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ TEXT runtime·rt0_go(SB),NOSPLIT|NOFRAME|TOPFRAME,$0
151151

152152
// update stackguard after _cgo_init
153153
MOVW (g_stack+stack_lo)(g), R0
154-
ADD $const__StackGuard, R0
154+
ADD $const_stackGuard, R0
155155
MOVW R0, g_stackguard0(g)
156156
MOVW R0, g_stackguard1(g)
157157

src/runtime/asm_arm64.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ nocgo:
5959
BL runtime·save_g(SB)
6060
// update stackguard after _cgo_init
6161
MOVD (g_stack+stack_lo)(g), R0
62-
ADD $const__StackGuard, R0
62+
ADD $const_stackGuard, R0
6363
MOVD R0, g_stackguard0(g)
6464
MOVD R0, g_stackguard1(g)
6565

src/runtime/asm_loong64.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0
3939
nocgo:
4040
// update stackguard after _cgo_init
4141
MOVV (g_stack+stack_lo)(g), R19
42-
ADDV $const__StackGuard, R19
42+
ADDV $const_stackGuard, R19
4343
MOVV R19, g_stackguard0(g)
4444
MOVV R19, g_stackguard1(g)
4545

src/runtime/asm_mips64x.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0
4141
nocgo:
4242
// update stackguard after _cgo_init
4343
MOVV (g_stack+stack_lo)(g), R1
44-
ADDV $const__StackGuard, R1
44+
ADDV $const_stackGuard, R1
4545
MOVV R1, g_stackguard0(g)
4646
MOVV R1, g_stackguard1(g)
4747

src/runtime/asm_mipsx.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0
4242
nocgo:
4343
// update stackguard after _cgo_init
4444
MOVW (g_stack+stack_lo)(g), R1
45-
ADD $const__StackGuard, R1
45+
ADD $const_stackGuard, R1
4646
MOVW R1, g_stackguard0(g)
4747
MOVW R1, g_stackguard1(g)
4848

src/runtime/asm_ppc64x.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0
6767
nocgo:
6868
// update stackguard after _cgo_init
6969
MOVD (g_stack+stack_lo)(g), R3
70-
ADD $const__StackGuard, R3
70+
ADD $const_stackGuard, R3
7171
MOVD R3, g_stackguard0(g)
7272
MOVD R3, g_stackguard1(g)
7373

src/runtime/asm_riscv64.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0
3636
nocgo:
3737
// update stackguard after _cgo_init
3838
MOV (g_stack+stack_lo)(g), T0
39-
ADD $const__StackGuard, T0
39+
ADD $const_stackGuard, T0
4040
MOV T0, g_stackguard0(g)
4141
MOV T0, g_stackguard1(g)
4242

src/runtime/asm_s390x.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0
126126
nocgo:
127127
// update stackguard after _cgo_init
128128
MOVD (g_stack+stack_lo)(g), R2
129-
ADD $const__StackGuard, R2
129+
ADD $const_stackGuard, R2
130130
MOVD R2, g_stackguard0(g)
131131
MOVD R2, g_stackguard1(g)
132132

src/runtime/os_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ func minit() {
993993
throw("bad g0 stack")
994994
}
995995
g0.stack.lo = base
996-
g0.stackguard0 = g0.stack.lo + _StackGuard
996+
g0.stackguard0 = g0.stack.lo + stackGuard
997997
g0.stackguard1 = g0.stackguard0
998998
// Sanity check the SP.
999999
stackcheck()

src/runtime/preempt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ func suspendG(gp *g) suspendGState {
172172
// _Gscan bit and thus own the stack.
173173
gp.preemptStop = false
174174
gp.preempt = false
175-
gp.stackguard0 = gp.stack.lo + _StackGuard
175+
gp.stackguard0 = gp.stack.lo + stackGuard
176176

177177
// The goroutine was already at a safe-point
178178
// and we've now locked that in.

src/runtime/proc.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ func mcommoninit(mp *m, id int64) {
832832

833833
mpreinit(mp)
834834
if mp.gsignal != nil {
835-
mp.gsignal.stackguard1 = mp.gsignal.stack.lo + _StackGuard
835+
mp.gsignal.stackguard1 = mp.gsignal.stack.lo + stackGuard
836836
}
837837

838838
// Add to allm so garbage collector doesn't free g->m
@@ -1446,7 +1446,7 @@ func mstart0() {
14461446
}
14471447
// Initialize stack guard so that we can start calling regular
14481448
// Go code.
1449-
gp.stackguard0 = gp.stack.lo + _StackGuard
1449+
gp.stackguard0 = gp.stack.lo + stackGuard
14501450
// This is the g0, so we can also call go:systemstack
14511451
// functions, which check stackguard1.
14521452
gp.stackguard1 = gp.stackguard0
@@ -1940,7 +1940,7 @@ func needm() {
19401940
gp := getg()
19411941
gp.stack.hi = getcallersp() + 1024
19421942
gp.stack.lo = getcallersp() - 32*1024
1943-
gp.stackguard0 = gp.stack.lo + _StackGuard
1943+
gp.stackguard0 = gp.stack.lo + stackGuard
19441944

19451945
// Initialize this thread to use the m.
19461946
asminit()
@@ -2640,7 +2640,7 @@ func execute(gp *g, inheritTime bool) {
26402640
casgstatus(gp, _Grunnable, _Grunning)
26412641
gp.waitsince = 0
26422642
gp.preempt = false
2643-
gp.stackguard0 = gp.stack.lo + _StackGuard
2643+
gp.stackguard0 = gp.stack.lo + stackGuard
26442644
if !inheritTime {
26452645
mp.p.ptr().schedtick++
26462646
}
@@ -3955,8 +3955,8 @@ func exitsyscall() {
39553955
// restore the preemption request in case we've cleared it in newstack
39563956
gp.stackguard0 = stackPreempt
39573957
} else {
3958-
// otherwise restore the real _StackGuard, we've spoiled it in entersyscall/entersyscallblock
3959-
gp.stackguard0 = gp.stack.lo + _StackGuard
3958+
// otherwise restore the real stackGuard, we've spoiled it in entersyscall/entersyscallblock
3959+
gp.stackguard0 = gp.stack.lo + stackGuard
39603960
}
39613961
gp.throwsplit = false
39623962

@@ -4137,7 +4137,7 @@ func syscall_runtime_BeforeFork() {
41374137

41384138
// This function is called before fork in syscall package.
41394139
// Code between fork and exec must not allocate memory nor even try to grow stack.
4140-
// Here we spoil g->_StackGuard to reliably detect any attempts to grow stack.
4140+
// Here we spoil g.stackguard0 to reliably detect any attempts to grow stack.
41414141
// runtime_AfterFork will undo this in parent process, but not in child.
41424142
gp.stackguard0 = stackFork
41434143
}
@@ -4150,7 +4150,7 @@ func syscall_runtime_AfterFork() {
41504150
gp := getg().m.curg
41514151

41524152
// See the comments in beforefork.
4153-
gp.stackguard0 = gp.stack.lo + _StackGuard
4153+
gp.stackguard0 = gp.stack.lo + stackGuard
41544154

41554155
msigrestore(gp.m.sigmask)
41564156

@@ -4220,11 +4220,11 @@ func syscall_runtime_AfterExec() {
42204220
func malg(stacksize int32) *g {
42214221
newg := new(g)
42224222
if stacksize >= 0 {
4223-
stacksize = round2(_StackSystem + stacksize)
4223+
stacksize = round2(stackSystem + stacksize)
42244224
systemstack(func() {
42254225
newg.stack = stackalloc(uint32(stacksize))
42264226
})
4227-
newg.stackguard0 = newg.stack.lo + _StackGuard
4227+
newg.stackguard0 = newg.stack.lo + stackGuard
42284228
newg.stackguard1 = ^uintptr(0)
42294229
// Clear the bottom word of the stack. We record g
42304230
// there on gsignal stack during VDSO on ARM and ARM64.
@@ -4263,7 +4263,7 @@ func newproc1(fn *funcval, callergp *g, callerpc uintptr) *g {
42634263
pp := mp.p.ptr()
42644264
newg := gfget(pp)
42654265
if newg == nil {
4266-
newg = malg(_StackMin)
4266+
newg = malg(stackMin)
42674267
casgstatus(newg, _Gidle, _Gdead)
42684268
allgadd(newg) // publishes with a g->status of Gdead so GC scanner doesn't look at uninitialized stack.
42694269
}
@@ -4467,7 +4467,7 @@ retry:
44674467
systemstack(func() {
44684468
gp.stack = stackalloc(startingStackSize)
44694469
})
4470-
gp.stackguard0 = gp.stack.lo + _StackGuard
4470+
gp.stackguard0 = gp.stack.lo + stackGuard
44714471
} else {
44724472
if raceenabled {
44734473
racemalloc(unsafe.Pointer(gp.stack.lo), gp.stack.hi-gp.stack.lo)

src/runtime/runtime1.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ func check() {
286286

287287
testAtomic64()
288288

289-
if _FixedStack != round2(_FixedStack) {
289+
if fixedStack != round2(fixedStack) {
290290
throw("FixedStack is not power-of-2")
291291
}
292292

src/runtime/signal_unix.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,8 +1307,8 @@ func setGsignalStack(st *stackt, old *gsignalStack) {
13071307
stsp := uintptr(unsafe.Pointer(st.ss_sp))
13081308
gp.m.gsignal.stack.lo = stsp
13091309
gp.m.gsignal.stack.hi = stsp + st.ss_size
1310-
gp.m.gsignal.stackguard0 = stsp + _StackGuard
1311-
gp.m.gsignal.stackguard1 = stsp + _StackGuard
1310+
gp.m.gsignal.stackguard0 = stsp + stackGuard
1311+
gp.m.gsignal.stackguard1 = stsp + stackGuard
13121312
}
13131313

13141314
// restoreGsignalStack restores the gsignal stack to the value it had

src/runtime/signal_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ func winthrow(info *exceptionrecord, r *context, gp *g) {
321321
// g0 stack bounds so we have room to print the traceback. If
322322
// this somehow overflows the stack, the OS will trap it.
323323
g0.stack.lo = 0
324-
g0.stackguard0 = g0.stack.lo + _StackGuard
324+
g0.stackguard0 = g0.stack.lo + stackGuard
325325
g0.stackguard1 = g0.stackguard0
326326

327327
print("Exception ", hex(info.exceptioncode), " ", hex(info.exceptioninformation[0]), " ", hex(info.exceptioninformation[1]), " ", hex(r.ip()), "\n")

0 commit comments

Comments
 (0)