Commit 584978f4 authored by Dave Cheney's avatar Dave Cheney

cmd/compile/internal/gc: unexport private variables

Change-Id: I14a7c08105e6bdcee04a5cc21d7932e9ca753384
Reviewed-on: https://go-review.googlesource.com/29138
Run-TryBot: Dave Cheney <dave@cheney.net>
Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 8e922759
...@@ -313,9 +313,9 @@ func genhash(sym *Sym, t *Type) { ...@@ -313,9 +313,9 @@ func genhash(sym *Sym, t *Type) {
old_safemode := safemode old_safemode := safemode
safemode = false safemode = false
Disable_checknil++ disable_checknil++
funccompile(fn) funccompile(fn)
Disable_checknil-- disable_checknil--
safemode = old_safemode safemode = old_safemode
} }
...@@ -507,12 +507,12 @@ func geneq(sym *Sym, t *Type) { ...@@ -507,12 +507,12 @@ func geneq(sym *Sym, t *Type) {
// We are comparing a struct or an array, // We are comparing a struct or an array,
// neither of which can be nil, and our comparisons // neither of which can be nil, and our comparisons
// are shallow. // are shallow.
Disable_checknil++ disable_checknil++
funccompile(fn) funccompile(fn)
safemode = old_safemode safemode = old_safemode
Disable_checknil-- disable_checknil--
} }
// eqfield returns the node // eqfield returns the node
......
...@@ -148,8 +148,8 @@ func dowidth(t *Type) { ...@@ -148,8 +148,8 @@ func dowidth(t *Type) {
// simtype == 0 during bootstrap // simtype == 0 during bootstrap
default: default:
if Simtype[t.Etype] != 0 { if simtype[t.Etype] != 0 {
et = Simtype[t.Etype] et = simtype[t.Etype]
} }
} }
......
...@@ -1016,7 +1016,7 @@ func (p *exporter) value(x Val) { ...@@ -1016,7 +1016,7 @@ func (p *exporter) value(x Val) {
p.tag(tag) p.tag(tag)
case *Mpint: case *Mpint:
if Minintval[TINT64].Cmp(x) <= 0 && x.Cmp(Maxintval[TINT64]) <= 0 { if minintval[TINT64].Cmp(x) <= 0 && x.Cmp(maxintval[TINT64]) <= 0 {
// common case: x fits into an int64 - use compact encoding // common case: x fits into an int64 - use compact encoding
p.tag(int64Tag) p.tag(int64Tag)
p.int64(x.Int64()) p.int64(x.Int64())
......
...@@ -168,8 +168,8 @@ func Import(in *bufio.Reader) { ...@@ -168,8 +168,8 @@ func Import(in *bufio.Reader) {
} }
i0 = i i0 = i
if Funcdepth != 0 { if funcdepth != 0 {
formatErrorf("unexpected Funcdepth %d", Funcdepth) formatErrorf("unexpected Funcdepth %d", funcdepth)
} }
// Note: In the original code, funchdr and funcbody are called for // Note: In the original code, funchdr and funcbody are called for
......
...@@ -12,7 +12,7 @@ import ( ...@@ -12,7 +12,7 @@ import (
func closurehdr(ntype *Node) { func closurehdr(ntype *Node) {
n := Nod(OCLOSURE, nil, nil) n := Nod(OCLOSURE, nil, nil)
n.Func.Ntype = ntype n.Func.Ntype = ntype
n.Func.Depth = Funcdepth n.Func.Depth = funcdepth
n.Func.Outerfunc = Curfn n.Func.Outerfunc = Curfn
funchdr(n) funchdr(n)
......
...@@ -356,7 +356,7 @@ func convlit1(n *Node, t *Type, explicit bool, reuse canReuseNode) *Node { ...@@ -356,7 +356,7 @@ func convlit1(n *Node, t *Type, explicit bool, reuse canReuseNode) *Node {
goto bad goto bad
} }
ct := n.Val().Ctype() ct := n.Val().Ctype()
if Isint[et] { if isInt[et] {
switch ct { switch ct {
default: default:
goto bad goto bad
...@@ -368,7 +368,7 @@ func convlit1(n *Node, t *Type, explicit bool, reuse canReuseNode) *Node { ...@@ -368,7 +368,7 @@ func convlit1(n *Node, t *Type, explicit bool, reuse canReuseNode) *Node {
case CTINT: case CTINT:
overflow(n.Val(), t) overflow(n.Val(), t)
} }
} else if Isfloat[et] { } else if isFloat[et] {
switch ct { switch ct {
default: default:
goto bad goto bad
...@@ -380,7 +380,7 @@ func convlit1(n *Node, t *Type, explicit bool, reuse canReuseNode) *Node { ...@@ -380,7 +380,7 @@ func convlit1(n *Node, t *Type, explicit bool, reuse canReuseNode) *Node {
case CTFLT: case CTFLT:
n.SetVal(Val{truncfltlit(n.Val().U.(*Mpflt), t)}) n.SetVal(Val{truncfltlit(n.Val().U.(*Mpflt), t)})
} }
} else if Iscomplex[et] { } else if isComplex[et] {
switch ct { switch ct {
default: default:
goto bad goto bad
...@@ -517,7 +517,7 @@ func doesoverflow(v Val, t *Type) bool { ...@@ -517,7 +517,7 @@ func doesoverflow(v Val, t *Type) bool {
if !t.IsInteger() { if !t.IsInteger() {
Fatalf("overflow: %v integer constant", t) Fatalf("overflow: %v integer constant", t)
} }
return u.Cmp(Minintval[t.Etype]) < 0 || u.Cmp(Maxintval[t.Etype]) > 0 return u.Cmp(minintval[t.Etype]) < 0 || u.Cmp(maxintval[t.Etype]) > 0
case *Mpflt: case *Mpflt:
if !t.IsFloat() { if !t.IsFloat() {
...@@ -557,7 +557,7 @@ func tostr(v Val) Val { ...@@ -557,7 +557,7 @@ func tostr(v Val) Val {
switch u := v.U.(type) { switch u := v.U.(type) {
case *Mpint: case *Mpint:
var i int64 = 0xFFFD var i int64 = 0xFFFD
if u.Cmp(Minintval[TUINT32]) >= 0 && u.Cmp(Maxintval[TUINT32]) <= 0 { if u.Cmp(minintval[TUINT32]) >= 0 && u.Cmp(maxintval[TUINT32]) <= 0 {
i = u.Int64() i = u.Int64()
} }
v.U = string(i) v.U = string(i)
...@@ -678,7 +678,7 @@ func evconst(n *Node) { ...@@ -678,7 +678,7 @@ func evconst(n *Node) {
return return
} }
wl := nl.Type.Etype wl := nl.Type.Etype
if Isint[wl] || Isfloat[wl] || Iscomplex[wl] { if isInt[wl] || isFloat[wl] || isComplex[wl] {
wl = TIDEAL wl = TIDEAL
} }
...@@ -788,7 +788,7 @@ func evconst(n *Node) { ...@@ -788,7 +788,7 @@ func evconst(n *Node) {
TUINT64, TUINT64,
TUINT, TUINT,
TUINTPTR: TUINTPTR:
b.Set(Maxintval[et]) b.Set(maxintval[et])
} }
v.U.(*Mpint).Xor(&b) v.U.(*Mpint).Xor(&b)
...@@ -821,7 +821,7 @@ func evconst(n *Node) { ...@@ -821,7 +821,7 @@ func evconst(n *Node) {
return return
} }
wr = nr.Type.Etype wr = nr.Type.Etype
if Isint[wr] || Isfloat[wr] || Iscomplex[wr] { if isInt[wr] || isFloat[wr] || isComplex[wr] {
wr = TIDEAL wr = TIDEAL
} }
...@@ -1498,7 +1498,7 @@ func strlit(n *Node) string { ...@@ -1498,7 +1498,7 @@ func strlit(n *Node) string {
func smallintconst(n *Node) bool { func smallintconst(n *Node) bool {
if n.Op == OLITERAL && Isconst(n, CTINT) && n.Type != nil { if n.Op == OLITERAL && Isconst(n, CTINT) && n.Type != nil {
switch Simtype[n.Type.Etype] { switch simtype[n.Type.Etype] {
case TINT8, case TINT8,
TUINT8, TUINT8,
TINT16, TINT16,
...@@ -1510,7 +1510,7 @@ func smallintconst(n *Node) bool { ...@@ -1510,7 +1510,7 @@ func smallintconst(n *Node) bool {
return true return true
case TIDEAL, TINT64, TUINT64, TPTR64: case TIDEAL, TINT64, TUINT64, TPTR64:
if n.Val().U.(*Mpint).Cmp(Minintval[TINT32]) < 0 || n.Val().U.(*Mpint).Cmp(Maxintval[TINT32]) > 0 { if n.Val().U.(*Mpint).Cmp(minintval[TINT32]) < 0 || n.Val().U.(*Mpint).Cmp(maxintval[TINT32]) > 0 {
break break
} }
return true return true
...@@ -1522,7 +1522,7 @@ func smallintconst(n *Node) bool { ...@@ -1522,7 +1522,7 @@ func smallintconst(n *Node) bool {
func nonnegconst(n *Node) int { func nonnegconst(n *Node) int {
if n.Op == OLITERAL && n.Type != nil { if n.Op == OLITERAL && n.Type != nil {
switch Simtype[n.Type.Etype] { switch simtype[n.Type.Etype] {
// check negative and 2^31 // check negative and 2^31
case TINT8, case TINT8,
TUINT8, TUINT8,
...@@ -1533,7 +1533,7 @@ func nonnegconst(n *Node) int { ...@@ -1533,7 +1533,7 @@ func nonnegconst(n *Node) int {
TINT64, TINT64,
TUINT64, TUINT64,
TIDEAL: TIDEAL:
if n.Val().U.(*Mpint).Cmp(Minintval[TUINT32]) < 0 || n.Val().U.(*Mpint).Cmp(Maxintval[TINT32]) > 0 { if n.Val().U.(*Mpint).Cmp(minintval[TUINT32]) < 0 || n.Val().U.(*Mpint).Cmp(maxintval[TINT32]) > 0 {
break break
} }
return int(n.Int64()) return int(n.Int64())
...@@ -1583,7 +1583,7 @@ func (n *Node) Convconst(con *Node, t *Type) { ...@@ -1583,7 +1583,7 @@ func (n *Node) Convconst(con *Node, t *Type) {
con.Type = t con.Type = t
con.SetVal(n.Val()) con.SetVal(n.Val())
if Isint[tt] { if isInt[tt] {
con.SetVal(Val{new(Mpint)}) con.SetVal(Val{new(Mpint)})
var i int64 var i int64
switch n.Val().Ctype() { switch n.Val().Ctype() {
...@@ -1605,7 +1605,7 @@ func (n *Node) Convconst(con *Node, t *Type) { ...@@ -1605,7 +1605,7 @@ func (n *Node) Convconst(con *Node, t *Type) {
return return
} }
if Isfloat[tt] { if isFloat[tt] {
con.SetVal(toflt(con.Val())) con.SetVal(toflt(con.Val()))
if con.Val().Ctype() != CTFLT { if con.Val().Ctype() != CTFLT {
Fatalf("convconst ctype=%d %v", con.Val().Ctype(), t) Fatalf("convconst ctype=%d %v", con.Val().Ctype(), t)
...@@ -1616,7 +1616,7 @@ func (n *Node) Convconst(con *Node, t *Type) { ...@@ -1616,7 +1616,7 @@ func (n *Node) Convconst(con *Node, t *Type) {
return return
} }
if Iscomplex[tt] { if isComplex[tt] {
con.SetVal(tocplx(con.Val())) con.SetVal(tocplx(con.Val()))
if tt == TCOMPLEX64 { if tt == TCOMPLEX64 {
con.Val().U.(*Mpcplx).Real = *truncfltlit(&con.Val().U.(*Mpcplx).Real, Types[TFLOAT32]) con.Val().U.(*Mpcplx).Real = *truncfltlit(&con.Val().U.(*Mpcplx).Real, Types[TFLOAT32])
......
...@@ -211,7 +211,7 @@ func declare(n *Node, ctxt Class) { ...@@ -211,7 +211,7 @@ func declare(n *Node, ctxt Class) {
s.Lastlineno = lineno s.Lastlineno = lineno
s.Def = n s.Def = n
n.Name.Vargen = int32(gen) n.Name.Vargen = int32(gen)
n.Name.Funcdepth = Funcdepth n.Name.Funcdepth = funcdepth
n.Class = ctxt n.Class = ctxt
autoexport(n, ctxt) autoexport(n, ctxt)
...@@ -243,7 +243,7 @@ func variter(vl []*Node, t *Node, el []*Node) []*Node { ...@@ -243,7 +243,7 @@ func variter(vl []*Node, t *Node, el []*Node) []*Node {
declare(v, dclcontext) declare(v, dclcontext)
v.Name.Param.Ntype = t v.Name.Param.Ntype = t
v.Name.Defn = as2 v.Name.Defn = as2
if Funcdepth > 0 { if funcdepth > 0 {
init = append(init, Nod(ODCL, v, nil)) init = append(init, Nod(ODCL, v, nil))
} }
} }
...@@ -266,8 +266,8 @@ func variter(vl []*Node, t *Node, el []*Node) []*Node { ...@@ -266,8 +266,8 @@ func variter(vl []*Node, t *Node, el []*Node) []*Node {
declare(v, dclcontext) declare(v, dclcontext)
v.Name.Param.Ntype = t v.Name.Param.Ntype = t
if e != nil || Funcdepth > 0 || isblank(v) { if e != nil || funcdepth > 0 || isblank(v) {
if Funcdepth > 0 { if funcdepth > 0 {
init = append(init, Nod(ODCL, v, nil)) init = append(init, Nod(ODCL, v, nil))
} }
e = Nod(OAS, v, e) e = Nod(OAS, v, e)
...@@ -386,7 +386,7 @@ func oldname(s *Sym) *Node { ...@@ -386,7 +386,7 @@ func oldname(s *Sym) *Node {
return n return n
} }
if Curfn != nil && n.Op == ONAME && n.Name.Funcdepth > 0 && n.Name.Funcdepth != Funcdepth { if Curfn != nil && n.Op == ONAME && n.Name.Funcdepth > 0 && n.Name.Funcdepth != funcdepth {
// Inner func is referring to var in outer func. // Inner func is referring to var in outer func.
// //
// TODO(rsc): If there is an outer variable x and we // TODO(rsc): If there is an outer variable x and we
...@@ -394,7 +394,7 @@ func oldname(s *Sym) *Node { ...@@ -394,7 +394,7 @@ func oldname(s *Sym) *Node {
// the := it looks like a reference to the outer x so we'll // the := it looks like a reference to the outer x so we'll
// make x a closure variable unnecessarily. // make x a closure variable unnecessarily.
c := n.Name.Param.Innermost c := n.Name.Param.Innermost
if c == nil || c.Name.Funcdepth != Funcdepth { if c == nil || c.Name.Funcdepth != funcdepth {
// Do not have a closure var for the active closure yet; make one. // Do not have a closure var for the active closure yet; make one.
c = Nod(ONAME, nil, nil) c = Nod(ONAME, nil, nil)
c.Sym = s c.Sym = s
...@@ -404,7 +404,7 @@ func oldname(s *Sym) *Node { ...@@ -404,7 +404,7 @@ func oldname(s *Sym) *Node {
c.Name.Defn = n c.Name.Defn = n
c.Addable = false c.Addable = false
c.Ullman = 2 c.Ullman = 2
c.Name.Funcdepth = Funcdepth c.Name.Funcdepth = funcdepth
// Link into list of active closure variables. // Link into list of active closure variables.
// Popped from list in func closurebody. // Popped from list in func closurebody.
...@@ -529,7 +529,7 @@ func ifacedcl(n *Node) { ...@@ -529,7 +529,7 @@ func ifacedcl(n *Node) {
// returns in auto-declaration context. // returns in auto-declaration context.
func funchdr(n *Node) { func funchdr(n *Node) {
// change the declaration context from extern to auto // change the declaration context from extern to auto
if Funcdepth == 0 && dclcontext != PEXTERN { if funcdepth == 0 && dclcontext != PEXTERN {
Fatalf("funchdr: dclcontext = %d", dclcontext) Fatalf("funchdr: dclcontext = %d", dclcontext)
} }
...@@ -672,14 +672,14 @@ func funcargs2(t *Type) { ...@@ -672,14 +672,14 @@ func funcargs2(t *Type) {
} }
var funcstack []*Node // stack of previous values of Curfn var funcstack []*Node // stack of previous values of Curfn
var Funcdepth int32 // len(funcstack) during parsing, but then forced to be the same later during compilation var funcdepth int32 // len(funcstack) during parsing, but then forced to be the same later during compilation
// start the function. // start the function.
// called before funcargs; undone at end of funcbody. // called before funcargs; undone at end of funcbody.
func funcstart(n *Node) { func funcstart(n *Node) {
markdcl() markdcl()
funcstack = append(funcstack, Curfn) funcstack = append(funcstack, Curfn)
Funcdepth++ funcdepth++
Curfn = n Curfn = n
} }
...@@ -693,8 +693,8 @@ func funcbody(n *Node) { ...@@ -693,8 +693,8 @@ func funcbody(n *Node) {
} }
popdcl() popdcl()
funcstack, Curfn = funcstack[:len(funcstack)-1], funcstack[len(funcstack)-1] funcstack, Curfn = funcstack[:len(funcstack)-1], funcstack[len(funcstack)-1]
Funcdepth-- funcdepth--
if Funcdepth == 0 { if funcdepth == 0 {
dclcontext = PEXTERN dclcontext = PEXTERN
} }
} }
...@@ -1256,13 +1256,13 @@ func funccompile(n *Node) { ...@@ -1256,13 +1256,13 @@ func funccompile(n *Node) {
Stksize = 0 Stksize = 0
dclcontext = PAUTO dclcontext = PAUTO
Funcdepth = n.Func.Depth + 1 funcdepth = n.Func.Depth + 1
compile(n) compile(n)
Curfn = nil Curfn = nil
Pc = nil Pc = nil
continpc = nil continpc = nil
breakpc = nil breakpc = nil
Funcdepth = 0 funcdepth = 0
dclcontext = PEXTERN dclcontext = PEXTERN
if nerrors != 0 { if nerrors != 0 {
// If we have compile errors, ignore any assembler/linker errors. // If we have compile errors, ignore any assembler/linker errors.
......
...@@ -105,11 +105,11 @@ const ( ...@@ -105,11 +105,11 @@ const (
// uchar nel[4]; // number of elements // uchar nel[4]; // number of elements
// uchar cap[4]; // allocated number of elements // uchar cap[4]; // allocated number of elements
// } Array; // } Array;
var Array_array int // runtime offsetof(Array,array) - same for String var array_array int // runtime offsetof(Array,array) - same for String
var Array_nel int // runtime offsetof(Array,nel) - same for String var array_nel int // runtime offsetof(Array,nel) - same for String
var Array_cap int // runtime offsetof(Array,cap) var array_cap int // runtime offsetof(Array,cap)
var sizeof_Array int // runtime sizeof(Array) var sizeof_Array int // runtime sizeof(Array)
...@@ -182,13 +182,13 @@ var localimport string ...@@ -182,13 +182,13 @@ var localimport string
var asmhdr string var asmhdr string
var Simtype [NTYPE]EType var simtype [NTYPE]EType
var ( var (
isforw [NTYPE]bool isforw [NTYPE]bool
Isint [NTYPE]bool isInt [NTYPE]bool
Isfloat [NTYPE]bool isFloat [NTYPE]bool
Iscomplex [NTYPE]bool isComplex [NTYPE]bool
issimple [NTYPE]bool issimple [NTYPE]bool
) )
...@@ -210,9 +210,9 @@ var ( ...@@ -210,9 +210,9 @@ var (
iscmp [OEND]bool iscmp [OEND]bool
) )
var Minintval [NTYPE]*Mpint var minintval [NTYPE]*Mpint
var Maxintval [NTYPE]*Mpint var maxintval [NTYPE]*Mpint
var minfltval [NTYPE]*Mpflt var minfltval [NTYPE]*Mpflt
...@@ -292,7 +292,7 @@ var Pc *obj.Prog ...@@ -292,7 +292,7 @@ var Pc *obj.Prog
var nodfp *Node var nodfp *Node
var Disable_checknil int var disable_checknil int
// interface to back end // interface to back end
...@@ -398,7 +398,7 @@ var Deferproc *Node ...@@ -398,7 +398,7 @@ var Deferproc *Node
var Deferreturn *Node var Deferreturn *Node
var Panicindex *Node var panicindex *Node
var panicslice *Node var panicslice *Node
......
...@@ -308,7 +308,7 @@ func Naddr(a *obj.Addr, n *Node) { ...@@ -308,7 +308,7 @@ func Naddr(a *obj.Addr, n *Node) {
case ONAME: case ONAME:
a.Etype = 0 a.Etype = 0
if n.Type != nil { if n.Type != nil {
a.Etype = uint8(Simtype[n.Type.Etype]) a.Etype = uint8(simtype[n.Type.Etype])
} }
a.Offset = n.Xoffset a.Offset = n.Xoffset
s := n.Sym s := n.Sym
...@@ -416,7 +416,7 @@ func Naddr(a *obj.Addr, n *Node) { ...@@ -416,7 +416,7 @@ func Naddr(a *obj.Addr, n *Node) {
break // idata(nil) break // idata(nil)
} }
if isdirectiface(n.Type) { if isdirectiface(n.Type) {
a.Etype = uint8(Simtype[n.Type.Etype]) a.Etype = uint8(simtype[n.Type.Etype])
} else { } else {
a.Etype = uint8(Tptr) a.Etype = uint8(Tptr)
} }
...@@ -430,8 +430,8 @@ func Naddr(a *obj.Addr, n *Node) { ...@@ -430,8 +430,8 @@ func Naddr(a *obj.Addr, n *Node) {
if a.Type == obj.TYPE_CONST && a.Offset == 0 { if a.Type == obj.TYPE_CONST && a.Offset == 0 {
break // ptr(nil) break // ptr(nil)
} }
a.Etype = uint8(Simtype[Tptr]) a.Etype = uint8(simtype[Tptr])
a.Offset += int64(Array_array) a.Offset += int64(array_array)
a.Width = int64(Widthptr) a.Width = int64(Widthptr)
// len of string or slice // len of string or slice
...@@ -441,8 +441,8 @@ func Naddr(a *obj.Addr, n *Node) { ...@@ -441,8 +441,8 @@ func Naddr(a *obj.Addr, n *Node) {
if a.Type == obj.TYPE_CONST && a.Offset == 0 { if a.Type == obj.TYPE_CONST && a.Offset == 0 {
break // len(nil) break // len(nil)
} }
a.Etype = uint8(Simtype[TUINT]) a.Etype = uint8(simtype[TUINT])
a.Offset += int64(Array_nel) a.Offset += int64(array_nel)
if Thearch.LinkArch.Family != sys.ARM { // TODO(rsc): Do this even on arm. if Thearch.LinkArch.Family != sys.ARM { // TODO(rsc): Do this even on arm.
a.Width = int64(Widthint) a.Width = int64(Widthint)
} }
...@@ -454,8 +454,8 @@ func Naddr(a *obj.Addr, n *Node) { ...@@ -454,8 +454,8 @@ func Naddr(a *obj.Addr, n *Node) {
if a.Type == obj.TYPE_CONST && a.Offset == 0 { if a.Type == obj.TYPE_CONST && a.Offset == 0 {
break // cap(nil) break // cap(nil)
} }
a.Etype = uint8(Simtype[TUINT]) a.Etype = uint8(simtype[TUINT])
a.Offset += int64(Array_cap) a.Offset += int64(array_cap)
if Thearch.LinkArch.Family != sys.ARM { // TODO(rsc): Do this even on arm. if Thearch.LinkArch.Family != sys.ARM { // TODO(rsc): Do this even on arm.
a.Width = int64(Widthint) a.Width = int64(Widthint)
} }
...@@ -625,7 +625,7 @@ func Regalloc(n *Node, t *Type, o *Node) { ...@@ -625,7 +625,7 @@ func Regalloc(n *Node, t *Type, o *Node) {
if t == nil { if t == nil {
Fatalf("regalloc: t nil") Fatalf("regalloc: t nil")
} }
et := Simtype[t.Etype] et := simtype[t.Etype]
if Ctxt.Arch.RegSize == 4 && (et == TINT64 || et == TUINT64) { if Ctxt.Arch.RegSize == 4 && (et == TINT64 || et == TUINT64) {
Fatalf("regalloc 64bit") Fatalf("regalloc 64bit")
} }
......
...@@ -49,7 +49,7 @@ var debugtab = []struct { ...@@ -49,7 +49,7 @@ var debugtab = []struct {
}{ }{
{"append", &Debug_append}, // print information about append compilation {"append", &Debug_append}, // print information about append compilation
{"closure", &Debug_closure}, // print information about closure compilation {"closure", &Debug_closure}, // print information about closure compilation
{"disablenil", &Disable_checknil}, // disable nil checks {"disablenil", &disable_checknil}, // disable nil checks
{"gcprog", &Debug_gcprog}, // print dump of GC programs {"gcprog", &Debug_gcprog}, // print dump of GC programs
{"nil", &Debug_checknil}, // print information about nil checks {"nil", &Debug_checknil}, // print information about nil checks
{"panic", &Debug_panic}, // do not hide any compiler panic {"panic", &Debug_panic}, // do not hide any compiler panic
......
...@@ -307,7 +307,7 @@ func compile(fn *Node) { ...@@ -307,7 +307,7 @@ func compile(fn *Node) {
Newproc = Sysfunc("newproc") Newproc = Sysfunc("newproc")
Deferproc = Sysfunc("deferproc") Deferproc = Sysfunc("deferproc")
Deferreturn = Sysfunc("deferreturn") Deferreturn = Sysfunc("deferreturn")
Panicindex = Sysfunc("panicindex") panicindex = Sysfunc("panicindex")
panicslice = Sysfunc("panicslice") panicslice = Sysfunc("panicslice")
panicdivide = Sysfunc("panicdivide") panicdivide = Sysfunc("panicdivide")
growslice = Sysfunc("growslice") growslice = Sysfunc("growslice")
......
...@@ -325,11 +325,11 @@ func staticcopy(l *Node, r *Node, out *[]*Node) bool { ...@@ -325,11 +325,11 @@ func staticcopy(l *Node, r *Node, out *[]*Node) bool {
a := inittemps[r] a := inittemps[r]
n := *l n := *l
n.Xoffset = l.Xoffset + int64(Array_array) n.Xoffset = l.Xoffset + int64(array_array)
gdata(&n, Nod(OADDR, a, nil), Widthptr) gdata(&n, Nod(OADDR, a, nil), Widthptr)
n.Xoffset = l.Xoffset + int64(Array_nel) n.Xoffset = l.Xoffset + int64(array_nel)
gdata(&n, r.Right, Widthint) gdata(&n, r.Right, Widthint)
n.Xoffset = l.Xoffset + int64(Array_cap) n.Xoffset = l.Xoffset + int64(array_cap)
gdata(&n, r.Right, Widthint) gdata(&n, r.Right, Widthint)
return true return true
...@@ -426,11 +426,11 @@ func staticassign(l *Node, r *Node, out *[]*Node) bool { ...@@ -426,11 +426,11 @@ func staticassign(l *Node, r *Node, out *[]*Node) bool {
a := staticname(ta) a := staticname(ta)
inittemps[r] = a inittemps[r] = a
n := *l n := *l
n.Xoffset = l.Xoffset + int64(Array_array) n.Xoffset = l.Xoffset + int64(array_array)
gdata(&n, Nod(OADDR, a, nil), Widthptr) gdata(&n, Nod(OADDR, a, nil), Widthptr)
n.Xoffset = l.Xoffset + int64(Array_nel) n.Xoffset = l.Xoffset + int64(array_nel)
gdata(&n, r.Right, Widthint) gdata(&n, r.Right, Widthint)
n.Xoffset = l.Xoffset + int64(Array_cap) n.Xoffset = l.Xoffset + int64(array_cap)
gdata(&n, r.Right, Widthint) gdata(&n, r.Right, Widthint)
// Fall through to init underlying array. // Fall through to init underlying array.
...@@ -1373,15 +1373,15 @@ func genAsInitNoCheck(n *Node, reportOnly bool) bool { ...@@ -1373,15 +1373,15 @@ func genAsInitNoCheck(n *Node, reportOnly bool) bool {
} }
if !reportOnly { if !reportOnly {
nam.Xoffset += int64(Array_array) nam.Xoffset += int64(array_array)
gdata(&nam, ptr, Widthptr) gdata(&nam, ptr, Widthptr)
nam.Xoffset += int64(Array_nel) - int64(Array_array) nam.Xoffset += int64(array_nel) - int64(array_array)
var nod1 Node var nod1 Node
Nodconst(&nod1, Types[TINT], nr.Type.NumElem()) Nodconst(&nod1, Types[TINT], nr.Type.NumElem())
gdata(&nam, &nod1, Widthint) gdata(&nam, &nod1, Widthint)
nam.Xoffset += int64(Array_cap) - int64(Array_nel) nam.Xoffset += int64(array_cap) - int64(array_nel)
gdata(&nam, &nod1, Widthint) gdata(&nam, &nod1, Widthint)
} }
......
...@@ -1938,7 +1938,7 @@ func (s *state) expr(n *Node) *ssa.Value { ...@@ -1938,7 +1938,7 @@ func (s *state) expr(n *Node) *ssa.Value {
case n.Left.Type.IsString(): case n.Left.Type.IsString():
a := s.expr(n.Left) a := s.expr(n.Left)
i := s.expr(n.Right) i := s.expr(n.Right)
i = s.extendIndex(i, Panicindex) i = s.extendIndex(i, panicindex)
if !n.Bounded { if !n.Bounded {
len := s.newValue1(ssa.OpStringLen, Types[TINT], a) len := s.newValue1(ssa.OpStringLen, Types[TINT], a)
s.boundsCheck(i, len) s.boundsCheck(i, len)
...@@ -2170,7 +2170,7 @@ func (s *state) append(n *Node, inplace bool) *ssa.Value { ...@@ -2170,7 +2170,7 @@ func (s *state) append(n *Node, inplace bool) *ssa.Value {
// Tell liveness we're about to build a new slice // Tell liveness we're about to build a new slice
s.vars[&memVar] = s.newValue1A(ssa.OpVarDef, ssa.TypeMem, sn, s.mem()) s.vars[&memVar] = s.newValue1A(ssa.OpVarDef, ssa.TypeMem, sn, s.mem())
} }
capaddr := s.newValue1I(ssa.OpOffPtr, pt, int64(Array_cap), addr) capaddr := s.newValue1I(ssa.OpOffPtr, pt, int64(array_cap), addr)
s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, s.config.IntSize, capaddr, r[2], s.mem()) s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, s.config.IntSize, capaddr, r[2], s.mem())
s.insertWBstore(pt, addr, r[0], n.Lineno, 0) s.insertWBstore(pt, addr, r[0], n.Lineno, 0)
// load the value we just stored to avoid having to spill it // load the value we just stored to avoid having to spill it
...@@ -2191,7 +2191,7 @@ func (s *state) append(n *Node, inplace bool) *ssa.Value { ...@@ -2191,7 +2191,7 @@ func (s *state) append(n *Node, inplace bool) *ssa.Value {
if inplace { if inplace {
l = s.variable(&lenVar, Types[TINT]) // generates phi for len l = s.variable(&lenVar, Types[TINT]) // generates phi for len
nl = s.newValue2(s.ssaOp(OADD, Types[TINT]), Types[TINT], l, s.constInt(Types[TINT], nargs)) nl = s.newValue2(s.ssaOp(OADD, Types[TINT]), Types[TINT], l, s.constInt(Types[TINT], nargs))
lenaddr := s.newValue1I(ssa.OpOffPtr, pt, int64(Array_nel), addr) lenaddr := s.newValue1I(ssa.OpOffPtr, pt, int64(array_nel), addr)
s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, s.config.IntSize, lenaddr, nl, s.mem()) s.vars[&memVar] = s.newValue3I(ssa.OpStore, ssa.TypeMem, s.config.IntSize, lenaddr, nl, s.mem())
} }
...@@ -2996,7 +2996,7 @@ func (s *state) addr(n *Node, bounded bool) (*ssa.Value, bool) { ...@@ -2996,7 +2996,7 @@ func (s *state) addr(n *Node, bounded bool) (*ssa.Value, bool) {
if n.Left.Type.IsSlice() { if n.Left.Type.IsSlice() {
a := s.expr(n.Left) a := s.expr(n.Left)
i := s.expr(n.Right) i := s.expr(n.Right)
i = s.extendIndex(i, Panicindex) i = s.extendIndex(i, panicindex)
len := s.newValue1(ssa.OpSliceLen, Types[TINT], a) len := s.newValue1(ssa.OpSliceLen, Types[TINT], a)
if !n.Bounded { if !n.Bounded {
s.boundsCheck(i, len) s.boundsCheck(i, len)
...@@ -3006,7 +3006,7 @@ func (s *state) addr(n *Node, bounded bool) (*ssa.Value, bool) { ...@@ -3006,7 +3006,7 @@ func (s *state) addr(n *Node, bounded bool) (*ssa.Value, bool) {
} else { // array } else { // array
a, isVolatile := s.addr(n.Left, bounded) a, isVolatile := s.addr(n.Left, bounded)
i := s.expr(n.Right) i := s.expr(n.Right)
i = s.extendIndex(i, Panicindex) i = s.extendIndex(i, panicindex)
len := s.constInt(Types[TINT], n.Left.Type.NumElem()) len := s.constInt(Types[TINT], n.Left.Type.NumElem())
if !n.Bounded { if !n.Bounded {
s.boundsCheck(i, len) s.boundsCheck(i, len)
...@@ -3132,7 +3132,7 @@ func (s *state) exprPtr(n *Node, bounded bool, lineno int32) *ssa.Value { ...@@ -3132,7 +3132,7 @@ func (s *state) exprPtr(n *Node, bounded bool, lineno int32) *ssa.Value {
// Used only for automatically inserted nil checks, // Used only for automatically inserted nil checks,
// not for user code like 'x != nil'. // not for user code like 'x != nil'.
func (s *state) nilCheck(ptr *ssa.Value) { func (s *state) nilCheck(ptr *ssa.Value) {
if Disable_checknil != 0 { if disable_checknil != 0 {
return return
} }
s.newValue2(ssa.OpNilCheck, ssa.TypeVoid, ptr, s.mem()) s.newValue2(ssa.OpNilCheck, ssa.TypeVoid, ptr, s.mem())
...@@ -3148,7 +3148,7 @@ func (s *state) boundsCheck(idx, len *ssa.Value) { ...@@ -3148,7 +3148,7 @@ func (s *state) boundsCheck(idx, len *ssa.Value) {
// bounds check // bounds check
cmp := s.newValue2(ssa.OpIsInBounds, Types[TBOOL], idx, len) cmp := s.newValue2(ssa.OpIsInBounds, Types[TBOOL], idx, len)
s.check(cmp, Panicindex) s.check(cmp, panicindex)
} }
// sliceBoundsCheck generates slice bounds checking code. Checks if 0 <= idx <= len, branches to exit if not. // sliceBoundsCheck generates slice bounds checking code. Checks if 0 <= idx <= len, branches to exit if not.
......
...@@ -921,7 +921,7 @@ func convertop(src *Type, dst *Type, why *string) Op { ...@@ -921,7 +921,7 @@ func convertop(src *Type, dst *Type, why *string) Op {
// 4. src and dst are both integer or floating point types. // 4. src and dst are both integer or floating point types.
if (src.IsInteger() || src.IsFloat()) && (dst.IsInteger() || dst.IsFloat()) { if (src.IsInteger() || src.IsFloat()) && (dst.IsInteger() || dst.IsFloat()) {
if Simtype[src.Etype] == Simtype[dst.Etype] { if simtype[src.Etype] == simtype[dst.Etype] {
return OCONVNOP return OCONVNOP
} }
return OCONV return OCONV
...@@ -929,7 +929,7 @@ func convertop(src *Type, dst *Type, why *string) Op { ...@@ -929,7 +929,7 @@ func convertop(src *Type, dst *Type, why *string) Op {
// 5. src and dst are both complex types. // 5. src and dst are both complex types.
if src.IsComplex() && dst.IsComplex() { if src.IsComplex() && dst.IsComplex() {
if Simtype[src.Etype] == Simtype[dst.Etype] { if simtype[src.Etype] == simtype[dst.Etype] {
return OCONVNOP return OCONVNOP
} }
return OCONV return OCONV
...@@ -2007,7 +2007,7 @@ func Simsimtype(t *Type) EType { ...@@ -2007,7 +2007,7 @@ func Simsimtype(t *Type) EType {
return 0 return 0
} }
et := Simtype[t.Etype] et := simtype[t.Etype]
switch et { switch et {
case TPTR32: case TPTR32:
et = TUINT32 et = TUINT32
......
...@@ -1027,7 +1027,7 @@ OpSwitch: ...@@ -1027,7 +1027,7 @@ OpSwitch:
yyerror("invalid array index %v (out of bounds for %d-element array)", n.Right, t.NumElem()) yyerror("invalid array index %v (out of bounds for %d-element array)", n.Right, t.NumElem())
} else if Isconst(n.Left, CTSTR) && x >= int64(len(n.Left.Val().U.(string))) { } else if Isconst(n.Left, CTSTR) && x >= int64(len(n.Left.Val().U.(string))) {
yyerror("invalid string index %v (out of bounds for %d-byte string)", n.Right, len(n.Left.Val().U.(string))) yyerror("invalid string index %v (out of bounds for %d-byte string)", n.Right, len(n.Left.Val().U.(string)))
} else if n.Right.Val().U.(*Mpint).Cmp(Maxintval[TINT]) > 0 { } else if n.Right.Val().U.(*Mpint).Cmp(maxintval[TINT]) > 0 {
yyerror("invalid %s index %v (index too large)", why, n.Right) yyerror("invalid %s index %v (index too large)", why, n.Right)
} }
} }
...@@ -2173,7 +2173,7 @@ func checksliceindex(l *Node, r *Node, tp *Type) bool { ...@@ -2173,7 +2173,7 @@ func checksliceindex(l *Node, r *Node, tp *Type) bool {
} else if Isconst(l, CTSTR) && r.Int64() > int64(len(l.Val().U.(string))) { } else if Isconst(l, CTSTR) && r.Int64() > int64(len(l.Val().U.(string))) {
yyerror("invalid slice index %v (out of bounds for %d-byte string)", r, len(l.Val().U.(string))) yyerror("invalid slice index %v (out of bounds for %d-byte string)", r, len(l.Val().U.(string)))
return false return false
} else if r.Val().U.(*Mpint).Cmp(Maxintval[TINT]) > 0 { } else if r.Val().U.(*Mpint).Cmp(maxintval[TINT]) > 0 {
yyerror("invalid slice index %v (index too large)", r) yyerror("invalid slice index %v (index too large)", r)
return false return false
} }
...@@ -3774,7 +3774,7 @@ func checkmake(t *Type, arg string, n *Node) bool { ...@@ -3774,7 +3774,7 @@ func checkmake(t *Type, arg string, n *Node) bool {
return false return false
} }
if n.Val().U.(*Mpint).Cmp(Maxintval[TINT]) > 0 { if n.Val().U.(*Mpint).Cmp(maxintval[TINT]) > 0 {
yyerror("%s argument too large in make(%v)", arg, t) yyerror("%s argument too large in make(%v)", arg, t)
return false return false
} }
......
...@@ -149,7 +149,7 @@ func typeinit() { ...@@ -149,7 +149,7 @@ func typeinit() {
} }
for et := EType(0); et < NTYPE; et++ { for et := EType(0); et < NTYPE; et++ {
Simtype[et] = et simtype[et] = et
} }
Types[TPTR32] = typ(TPTR32) Types[TPTR32] = typ(TPTR32)
...@@ -171,23 +171,23 @@ func typeinit() { ...@@ -171,23 +171,23 @@ func typeinit() {
} }
for et := TINT8; et <= TUINT64; et++ { for et := TINT8; et <= TUINT64; et++ {
Isint[et] = true isInt[et] = true
} }
Isint[TINT] = true isInt[TINT] = true
Isint[TUINT] = true isInt[TUINT] = true
Isint[TUINTPTR] = true isInt[TUINTPTR] = true
Isfloat[TFLOAT32] = true isFloat[TFLOAT32] = true
Isfloat[TFLOAT64] = true isFloat[TFLOAT64] = true
Iscomplex[TCOMPLEX64] = true isComplex[TCOMPLEX64] = true
Iscomplex[TCOMPLEX128] = true isComplex[TCOMPLEX128] = true
isforw[TFORW] = true isforw[TFORW] = true
// initialize okfor // initialize okfor
for et := EType(0); et < NTYPE; et++ { for et := EType(0); et < NTYPE; et++ {
if Isint[et] || et == TIDEAL { if isInt[et] || et == TIDEAL {
okforeq[et] = true okforeq[et] = true
okforcmp[et] = true okforcmp[et] = true
okforarith[et] = true okforarith[et] = true
...@@ -195,11 +195,11 @@ func typeinit() { ...@@ -195,11 +195,11 @@ func typeinit() {
okforand[et] = true okforand[et] = true
okforconst[et] = true okforconst[et] = true
issimple[et] = true issimple[et] = true
Minintval[et] = new(Mpint) minintval[et] = new(Mpint)
Maxintval[et] = new(Mpint) maxintval[et] = new(Mpint)
} }
if Isfloat[et] { if isFloat[et] {
okforeq[et] = true okforeq[et] = true
okforcmp[et] = true okforcmp[et] = true
okforadd[et] = true okforadd[et] = true
...@@ -210,7 +210,7 @@ func typeinit() { ...@@ -210,7 +210,7 @@ func typeinit() {
maxfltval[et] = newMpflt() maxfltval[et] = newMpflt()
} }
if Iscomplex[et] { if isComplex[et] {
okforeq[et] = true okforeq[et] = true
okforadd[et] = true okforadd[et] = true
okforarith[et] = true okforarith[et] = true
...@@ -302,19 +302,19 @@ func typeinit() { ...@@ -302,19 +302,19 @@ func typeinit() {
iscmp[OEQ] = true iscmp[OEQ] = true
iscmp[ONE] = true iscmp[ONE] = true
Maxintval[TINT8].SetString("0x7f") maxintval[TINT8].SetString("0x7f")
Minintval[TINT8].SetString("-0x80") minintval[TINT8].SetString("-0x80")
Maxintval[TINT16].SetString("0x7fff") maxintval[TINT16].SetString("0x7fff")
Minintval[TINT16].SetString("-0x8000") minintval[TINT16].SetString("-0x8000")
Maxintval[TINT32].SetString("0x7fffffff") maxintval[TINT32].SetString("0x7fffffff")
Minintval[TINT32].SetString("-0x80000000") minintval[TINT32].SetString("-0x80000000")
Maxintval[TINT64].SetString("0x7fffffffffffffff") maxintval[TINT64].SetString("0x7fffffffffffffff")
Minintval[TINT64].SetString("-0x8000000000000000") minintval[TINT64].SetString("-0x8000000000000000")
Maxintval[TUINT8].SetString("0xff") maxintval[TUINT8].SetString("0xff")
Maxintval[TUINT16].SetString("0xffff") maxintval[TUINT16].SetString("0xffff")
Maxintval[TUINT32].SetString("0xffffffff") maxintval[TUINT32].SetString("0xffffffff")
Maxintval[TUINT64].SetString("0xffffffffffffffff") maxintval[TUINT64].SetString("0xffffffffffffffff")
// f is valid float if min < f < max. (min and max are not themselves valid.) // f is valid float if min < f < max. (min and max are not themselves valid.)
maxfltval[TFLOAT32].SetString("33554431p103") // 2^24-1 p (127-23) + 1/2 ulp maxfltval[TFLOAT32].SetString("33554431p103") // 2^24-1 p (127-23) + 1/2 ulp
...@@ -337,19 +337,19 @@ func typeinit() { ...@@ -337,19 +337,19 @@ func typeinit() {
Types[TINTER] = typ(TINTER) Types[TINTER] = typ(TINTER)
// simple aliases // simple aliases
Simtype[TMAP] = Tptr simtype[TMAP] = Tptr
Simtype[TCHAN] = Tptr simtype[TCHAN] = Tptr
Simtype[TFUNC] = Tptr simtype[TFUNC] = Tptr
Simtype[TUNSAFEPTR] = Tptr simtype[TUNSAFEPTR] = Tptr
Array_array = int(Rnd(0, int64(Widthptr))) array_array = int(Rnd(0, int64(Widthptr)))
Array_nel = int(Rnd(int64(Array_array)+int64(Widthptr), int64(Widthint))) array_nel = int(Rnd(int64(array_array)+int64(Widthptr), int64(Widthint)))
Array_cap = int(Rnd(int64(Array_nel)+int64(Widthint), int64(Widthint))) array_cap = int(Rnd(int64(array_nel)+int64(Widthint), int64(Widthint)))
sizeof_Array = int(Rnd(int64(Array_cap)+int64(Widthint), int64(Widthptr))) sizeof_Array = int(Rnd(int64(array_cap)+int64(Widthint), int64(Widthptr)))
// string is same as slice wo the cap // string is same as slice wo the cap
sizeof_String = int(Rnd(int64(Array_nel)+int64(Widthint), int64(Widthptr))) sizeof_String = int(Rnd(int64(array_nel)+int64(Widthint), int64(Widthptr)))
dowidth(Types[TSTRING]) dowidth(Types[TSTRING])
dowidth(idealstring) dowidth(idealstring)
...@@ -421,11 +421,11 @@ func lexinit1() { ...@@ -421,11 +421,11 @@ func lexinit1() {
sameas = s.sameas64 sameas = s.sameas64
} }
Simtype[s.etype] = sameas simtype[s.etype] = sameas
minfltval[s.etype] = minfltval[sameas] minfltval[s.etype] = minfltval[sameas]
maxfltval[s.etype] = maxfltval[sameas] maxfltval[s.etype] = maxfltval[sameas]
Minintval[s.etype] = Minintval[sameas] minintval[s.etype] = minintval[sameas]
Maxintval[s.etype] = Maxintval[sameas] maxintval[s.etype] = maxintval[sameas]
t := typ(s.etype) t := typ(s.etype)
t.Sym = s1 t.Sym = s1
......
...@@ -1193,7 +1193,7 @@ opswitch: ...@@ -1193,7 +1193,7 @@ opswitch:
// rewrite complex div into function call. // rewrite complex div into function call.
et := n.Left.Type.Etype et := n.Left.Type.Etype
if Iscomplex[et] && n.Op == ODIV { if isComplex[et] && n.Op == ODIV {
t := n.Type t := n.Type
n = mkcall("complex128div", Types[TCOMPLEX128], init, conv(n.Left, Types[TCOMPLEX128]), conv(n.Right, Types[TCOMPLEX128])) n = mkcall("complex128div", Types[TCOMPLEX128], init, conv(n.Left, Types[TCOMPLEX128]), conv(n.Right, Types[TCOMPLEX128]))
n = conv(n, t) n = conv(n, t)
...@@ -1201,7 +1201,7 @@ opswitch: ...@@ -1201,7 +1201,7 @@ opswitch:
} }
// Nothing to do for float divisions. // Nothing to do for float divisions.
if Isfloat[et] { if isFloat[et] {
break break
} }
...@@ -1276,7 +1276,7 @@ opswitch: ...@@ -1276,7 +1276,7 @@ opswitch:
} }
if Isconst(n.Right, CTINT) { if Isconst(n.Right, CTINT) {
if n.Right.Val().U.(*Mpint).CmpInt64(0) < 0 || n.Right.Val().U.(*Mpint).Cmp(Maxintval[TINT]) > 0 { if n.Right.Val().U.(*Mpint).CmpInt64(0) < 0 || n.Right.Val().U.(*Mpint).Cmp(maxintval[TINT]) > 0 {
yyerror("index out of bounds") yyerror("index out of bounds")
} }
} }
...@@ -1523,8 +1523,8 @@ opswitch: ...@@ -1523,8 +1523,8 @@ opswitch:
// typechecking guarantees that TIDEAL len/cap are positive and fit in an int. // typechecking guarantees that TIDEAL len/cap are positive and fit in an int.
// The case of len or cap overflow when converting TUINT or TUINTPTR to TINT // The case of len or cap overflow when converting TUINT or TUINTPTR to TINT
// will be handled by the negative range checks in makeslice during runtime. // will be handled by the negative range checks in makeslice during runtime.
if (len.Type.IsKind(TIDEAL) || Maxintval[len.Type.Etype].Cmp(Maxintval[TUINT]) <= 0) && if (len.Type.IsKind(TIDEAL) || maxintval[len.Type.Etype].Cmp(maxintval[TUINT]) <= 0) &&
(cap.Type.IsKind(TIDEAL) || Maxintval[cap.Type.Etype].Cmp(Maxintval[TUINT]) <= 0) { (cap.Type.IsKind(TIDEAL) || maxintval[cap.Type.Etype].Cmp(maxintval[TUINT]) <= 0) {
fnname = "makeslice" fnname = "makeslice"
argtype = Types[TINT] argtype = Types[TINT]
} }
...@@ -2063,7 +2063,7 @@ func walkprint(nn *Node, init *Nodes) *Node { ...@@ -2063,7 +2063,7 @@ func walkprint(nn *Node, init *Nodes) *Node {
} else if n.Type.IsSlice() { } else if n.Type.IsSlice() {
on = syslook("printslice") on = syslook("printslice")
on = substArgTypes(on, n.Type) // any-1 on = substArgTypes(on, n.Type) // any-1
} else if Isint[et] { } else if isInt[et] {
if et == TUINT64 { if et == TUINT64 {
if (t.Sym.Pkg == Runtimepkg || compiling_runtime) && t.Sym.Name == "hex" { if (t.Sym.Pkg == Runtimepkg || compiling_runtime) && t.Sym.Name == "hex" {
on = syslook("printhex") on = syslook("printhex")
...@@ -2073,9 +2073,9 @@ func walkprint(nn *Node, init *Nodes) *Node { ...@@ -2073,9 +2073,9 @@ func walkprint(nn *Node, init *Nodes) *Node {
} else { } else {
on = syslook("printint") on = syslook("printint")
} }
} else if Isfloat[et] { } else if isFloat[et] {
on = syslook("printfloat") on = syslook("printfloat")
} else if Iscomplex[et] { } else if isComplex[et] {
on = syslook("printcomplex") on = syslook("printcomplex")
} else if et == TBOOL { } else if et == TBOOL {
on = syslook("printbool") on = syslook("printbool")
...@@ -3501,7 +3501,7 @@ func walkinrange(n *Node, init *Nodes) *Node { ...@@ -3501,7 +3501,7 @@ func walkinrange(n *Node, init *Nodes) *Node {
// We need a ≤ b && ... to safely use unsigned comparison tricks. // We need a ≤ b && ... to safely use unsigned comparison tricks.
// If a is not the maximum constant for b's type, // If a is not the maximum constant for b's type,
// we can increment a and switch to ≤. // we can increment a and switch to ≤.
if a.Int64() >= Maxintval[b.Type.Etype].Int64() { if a.Int64() >= maxintval[b.Type.Etype].Int64() {
return n return n
} }
a = nodintconst(a.Int64() + 1) a = nodintconst(a.Int64() + 1)
...@@ -3675,7 +3675,7 @@ func walkdiv(n *Node, init *Nodes) *Node { ...@@ -3675,7 +3675,7 @@ func walkdiv(n *Node, init *Nodes) *Node {
goto ret goto ret
} }
switch Simtype[nl.Type.Etype] { switch simtype[nl.Type.Etype] {
default: default:
return n return n
...@@ -3689,7 +3689,7 @@ func walkdiv(n *Node, init *Nodes) *Node { ...@@ -3689,7 +3689,7 @@ func walkdiv(n *Node, init *Nodes) *Node {
if m.Ua != 0 { if m.Ua != 0 {
// Select a Go type with (at least) twice the width. // Select a Go type with (at least) twice the width.
var twide *Type var twide *Type
switch Simtype[nl.Type.Etype] { switch simtype[nl.Type.Etype] {
default: default:
return n return n
...@@ -3780,7 +3780,7 @@ func walkdiv(n *Node, init *Nodes) *Node { ...@@ -3780,7 +3780,7 @@ func walkdiv(n *Node, init *Nodes) *Node {
// nl & (2^pow-1) is (nl+1)%2^pow - 1. // nl & (2^pow-1) is (nl+1)%2^pow - 1.
var nc Node var nc Node
Nodconst(&nc, Types[Simtype[TUINT]], int64(w)-1) Nodconst(&nc, Types[simtype[TUINT]], int64(w)-1)
n1 := Nod(ORSH, nl, &nc) // n1 = -1 iff nl < 0. n1 := Nod(ORSH, nl, &nc) // n1 = -1 iff nl < 0.
if pow == 1 { if pow == 1 {
n1 = typecheck(n1, Erv) n1 = typecheck(n1, Erv)
...@@ -3814,7 +3814,7 @@ func walkdiv(n *Node, init *Nodes) *Node { ...@@ -3814,7 +3814,7 @@ func walkdiv(n *Node, init *Nodes) *Node {
// if nl < 0, we want to add 2^n-1 first. // if nl < 0, we want to add 2^n-1 first.
var nc Node var nc Node
Nodconst(&nc, Types[Simtype[TUINT]], int64(w)-1) Nodconst(&nc, Types[simtype[TUINT]], int64(w)-1)
n1 := Nod(ORSH, nl, &nc) // n1 = -1 iff nl < 0. n1 := Nod(ORSH, nl, &nc) // n1 = -1 iff nl < 0.
if pow == 1 { if pow == 1 {
// nl+1 is nl-(-1) // nl+1 is nl-(-1)
...@@ -3823,7 +3823,7 @@ func walkdiv(n *Node, init *Nodes) *Node { ...@@ -3823,7 +3823,7 @@ func walkdiv(n *Node, init *Nodes) *Node {
// Do a logical right right on -1 to keep pow bits. // Do a logical right right on -1 to keep pow bits.
var nc Node var nc Node
Nodconst(&nc, Types[Simtype[TUINT]], int64(w)-int64(pow)) Nodconst(&nc, Types[simtype[TUINT]], int64(w)-int64(pow))
n2 := Nod(ORSH, conv(n1, nl.Type.toUnsigned()), &nc) n2 := Nod(ORSH, conv(n1, nl.Type.toUnsigned()), &nc)
n.Left = Nod(OADD, nl, conv(n2, nl.Type)) n.Left = Nod(OADD, nl, conv(n2, nl.Type))
} }
...@@ -3832,7 +3832,7 @@ func walkdiv(n *Node, init *Nodes) *Node { ...@@ -3832,7 +3832,7 @@ func walkdiv(n *Node, init *Nodes) *Node {
n.Op = ORSH n.Op = ORSH
var n2 Node var n2 Node
Nodconst(&n2, Types[Simtype[TUINT]], int64(pow)) Nodconst(&n2, Types[simtype[TUINT]], int64(pow))
n.Right = &n2 n.Right = &n2
n.Typecheck = 0 n.Typecheck = 0
} }
...@@ -3853,7 +3853,7 @@ func walkdiv(n *Node, init *Nodes) *Node { ...@@ -3853,7 +3853,7 @@ func walkdiv(n *Node, init *Nodes) *Node {
// n = nl >> pow // n = nl >> pow
n.Op = ORSH n.Op = ORSH
Nodconst(&nc, Types[Simtype[TUINT]], int64(pow)) Nodconst(&nc, Types[simtype[TUINT]], int64(pow))
} }
n.Typecheck = 0 n.Typecheck = 0
......
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