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 <paumurph@redhat.com>
Auto-Submit: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
This commit is contained in:
Keith Randall 2025-08-06 09:59:12 -07:00 committed by Gopher Robot
parent 2747f925dd
commit e0a1ea431c
3 changed files with 12 additions and 13 deletions

View file

@ -171,7 +171,7 @@ func init() {
fpstore = regInfo{inputs: []regMask{gp | sp | sb, fp}}
fpstoreidx = regInfo{inputs: []regMask{gp | sp | sb, gp | sp | sb, fp}}
callerSave = regMask(gp | fp | gr | xer)
first8 = buildReg("R3 R4 R5 R6 R7 R8 R9 R10")
first7 = buildReg("R3 R4 R5 R6 R7 R8 R9")
)
ops := []opData{
{name: "ADD", argLength: 2, reg: gp21, asm: "ADD", commutative: true}, // arg0 + arg1
@ -709,9 +709,9 @@ func init() {
// when both are constant (normally both 0, as prove derives the fact that a [0] bounds
// failure means the length must have also been 0).
// AuxInt contains a report code (see PanicBounds in genericOps.go).
{name: "LoweredPanicBoundsRR", argLength: 3, aux: "Int64", reg: regInfo{inputs: []regMask{first8, first8}}, typ: "Mem", call: true}, // arg0=x, arg1=y, arg2=mem, returns memory.
{name: "LoweredPanicBoundsRC", argLength: 2, aux: "PanicBoundsC", reg: regInfo{inputs: []regMask{first8}}, typ: "Mem", call: true}, // arg0=x, arg1=mem, returns memory.
{name: "LoweredPanicBoundsCR", argLength: 2, aux: "PanicBoundsC", reg: regInfo{inputs: []regMask{first8}}, typ: "Mem", call: true}, // arg0=y, arg1=mem, returns memory.
{name: "LoweredPanicBoundsRR", argLength: 3, aux: "Int64", reg: regInfo{inputs: []regMask{first7, first7}}, typ: "Mem", call: true}, // arg0=x, arg1=y, arg2=mem, returns memory.
{name: "LoweredPanicBoundsRC", argLength: 2, aux: "PanicBoundsC", reg: regInfo{inputs: []regMask{first7}}, typ: "Mem", call: true}, // arg0=x, arg1=mem, returns memory.
{name: "LoweredPanicBoundsCR", argLength: 2, aux: "PanicBoundsC", reg: regInfo{inputs: []regMask{first7}}, typ: "Mem", call: true}, // arg0=y, arg1=mem, returns memory.
{name: "LoweredPanicBoundsCC", argLength: 1, aux: "PanicBoundsCC", reg: regInfo{}, typ: "Mem", call: true}, // arg0=mem, returns memory.
// (InvertFlags (CMP a b)) == (CMP b a)

View file

@ -33029,8 +33029,8 @@ var opcodeTable = [...]opInfo{
call: true,
reg: regInfo{
inputs: []inputInfo{
{0, 2040}, // R3 R4 R5 R6 R7 R8 R9 R10
{1, 2040}, // R3 R4 R5 R6 R7 R8 R9 R10
{0, 1016}, // R3 R4 R5 R6 R7 R8 R9
{1, 1016}, // R3 R4 R5 R6 R7 R8 R9
},
},
},
@ -33041,7 +33041,7 @@ var opcodeTable = [...]opInfo{
call: true,
reg: regInfo{
inputs: []inputInfo{
{0, 2040}, // R3 R4 R5 R6 R7 R8 R9 R10
{0, 1016}, // R3 R4 R5 R6 R7 R8 R9
},
},
},
@ -33052,7 +33052,7 @@ var opcodeTable = [...]opInfo{
call: true,
reg: regInfo{
inputs: []inputInfo{
{0, 2040}, // R3 R4 R5 R6 R7 R8 R9 R10
{0, 1016}, // R3 R4 R5 R6 R7 R8 R9
},
},
},

View file

@ -1350,13 +1350,13 @@ TEXT runtime·debugCallPanicked(SB),NOSPLIT,$32-16
RET
#endif
TEXT runtime·panicBounds<ABIInternal>(SB),NOSPLIT,$104-0
TEXT runtime·panicBounds<ABIInternal>(SB),NOSPLIT,$88-0
// Note: frame size is 16 bytes larger than necessary
// in order to pacify vet. Vet doesn't understand ppc64
// layout properly.
NO_LOCAL_POINTERS
// Save all 8 int registers that could have an index in them.
// They may be pointers, but if they are they are dead.
// Save all 7 int registers that could have an index in them.
// They may be pointers, but if so they are dead.
// Skip R0 aka ZERO, R1 aka SP, R2 aka SB
MOVD R3, 48(R1)
MOVD R4, 56(R1)
@ -1365,8 +1365,7 @@ TEXT runtime·panicBounds<ABIInternal>(SB),NOSPLIT,$104-0
MOVD R7, 80(R1)
MOVD R8, 88(R1)
MOVD R9, 96(R1)
MOVD R10, 104(R1)
// Note: we only save 8 reigsters to keep under nosplit stack limit
// Note: we only save 7 registers to keep under nosplit stack limit
// Also, R11 is clobbered in dynamic linking situations
MOVD LR, R3 // PC immediately after call to panicBounds