Commit 361b334c authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: encapsulate Type.Argwid

Passes toolstash -cmp.

Change-Id: I72fb271052e449a83adfa9bd3b923d40781d6341
Reviewed-on: https://go-review.googlesource.com/21243
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 1f0bebcc
...@@ -17,7 +17,7 @@ func defframe(ptxt *obj.Prog) { ...@@ -17,7 +17,7 @@ func defframe(ptxt *obj.Prog) {
// 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(gc.Curfn.Type.Argwid, int64(gc.Widthptr))) ptxt.To.Val = int32(gc.Rnd(gc.Curfn.Type.ArgWidth(), int64(gc.Widthptr)))
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg))) frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
ptxt.To.Offset = int64(frame) ptxt.To.Offset = int64(frame)
......
...@@ -14,7 +14,7 @@ func defframe(ptxt *obj.Prog) { ...@@ -14,7 +14,7 @@ func defframe(ptxt *obj.Prog) {
// 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(gc.Curfn.Type.Argwid, int64(gc.Widthptr))) ptxt.To.Val = int32(gc.Rnd(gc.Curfn.Type.ArgWidth(), int64(gc.Widthptr)))
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg))) frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
ptxt.To.Offset = int64(frame) ptxt.To.Offset = int64(frame)
......
...@@ -15,7 +15,7 @@ func defframe(ptxt *obj.Prog) { ...@@ -15,7 +15,7 @@ func defframe(ptxt *obj.Prog) {
// 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(gc.Curfn.Type.Argwid, int64(gc.Widthptr))) ptxt.To.Val = int32(gc.Rnd(gc.Curfn.Type.ArgWidth(), int64(gc.Widthptr)))
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg))) frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
// arm64 requires that the frame size (not counting saved LR) // arm64 requires that the frame size (not counting saved LR)
......
...@@ -144,7 +144,7 @@ func emitptrargsmap() { ...@@ -144,7 +144,7 @@ func emitptrargsmap() {
} }
sym := Lookup(fmt.Sprintf("%s.args_stackmap", Curfn.Func.Nname.Sym.Name)) sym := Lookup(fmt.Sprintf("%s.args_stackmap", Curfn.Func.Nname.Sym.Name))
nptr := int(Curfn.Type.Argwid / int64(Widthptr)) nptr := int(Curfn.Type.ArgWidth() / int64(Widthptr))
bv := bvalloc(int32(nptr) * 2) bv := bvalloc(int32(nptr) * 2)
nbitmap := 1 nbitmap := 1
if Curfn.Type.Results().NumFields() > 0 { if Curfn.Type.Results().NumFields() > 0 {
......
...@@ -959,7 +959,7 @@ func localswords() int32 { ...@@ -959,7 +959,7 @@ func localswords() int32 {
// Returns the number of words of in and out arguments. // Returns the number of words of in and out arguments.
func argswords() int32 { func argswords() int32 {
return int32(Curfn.Type.Argwid / int64(Widthptr)) return int32(Curfn.Type.ArgWidth() / int64(Widthptr))
} }
// Generates live pointer value maps for arguments and local variables. The // Generates live pointer value maps for arguments and local variables. The
......
...@@ -2493,7 +2493,7 @@ func (s *state) call(n *Node, k callKind) *ssa.Value { ...@@ -2493,7 +2493,7 @@ func (s *state) call(n *Node, k callKind) *ssa.Value {
rcvr = s.newValue1(ssa.OpIData, Types[TUINTPTR], i) rcvr = s.newValue1(ssa.OpIData, Types[TUINTPTR], i)
} }
dowidth(fn.Type) dowidth(fn.Type)
stksize := fn.Type.Argwid // includes receiver stksize := fn.Type.ArgWidth() // includes receiver
// Run all argument assignments. The arg slots have already // Run all argument assignments. The arg slots have already
// been offset by the appropriate amount (+2*widthptr for go/defer, // been offset by the appropriate amount (+2*widthptr for go/defer,
......
...@@ -1517,7 +1517,7 @@ func cheapexpr(n *Node, init *Nodes) *Node { ...@@ -1517,7 +1517,7 @@ func cheapexpr(n *Node, init *Nodes) *Node {
func Setmaxarg(t *Type, extra int32) { func Setmaxarg(t *Type, extra int32) {
dowidth(t) dowidth(t)
w := t.Argwid w := t.ArgWidth()
if w >= Thearch.MAXWIDTH { if w >= Thearch.MAXWIDTH {
Fatalf("bad argwid %v", t) Fatalf("bad argwid %v", t)
} }
......
...@@ -382,6 +382,13 @@ func (t *Type) isDDDArray() bool { ...@@ -382,6 +382,13 @@ func (t *Type) isDDDArray() bool {
return t.Bound == dddBound return t.Bound == dddBound
} }
// ArgWidth returns the total aligned argument size for a function.
// It includes the receiver, parameters, and results.
func (t *Type) ArgWidth() int64 {
t.wantEtype(TFUNC)
return t.Argwid
}
func (t *Type) Size() int64 { func (t *Type) Size() int64 {
dowidth(t) dowidth(t)
return t.Width return t.Width
......
...@@ -15,7 +15,7 @@ func defframe(ptxt *obj.Prog) { ...@@ -15,7 +15,7 @@ func defframe(ptxt *obj.Prog) {
// 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(gc.Curfn.Type.Argwid, int64(gc.Widthptr))) ptxt.To.Val = int32(gc.Rnd(gc.Curfn.Type.ArgWidth(), int64(gc.Widthptr)))
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg))) frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
ptxt.To.Offset = int64(frame) ptxt.To.Offset = int64(frame)
......
...@@ -15,7 +15,7 @@ func defframe(ptxt *obj.Prog) { ...@@ -15,7 +15,7 @@ func defframe(ptxt *obj.Prog) {
// 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(gc.Curfn.Type.Argwid, int64(gc.Widthptr))) ptxt.To.Val = int32(gc.Rnd(gc.Curfn.Type.ArgWidth(), int64(gc.Widthptr)))
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg))) frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
ptxt.To.Offset = int64(frame) ptxt.To.Offset = int64(frame)
......
...@@ -14,7 +14,7 @@ func defframe(ptxt *obj.Prog) { ...@@ -14,7 +14,7 @@ func defframe(ptxt *obj.Prog) {
// 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(gc.Curfn.Type.Argwid, int64(gc.Widthptr))) ptxt.To.Val = int32(gc.Rnd(gc.Curfn.Type.ArgWidth(), int64(gc.Widthptr)))
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg))) frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
ptxt.To.Offset = int64(frame) ptxt.To.Offset = int64(frame)
......
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