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