]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: rename sizeof_Array and array_* to slice_*
authorDQNEO <dqneoo@gmail.com>
Sat, 8 Jun 2019 12:40:20 +0000 (21:40 +0900)
committerEmmanuel Odeke <emm.odeke@gmail.com>
Mon, 11 Nov 2019 12:40:04 +0000 (12:40 +0000)
Renames variables sizeof_Array and other array_* variables
that were actually intended for slices and not arrays.

Change-Id: I391b95880cc77cabb8472efe694b7dd19545f31a
Reviewed-on: https://go-review.googlesource.com/c/go/+/180919
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/gc/align.go
src/cmd/compile/internal/gc/go.go
src/cmd/compile/internal/gc/sinit.go
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/gc/universe.go

index 78be1b231e9863a3cf881c52c9191be24b76fbee..ec66cb43922d412ac9c99227b0451eabe567adc6 100644 (file)
@@ -344,7 +344,7 @@ func dowidth(t *types.Type) {
                if t.Elem() == nil {
                        break
                }
-               w = int64(sizeof_Array)
+               w = int64(sizeof_Slice)
                checkwidth(t.Elem())
                t.Align = uint8(Widthptr)
 
index 025b276c20426066362358f4edbf8b166af359c6..50b866ca6544dcc79bd86e12d2c5334054bf9704 100644 (file)
@@ -65,21 +65,21 @@ const (
 )
 
 // note this is the runtime representation
-// of the compilers arrays.
+// of the compilers slices.
 //
 // typedef     struct
 // {                           // must not move anything
 //     uchar   array[8];       // pointer to data
 //     uchar   nel[4];         // number of elements
 //     uchar   cap[4];         // allocated number of elements
-// } Array;
-var array_array int // runtime offsetof(Array,array) - same for String
+// } Slice;
+var slice_array int // runtime offsetof(Slice,array) - same for String
 
-var array_nel int // runtime offsetof(Array,nel) - same for String
+var slice_nel int // runtime offsetof(Slice,nel) - same for String
 
-var array_cap int // runtime offsetof(Array,cap)
+var slice_cap int // runtime offsetof(Slice,cap)
 
-var sizeof_Array int // runtime sizeof(Array)
+var sizeof_Slice int // runtime sizeof(Slice)
 
 // note this is the runtime representation
 // of the compilers strings.
index 5f05a2c72f36ffc72d2f3709fabb52c29e157f38..d76201031c95daf93b18518f14695ff3a19f8bc3 100644 (file)
@@ -130,11 +130,11 @@ func (s *InitSchedule) staticcopy(l *Node, r *Node) bool {
                a := s.inittemps[r]
 
                n := l.copy()
-               n.Xoffset = l.Xoffset + int64(array_array)
+               n.Xoffset = l.Xoffset + int64(slice_array)
                gdata(n, nod(OADDR, a, nil), Widthptr)
-               n.Xoffset = l.Xoffset + int64(array_nel)
+               n.Xoffset = l.Xoffset + int64(slice_nel)
                gdata(n, r.Right, Widthptr)
-               n.Xoffset = l.Xoffset + int64(array_cap)
+               n.Xoffset = l.Xoffset + int64(slice_cap)
                gdata(n, r.Right, Widthptr)
                return true
 
@@ -227,11 +227,11 @@ func (s *InitSchedule) staticassign(l *Node, r *Node) bool {
                a := staticname(ta)
                s.inittemps[r] = a
                n := l.copy()
-               n.Xoffset = l.Xoffset + int64(array_array)
+               n.Xoffset = l.Xoffset + int64(slice_array)
                gdata(n, nod(OADDR, a, nil), Widthptr)
-               n.Xoffset = l.Xoffset + int64(array_nel)
+               n.Xoffset = l.Xoffset + int64(slice_nel)
                gdata(n, r.Right, Widthptr)
-               n.Xoffset = l.Xoffset + int64(array_cap)
+               n.Xoffset = l.Xoffset + int64(slice_cap)
                gdata(n, r.Right, Widthptr)
 
                // Fall through to init underlying array.
@@ -615,11 +615,11 @@ func slicelit(ctxt initContext, n *Node, var_ *Node, init *Nodes) {
                v.Type = types.Types[TINT]
                setintconst(&v, t.NumElem())
 
-               nam.Xoffset += int64(array_array)
+               nam.Xoffset += int64(slice_array)
                gdata(&nam, nod(OADDR, vstat, nil), Widthptr)
-               nam.Xoffset += int64(array_nel) - int64(array_array)
+               nam.Xoffset += int64(slice_nel) - int64(slice_array)
                gdata(&nam, &v, Widthptr)
-               nam.Xoffset += int64(array_cap) - int64(array_nel)
+               nam.Xoffset += int64(slice_cap) - int64(slice_nel)
                gdata(&nam, &v, Widthptr)
 
                return
index 48eb89bb3a626e04aa7e181933f0ebc06454ac17..bff038b39f7d92284454ed1660e85afc57e7f4c5 100644 (file)
@@ -2815,7 +2815,7 @@ func (s *state) append(n *Node, inplace bool) *ssa.Value {
                        // Tell liveness we're about to build a new slice
                        s.vars[&memVar] = s.newValue1A(ssa.OpVarDef, types.TypeMem, sn, s.mem())
                }
-               capaddr := s.newValue1I(ssa.OpOffPtr, s.f.Config.Types.IntPtr, int64(array_cap), addr)
+               capaddr := s.newValue1I(ssa.OpOffPtr, s.f.Config.Types.IntPtr, int64(slice_cap), addr)
                s.store(types.Types[TINT], capaddr, r[2])
                s.store(pt, addr, r[0])
                // load the value we just stored to avoid having to spill it
@@ -2836,7 +2836,7 @@ func (s *state) append(n *Node, inplace bool) *ssa.Value {
        if inplace {
                l = s.variable(&lenVar, types.Types[TINT]) // generates phi for len
                nl = s.newValue2(s.ssaOp(OADD, types.Types[TINT]), types.Types[TINT], l, s.constInt(types.Types[TINT], nargs))
-               lenaddr := s.newValue1I(ssa.OpOffPtr, s.f.Config.Types.IntPtr, int64(array_nel), addr)
+               lenaddr := s.newValue1I(ssa.OpOffPtr, s.f.Config.Types.IntPtr, int64(slice_nel), addr)
                s.store(types.Types[TINT], lenaddr, nl)
        }
 
index 2077c5639e7439c0a3f287613496a7128fc8ff31..9f4e4d96802ad28f2632ad25ca854a6d65d15ef0 100644 (file)
@@ -342,13 +342,13 @@ func typeinit() {
        simtype[TFUNC] = TPTR
        simtype[TUNSAFEPTR] = TPTR
 
-       array_array = int(Rnd(0, int64(Widthptr)))
-       array_nel = int(Rnd(int64(array_array)+int64(Widthptr), int64(Widthptr)))
-       array_cap = int(Rnd(int64(array_nel)+int64(Widthptr), int64(Widthptr)))
-       sizeof_Array = int(Rnd(int64(array_cap)+int64(Widthptr), int64(Widthptr)))
+       slice_array = int(Rnd(0, int64(Widthptr)))
+       slice_nel = int(Rnd(int64(slice_array)+int64(Widthptr), int64(Widthptr)))
+       slice_cap = int(Rnd(int64(slice_nel)+int64(Widthptr), int64(Widthptr)))
+       sizeof_Slice = int(Rnd(int64(slice_cap)+int64(Widthptr), int64(Widthptr)))
 
        // string is same as slice wo the cap
-       sizeof_String = int(Rnd(int64(array_nel)+int64(Widthptr), int64(Widthptr)))
+       sizeof_String = int(Rnd(int64(slice_nel)+int64(Widthptr), int64(Widthptr)))
 
        dowidth(types.Types[TSTRING])
        dowidth(types.Idealstring)