1
0
mirror of https://github.com/golang/go synced 2024-11-18 06:04:53 -07:00

cmd/compile: use Widthptr instead of Types[Tptr].Width

Change-Id: I21e3abcfd1859f933f55fe875476dec07e43b038
Reviewed-on: https://go-review.googlesource.com/38466
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Josh Bleecher Snyder 2017-03-23 11:21:42 -07:00
parent 0ca8701ea2
commit 9330ef869c
3 changed files with 4 additions and 4 deletions

View File

@ -1003,7 +1003,7 @@ func methodsym(nsym *Sym, t0 *Type, iface int) *Sym {
suffix = ""
if iface != 0 {
dowidth(t0)
if t0.Width < Types[Tptr].Width {
if t0.Width < int64(Widthptr) {
suffix = "·i"
}
}

View File

@ -363,7 +363,7 @@ func methods(t *Type) []*Sig {
if !sig.isym.Siggen() {
sig.isym.SetSiggen(true)
if !eqtype(this, it) || this.Width < Types[Tptr].Width {
if !eqtype(this, it) || this.Width < int64(Widthptr) {
compiling_wrappers = 1
genwrapper(it, f, sig.isym, 1)
compiling_wrappers = 0

View File

@ -1701,13 +1701,13 @@ func genwrapper(rcvr *Type, method *Field, newnam *Sym, iface int) {
t := nod(OTFUNC, nil, nil)
l := []*Node{this}
if iface != 0 && rcvr.Width < Types[Tptr].Width {
if iface != 0 && rcvr.Width < int64(Widthptr) {
// Building method for interface table and receiver
// is smaller than the single pointer-sized word
// that the interface call will pass in.
// Add a dummy padding argument after the
// receiver to make up the difference.
tpad := typArray(Types[TUINT8], Types[Tptr].Width-rcvr.Width)
tpad := typArray(Types[TUINT8], int64(Widthptr)-rcvr.Width)
pad := nod(ODCLFIELD, newname(lookup(".pad")), typenod(tpad))
l = append(l, pad)
}