Skip to content

Commit 174b858

Browse files
committed
cmd/compile: pass frame size to defframe
Preparation for de-globalizing Stksize and MaxArg. Passes toolstash -cmp. No compiler performance impact. Updates #15756 Change-Id: I312f0bbd15587a6aebf472cd66c8e62b89e55c8a Reviewed-on: https://go-review.googlesource.com/38328 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
1 parent d83af90 commit 174b858

File tree

10 files changed

+18
-18
lines changed

10 files changed

+18
-18
lines changed

src/cmd/compile/internal/amd64/ggen.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ import (
1313
// no floating point in note handlers on Plan 9
1414
var isPlan9 = obj.GOOS == "plan9"
1515

16-
func defframe(ptxt *obj.Prog, fn *gc.Node) {
16+
func defframe(ptxt *obj.Prog, fn *gc.Node, sz int64) {
1717
// fill in argument size, stack size
1818
ptxt.To.Type = obj.TYPE_TEXTSIZE
1919

2020
ptxt.To.Val = int32(gc.Rnd(fn.Type.ArgWidth(), int64(gc.Widthptr)))
21-
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
21+
frame := uint32(gc.Rnd(sz, int64(gc.Widthreg)))
2222
ptxt.To.Offset = int64(frame)
2323

2424
// insert code to zero ambiguously live variables

src/cmd/compile/internal/arm/ggen.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import (
1010
"cmd/internal/obj/arm"
1111
)
1212

13-
func defframe(ptxt *obj.Prog, fn *gc.Node) {
13+
func defframe(ptxt *obj.Prog, fn *gc.Node, sz int64) {
1414
// fill in argument size, stack size
1515
ptxt.To.Type = obj.TYPE_TEXTSIZE
1616

1717
ptxt.To.Val = int32(gc.Rnd(fn.Type.ArgWidth(), int64(gc.Widthptr)))
18-
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
18+
frame := uint32(gc.Rnd(sz, int64(gc.Widthreg)))
1919
ptxt.To.Offset = int64(frame)
2020

2121
// insert code to contain ambiguously live variables

src/cmd/compile/internal/arm64/ggen.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import (
1010
"cmd/internal/obj/arm64"
1111
)
1212

13-
func defframe(ptxt *obj.Prog, fn *gc.Node) {
13+
func defframe(ptxt *obj.Prog, fn *gc.Node, sz int64) {
1414
// fill in argument size, stack size
1515
ptxt.To.Type = obj.TYPE_TEXTSIZE
1616

1717
ptxt.To.Val = int32(gc.Rnd(fn.Type.ArgWidth(), int64(gc.Widthptr)))
18-
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
18+
frame := uint32(gc.Rnd(sz, int64(gc.Widthreg)))
1919

2020
// arm64 requires that the frame size (not counting saved LR)
2121
// be empty or be 8 mod 16. If not, pad it.

src/cmd/compile/internal/gc/go.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ type Arch struct {
365365
MAXWIDTH int64
366366
Use387 bool // should 386 backend use 387 FP instructions instead of sse2.
367367

368-
Defframe func(*obj.Prog, *Node)
368+
Defframe func(*obj.Prog, *Node, int64)
369369
Ginsnop func()
370370
Proginfo func(*obj.Prog) ProgInfo
371371

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -4355,7 +4355,7 @@ func genssa(f *ssa.Func, ptxt *obj.Prog, gcargs, gclocals *Sym) {
43554355
liveness(e.curfn, ptxt, gcargs, gclocals)
43564356

43574357
// Add frame prologue. Zero ambiguously live variables.
4358-
thearch.Defframe(ptxt, e.curfn)
4358+
thearch.Defframe(ptxt, e.curfn, Stksize+Maxarg)
43594359
if Debug['f'] != 0 {
43604360
frame(0)
43614361
}

src/cmd/compile/internal/mips/ggen.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import (
1010
"cmd/internal/obj/mips"
1111
)
1212

13-
func defframe(ptxt *obj.Prog, fn *gc.Node) {
13+
func defframe(ptxt *obj.Prog, fn *gc.Node, sz int64) {
1414
// fill in argument size, stack size
1515
ptxt.To.Type = obj.TYPE_TEXTSIZE
1616

1717
ptxt.To.Val = int32(gc.Rnd(fn.Type.ArgWidth(), int64(gc.Widthptr)))
18-
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
18+
frame := uint32(gc.Rnd(sz, int64(gc.Widthreg)))
1919
ptxt.To.Offset = int64(frame)
2020

2121
// insert code to zero ambiguously live variables

src/cmd/compile/internal/mips64/ggen.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import (
1010
"cmd/internal/obj/mips"
1111
)
1212

13-
func defframe(ptxt *obj.Prog, fn *gc.Node) {
13+
func defframe(ptxt *obj.Prog, fn *gc.Node, sz int64) {
1414
// fill in argument size, stack size
1515
ptxt.To.Type = obj.TYPE_TEXTSIZE
1616

1717
ptxt.To.Val = int32(gc.Rnd(fn.Type.ArgWidth(), int64(gc.Widthptr)))
18-
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
18+
frame := uint32(gc.Rnd(sz, int64(gc.Widthreg)))
1919
ptxt.To.Offset = int64(frame)
2020

2121
// insert code to zero ambiguously live variables

src/cmd/compile/internal/ppc64/ggen.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import (
1010
"cmd/internal/obj/ppc64"
1111
)
1212

13-
func defframe(ptxt *obj.Prog, fn *gc.Node) {
13+
func defframe(ptxt *obj.Prog, fn *gc.Node, sz int64) {
1414
// fill in argument size, stack size
1515
ptxt.To.Type = obj.TYPE_TEXTSIZE
1616

1717
ptxt.To.Val = int32(gc.Rnd(fn.Type.ArgWidth(), int64(gc.Widthptr)))
18-
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
18+
frame := uint32(gc.Rnd(sz, int64(gc.Widthreg)))
1919
ptxt.To.Offset = int64(frame)
2020

2121
// insert code to zero ambiguously live variables

src/cmd/compile/internal/s390x/ggen.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ import (
1616
// Must be between 256 and 4096.
1717
const clearLoopCutoff = 1024
1818

19-
func defframe(ptxt *obj.Prog, fn *gc.Node) {
19+
func defframe(ptxt *obj.Prog, fn *gc.Node, sz int64) {
2020
// fill in argument size, stack size
2121
ptxt.To.Type = obj.TYPE_TEXTSIZE
2222

2323
ptxt.To.Val = int32(gc.Rnd(fn.Type.ArgWidth(), int64(gc.Widthptr)))
24-
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
24+
frame := uint32(gc.Rnd(sz, int64(gc.Widthreg)))
2525
ptxt.To.Offset = int64(frame)
2626

2727
// insert code to zero ambiguously live variables

src/cmd/compile/internal/x86/ggen.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import (
1010
"cmd/internal/obj/x86"
1111
)
1212

13-
func defframe(ptxt *obj.Prog, fn *gc.Node) {
13+
func defframe(ptxt *obj.Prog, fn *gc.Node, sz int64) {
1414
// fill in argument size, stack size
1515
ptxt.To.Type = obj.TYPE_TEXTSIZE
1616

1717
ptxt.To.Val = int32(gc.Rnd(fn.Type.ArgWidth(), int64(gc.Widthptr)))
18-
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
18+
frame := uint32(gc.Rnd(sz, int64(gc.Widthreg)))
1919
ptxt.To.Offset = int64(frame)
2020

2121
// insert code to zero ambiguously live variables

0 commit comments

Comments
 (0)