From: Keith Randall Date: Wed, 6 Aug 2025 16:59:12 +0000 (-0700) Subject: cmd/compile: make panicBounds stack frame smaller on ppc64 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e0a1ea431c960c3ed740f9b32754e7c31737035c;p=gostls13.git 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 Auto-Submit: Keith Randall LUCI-TryBot-Result: Go LUCI Reviewed-by: Dmitri Shuralyov Reviewed-by: Keith Randall --- diff --git a/src/cmd/compile/internal/ssa/_gen/PPC64Ops.go b/src/cmd/compile/internal/ssa/_gen/PPC64Ops.go index 983e46fb5e..3c06208f7e 100644 --- a/src/cmd/compile/internal/ssa/_gen/PPC64Ops.go +++ b/src/cmd/compile/internal/ssa/_gen/PPC64Ops.go @@ -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) diff --git a/src/cmd/compile/internal/ssa/opGen.go b/src/cmd/compile/internal/ssa/opGen.go index 9cc7c3d771..73667a5ee4 100644 --- a/src/cmd/compile/internal/ssa/opGen.go +++ b/src/cmd/compile/internal/ssa/opGen.go @@ -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 }, }, }, diff --git a/src/runtime/asm_ppc64x.s b/src/runtime/asm_ppc64x.s index ecfc7c1671..fc70fa8204 100644 --- a/src/runtime/asm_ppc64x.s +++ b/src/runtime/asm_ppc64x.s @@ -1350,13 +1350,13 @@ TEXT runtime·debugCallPanicked(SB),NOSPLIT,$32-16 RET #endif -TEXT runtime·panicBounds(SB),NOSPLIT,$104-0 +TEXT runtime·panicBounds(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(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