Commit 174b858f authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

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: default avatarMatthew Dempsky <mdempsky@google.com>
parent d83af90a
......@@ -13,12 +13,12 @@ import (
// no floating point in note handlers on Plan 9
var isPlan9 = obj.GOOS == "plan9"
func defframe(ptxt *obj.Prog, fn *gc.Node) {
func defframe(ptxt *obj.Prog, fn *gc.Node, sz int64) {
// fill in argument size, stack size
ptxt.To.Type = obj.TYPE_TEXTSIZE
ptxt.To.Val = int32(gc.Rnd(fn.Type.ArgWidth(), int64(gc.Widthptr)))
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
frame := uint32(gc.Rnd(sz, int64(gc.Widthreg)))
ptxt.To.Offset = int64(frame)
// insert code to zero ambiguously live variables
......
......@@ -10,12 +10,12 @@ import (
"cmd/internal/obj/arm"
)
func defframe(ptxt *obj.Prog, fn *gc.Node) {
func defframe(ptxt *obj.Prog, fn *gc.Node, sz int64) {
// fill in argument size, stack size
ptxt.To.Type = obj.TYPE_TEXTSIZE
ptxt.To.Val = int32(gc.Rnd(fn.Type.ArgWidth(), int64(gc.Widthptr)))
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
frame := uint32(gc.Rnd(sz, int64(gc.Widthreg)))
ptxt.To.Offset = int64(frame)
// insert code to contain ambiguously live variables
......
......@@ -10,12 +10,12 @@ import (
"cmd/internal/obj/arm64"
)
func defframe(ptxt *obj.Prog, fn *gc.Node) {
func defframe(ptxt *obj.Prog, fn *gc.Node, sz int64) {
// fill in argument size, stack size
ptxt.To.Type = obj.TYPE_TEXTSIZE
ptxt.To.Val = int32(gc.Rnd(fn.Type.ArgWidth(), int64(gc.Widthptr)))
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
frame := uint32(gc.Rnd(sz, int64(gc.Widthreg)))
// arm64 requires that the frame size (not counting saved LR)
// be empty or be 8 mod 16. If not, pad it.
......
......@@ -365,7 +365,7 @@ type Arch struct {
MAXWIDTH int64
Use387 bool // should 386 backend use 387 FP instructions instead of sse2.
Defframe func(*obj.Prog, *Node)
Defframe func(*obj.Prog, *Node, int64)
Ginsnop func()
Proginfo func(*obj.Prog) ProgInfo
......
......@@ -4355,7 +4355,7 @@ func genssa(f *ssa.Func, ptxt *obj.Prog, gcargs, gclocals *Sym) {
liveness(e.curfn, ptxt, gcargs, gclocals)
// Add frame prologue. Zero ambiguously live variables.
thearch.Defframe(ptxt, e.curfn)
thearch.Defframe(ptxt, e.curfn, Stksize+Maxarg)
if Debug['f'] != 0 {
frame(0)
}
......
......@@ -10,12 +10,12 @@ import (
"cmd/internal/obj/mips"
)
func defframe(ptxt *obj.Prog, fn *gc.Node) {
func defframe(ptxt *obj.Prog, fn *gc.Node, sz int64) {
// fill in argument size, stack size
ptxt.To.Type = obj.TYPE_TEXTSIZE
ptxt.To.Val = int32(gc.Rnd(fn.Type.ArgWidth(), int64(gc.Widthptr)))
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
frame := uint32(gc.Rnd(sz, int64(gc.Widthreg)))
ptxt.To.Offset = int64(frame)
// insert code to zero ambiguously live variables
......
......@@ -10,12 +10,12 @@ import (
"cmd/internal/obj/mips"
)
func defframe(ptxt *obj.Prog, fn *gc.Node) {
func defframe(ptxt *obj.Prog, fn *gc.Node, sz int64) {
// fill in argument size, stack size
ptxt.To.Type = obj.TYPE_TEXTSIZE
ptxt.To.Val = int32(gc.Rnd(fn.Type.ArgWidth(), int64(gc.Widthptr)))
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
frame := uint32(gc.Rnd(sz, int64(gc.Widthreg)))
ptxt.To.Offset = int64(frame)
// insert code to zero ambiguously live variables
......
......@@ -10,12 +10,12 @@ import (
"cmd/internal/obj/ppc64"
)
func defframe(ptxt *obj.Prog, fn *gc.Node) {
func defframe(ptxt *obj.Prog, fn *gc.Node, sz int64) {
// fill in argument size, stack size
ptxt.To.Type = obj.TYPE_TEXTSIZE
ptxt.To.Val = int32(gc.Rnd(fn.Type.ArgWidth(), int64(gc.Widthptr)))
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
frame := uint32(gc.Rnd(sz, int64(gc.Widthreg)))
ptxt.To.Offset = int64(frame)
// insert code to zero ambiguously live variables
......
......@@ -16,12 +16,12 @@ import (
// Must be between 256 and 4096.
const clearLoopCutoff = 1024
func defframe(ptxt *obj.Prog, fn *gc.Node) {
func defframe(ptxt *obj.Prog, fn *gc.Node, sz int64) {
// fill in argument size, stack size
ptxt.To.Type = obj.TYPE_TEXTSIZE
ptxt.To.Val = int32(gc.Rnd(fn.Type.ArgWidth(), int64(gc.Widthptr)))
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
frame := uint32(gc.Rnd(sz, int64(gc.Widthreg)))
ptxt.To.Offset = int64(frame)
// insert code to zero ambiguously live variables
......
......@@ -10,12 +10,12 @@ import (
"cmd/internal/obj/x86"
)
func defframe(ptxt *obj.Prog, fn *gc.Node) {
func defframe(ptxt *obj.Prog, fn *gc.Node, sz int64) {
// fill in argument size, stack size
ptxt.To.Type = obj.TYPE_TEXTSIZE
ptxt.To.Val = int32(gc.Rnd(fn.Type.ArgWidth(), int64(gc.Widthptr)))
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
frame := uint32(gc.Rnd(sz, int64(gc.Widthreg)))
ptxt.To.Offset = int64(frame)
// insert code to zero ambiguously live variables
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment