]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: make panicBounds stack frame smaller on ppc64
authorKeith Randall <khr@golang.org>
Wed, 6 Aug 2025 16:59:12 +0000 (09:59 -0700)
committerGopher Robot <gobot@golang.org>
Wed, 6 Aug 2025 20:32:58 +0000 (13:32 -0700)
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>
src/cmd/compile/internal/ssa/_gen/PPC64Ops.go
src/cmd/compile/internal/ssa/opGen.go
src/runtime/asm_ppc64x.s

index 983e46fb5ec608ca2b93369b909b295dbcf4ad65..3c06208f7e21cd5ef1f60743a1a07fd2940ca7ed 100644 (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)
index 9cc7c3d771762496bf56bbce46065dbb5deebbc6..73667a5ee4a76fac0c58cbaec82581ced8d7edad 100644 (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
                        },
                },
        },
index ecfc7c167100e3f6ac5fe96c86b7e6db258fadfb..fc70fa82046056f790374e9604962554be6085b6 100644 (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