Skip to content

Commit e0a1ea4

Browse files
randall77gopherbot
authored andcommitted
cmd/compile: make panicBounds stack frame smaller on ppc64
We're running into nosplit limits when compiled with all=-N -l. Fixes #74910 Change-Id: I156263ae9b54ded240000001719512af86af70ee Reviewed-on: https://go-review.googlesource.com/c/go/+/693557 Reviewed-by: Paul Murphy <[email protected]> Auto-Submit: Keith Randall <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent 2747f92 commit e0a1ea4

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

src/cmd/compile/internal/ssa/_gen/PPC64Ops.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func init() {
171171
fpstore = regInfo{inputs: []regMask{gp | sp | sb, fp}}
172172
fpstoreidx = regInfo{inputs: []regMask{gp | sp | sb, gp | sp | sb, fp}}
173173
callerSave = regMask(gp | fp | gr | xer)
174-
first8 = buildReg("R3 R4 R5 R6 R7 R8 R9 R10")
174+
first7 = buildReg("R3 R4 R5 R6 R7 R8 R9")
175175
)
176176
ops := []opData{
177177
{name: "ADD", argLength: 2, reg: gp21, asm: "ADD", commutative: true}, // arg0 + arg1
@@ -709,9 +709,9 @@ func init() {
709709
// when both are constant (normally both 0, as prove derives the fact that a [0] bounds
710710
// failure means the length must have also been 0).
711711
// AuxInt contains a report code (see PanicBounds in genericOps.go).
712-
{name: "LoweredPanicBoundsRR", argLength: 3, aux: "Int64", reg: regInfo{inputs: []regMask{first8, first8}}, typ: "Mem", call: true}, // arg0=x, arg1=y, arg2=mem, returns memory.
713-
{name: "LoweredPanicBoundsRC", argLength: 2, aux: "PanicBoundsC", reg: regInfo{inputs: []regMask{first8}}, typ: "Mem", call: true}, // arg0=x, arg1=mem, returns memory.
714-
{name: "LoweredPanicBoundsCR", argLength: 2, aux: "PanicBoundsC", reg: regInfo{inputs: []regMask{first8}}, typ: "Mem", call: true}, // arg0=y, arg1=mem, returns memory.
712+
{name: "LoweredPanicBoundsRR", argLength: 3, aux: "Int64", reg: regInfo{inputs: []regMask{first7, first7}}, typ: "Mem", call: true}, // arg0=x, arg1=y, arg2=mem, returns memory.
713+
{name: "LoweredPanicBoundsRC", argLength: 2, aux: "PanicBoundsC", reg: regInfo{inputs: []regMask{first7}}, typ: "Mem", call: true}, // arg0=x, arg1=mem, returns memory.
714+
{name: "LoweredPanicBoundsCR", argLength: 2, aux: "PanicBoundsC", reg: regInfo{inputs: []regMask{first7}}, typ: "Mem", call: true}, // arg0=y, arg1=mem, returns memory.
715715
{name: "LoweredPanicBoundsCC", argLength: 1, aux: "PanicBoundsCC", reg: regInfo{}, typ: "Mem", call: true}, // arg0=mem, returns memory.
716716

717717
// (InvertFlags (CMP a b)) == (CMP b a)

src/cmd/compile/internal/ssa/opGen.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/runtime/asm_ppc64x.s

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,13 +1350,13 @@ TEXT runtime·debugCallPanicked(SB),NOSPLIT,$32-16
13501350
RET
13511351
#endif
13521352

1353-
TEXT runtime·panicBounds<ABIInternal>(SB),NOSPLIT,$104-0
1353+
TEXT runtime·panicBounds<ABIInternal>(SB),NOSPLIT,$88-0
13541354
// Note: frame size is 16 bytes larger than necessary
13551355
// in order to pacify vet. Vet doesn't understand ppc64
13561356
// layout properly.
13571357
NO_LOCAL_POINTERS
1358-
// Save all 8 int registers that could have an index in them.
1359-
// They may be pointers, but if they are they are dead.
1358+
// Save all 7 int registers that could have an index in them.
1359+
// They may be pointers, but if so they are dead.
13601360
// Skip R0 aka ZERO, R1 aka SP, R2 aka SB
13611361
MOVD R3, 48(R1)
13621362
MOVD R4, 56(R1)
@@ -1365,8 +1365,7 @@ TEXT runtime·panicBounds<ABIInternal>(SB),NOSPLIT,$104-0
13651365
MOVD R7, 80(R1)
13661366
MOVD R8, 88(R1)
13671367
MOVD R9, 96(R1)
1368-
MOVD R10, 104(R1)
1369-
// Note: we only save 8 reigsters to keep under nosplit stack limit
1368+
// Note: we only save 7 registers to keep under nosplit stack limit
13701369
// Also, R11 is clobbered in dynamic linking situations
13711370

13721371
MOVD LR, R3 // PC immediately after call to panicBounds

0 commit comments

Comments
 (0)