cmd/internal/gc, runtime: change growslice to use int instead of int64
Gc already calculates n as an int, so converting to int64 to call
growslice doesn't serve any purpose except to emit slightly larger
code on 32-bit platforms. Passing n as an int shrinks godoc's text
segment by 8kB (9472633 => 9464133) when building for ARM.
Change-Id: Ief9492c21d01afcb624d3f2a484df741450b788d
Reviewed-on: https://go-review.googlesource.com/6231
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/src/cmd/internal/gc/walk.go b/src/cmd/internal/gc/walk.go
index 1439644..842deab 100644
--- a/src/cmd/internal/gc/walk.go
+++ b/src/cmd/internal/gc/walk.go
@@ -2949,14 +2949,14 @@
nif.Ntest = Nod(OGT, nt, Nodintconst(0))
- // instantiate growslice(Type*, []any, int64) []any
+ // instantiate growslice(Type*, []any, int) []any
fn := syslook("growslice", 1)
argtype(fn, s.Type.Type)
argtype(fn, s.Type.Type)
// s = growslice(T, s, n)
- nif.Nbody = list1(Nod(OAS, s, mkcall1(fn, s.Type, &nif.Ninit, typename(s.Type), s, conv(nt, Types[TINT64]))))
+ nif.Nbody = list1(Nod(OAS, s, mkcall1(fn, s.Type, &nif.Ninit, typename(s.Type), s, nt)))
l = list(l, nif)
@@ -3066,11 +3066,11 @@
nx := Nod(OIF, nil, nil) // if cap(s) - len(s) < argc
nx.Ntest = Nod(OLT, Nod(OSUB, Nod(OCAP, ns, nil), Nod(OLEN, ns, nil)), na)
- fn := syslook("growslice", 1) // growslice(<type>, old []T, n int64) (ret []T)
+ fn := syslook("growslice", 1) // growslice(<type>, old []T, n int) (ret []T)
argtype(fn, ns.Type.Type) // 1 old []any
argtype(fn, ns.Type.Type) // 2 ret []any
- nx.Nbody = list1(Nod(OAS, ns, mkcall1(fn, ns.Type, &nx.Ninit, typename(ns.Type), ns, conv(na, Types[TINT64]))))
+ nx.Nbody = list1(Nod(OAS, ns, mkcall1(fn, ns.Type, &nx.Ninit, typename(ns.Type), ns, na)))
l = list(l, nx)