Skip to content

Commit f07059d

Browse files
DQNEOodeke-em
authored andcommitted
cmd/compile: rename sizeof_Array and array_* to slice_*
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 <[email protected]> Run-TryBot: Emmanuel Odeke <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 47bc240 commit f07059d

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

src/cmd/compile/internal/gc/align.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ func dowidth(t *types.Type) {
344344
if t.Elem() == nil {
345345
break
346346
}
347-
w = int64(sizeof_Array)
347+
w = int64(sizeof_Slice)
348348
checkwidth(t.Elem())
349349
t.Align = uint8(Widthptr)
350350

src/cmd/compile/internal/gc/go.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,21 @@ const (
6565
)
6666

6767
// note this is the runtime representation
68-
// of the compilers arrays.
68+
// of the compilers slices.
6969
//
7070
// typedef struct
7171
// { // must not move anything
7272
// uchar array[8]; // pointer to data
7373
// uchar nel[4]; // number of elements
7474
// uchar cap[4]; // allocated number of elements
75-
// } Array;
76-
var array_array int // runtime offsetof(Array,array) - same for String
75+
// } Slice;
76+
var slice_array int // runtime offsetof(Slice,array) - same for String
7777

78-
var array_nel int // runtime offsetof(Array,nel) - same for String
78+
var slice_nel int // runtime offsetof(Slice,nel) - same for String
7979

80-
var array_cap int // runtime offsetof(Array,cap)
80+
var slice_cap int // runtime offsetof(Slice,cap)
8181

82-
var sizeof_Array int // runtime sizeof(Array)
82+
var sizeof_Slice int // runtime sizeof(Slice)
8383

8484
// note this is the runtime representation
8585
// of the compilers strings.

src/cmd/compile/internal/gc/sinit.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,11 @@ func (s *InitSchedule) staticcopy(l *Node, r *Node) bool {
130130
a := s.inittemps[r]
131131

132132
n := l.copy()
133-
n.Xoffset = l.Xoffset + int64(array_array)
133+
n.Xoffset = l.Xoffset + int64(slice_array)
134134
gdata(n, nod(OADDR, a, nil), Widthptr)
135-
n.Xoffset = l.Xoffset + int64(array_nel)
135+
n.Xoffset = l.Xoffset + int64(slice_nel)
136136
gdata(n, r.Right, Widthptr)
137-
n.Xoffset = l.Xoffset + int64(array_cap)
137+
n.Xoffset = l.Xoffset + int64(slice_cap)
138138
gdata(n, r.Right, Widthptr)
139139
return true
140140

@@ -227,11 +227,11 @@ func (s *InitSchedule) staticassign(l *Node, r *Node) bool {
227227
a := staticname(ta)
228228
s.inittemps[r] = a
229229
n := l.copy()
230-
n.Xoffset = l.Xoffset + int64(array_array)
230+
n.Xoffset = l.Xoffset + int64(slice_array)
231231
gdata(n, nod(OADDR, a, nil), Widthptr)
232-
n.Xoffset = l.Xoffset + int64(array_nel)
232+
n.Xoffset = l.Xoffset + int64(slice_nel)
233233
gdata(n, r.Right, Widthptr)
234-
n.Xoffset = l.Xoffset + int64(array_cap)
234+
n.Xoffset = l.Xoffset + int64(slice_cap)
235235
gdata(n, r.Right, Widthptr)
236236

237237
// Fall through to init underlying array.
@@ -615,11 +615,11 @@ func slicelit(ctxt initContext, n *Node, var_ *Node, init *Nodes) {
615615
v.Type = types.Types[TINT]
616616
setintconst(&v, t.NumElem())
617617

618-
nam.Xoffset += int64(array_array)
618+
nam.Xoffset += int64(slice_array)
619619
gdata(&nam, nod(OADDR, vstat, nil), Widthptr)
620-
nam.Xoffset += int64(array_nel) - int64(array_array)
620+
nam.Xoffset += int64(slice_nel) - int64(slice_array)
621621
gdata(&nam, &v, Widthptr)
622-
nam.Xoffset += int64(array_cap) - int64(array_nel)
622+
nam.Xoffset += int64(slice_cap) - int64(slice_nel)
623623
gdata(&nam, &v, Widthptr)
624624

625625
return

src/cmd/compile/internal/gc/ssa.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2815,7 +2815,7 @@ func (s *state) append(n *Node, inplace bool) *ssa.Value {
28152815
// Tell liveness we're about to build a new slice
28162816
s.vars[&memVar] = s.newValue1A(ssa.OpVarDef, types.TypeMem, sn, s.mem())
28172817
}
2818-
capaddr := s.newValue1I(ssa.OpOffPtr, s.f.Config.Types.IntPtr, int64(array_cap), addr)
2818+
capaddr := s.newValue1I(ssa.OpOffPtr, s.f.Config.Types.IntPtr, int64(slice_cap), addr)
28192819
s.store(types.Types[TINT], capaddr, r[2])
28202820
s.store(pt, addr, r[0])
28212821
// 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 {
28362836
if inplace {
28372837
l = s.variable(&lenVar, types.Types[TINT]) // generates phi for len
28382838
nl = s.newValue2(s.ssaOp(OADD, types.Types[TINT]), types.Types[TINT], l, s.constInt(types.Types[TINT], nargs))
2839-
lenaddr := s.newValue1I(ssa.OpOffPtr, s.f.Config.Types.IntPtr, int64(array_nel), addr)
2839+
lenaddr := s.newValue1I(ssa.OpOffPtr, s.f.Config.Types.IntPtr, int64(slice_nel), addr)
28402840
s.store(types.Types[TINT], lenaddr, nl)
28412841
}
28422842

src/cmd/compile/internal/gc/universe.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,13 +342,13 @@ func typeinit() {
342342
simtype[TFUNC] = TPTR
343343
simtype[TUNSAFEPTR] = TPTR
344344

345-
array_array = int(Rnd(0, int64(Widthptr)))
346-
array_nel = int(Rnd(int64(array_array)+int64(Widthptr), int64(Widthptr)))
347-
array_cap = int(Rnd(int64(array_nel)+int64(Widthptr), int64(Widthptr)))
348-
sizeof_Array = int(Rnd(int64(array_cap)+int64(Widthptr), int64(Widthptr)))
345+
slice_array = int(Rnd(0, int64(Widthptr)))
346+
slice_nel = int(Rnd(int64(slice_array)+int64(Widthptr), int64(Widthptr)))
347+
slice_cap = int(Rnd(int64(slice_nel)+int64(Widthptr), int64(Widthptr)))
348+
sizeof_Slice = int(Rnd(int64(slice_cap)+int64(Widthptr), int64(Widthptr)))
349349

350350
// string is same as slice wo the cap
351-
sizeof_String = int(Rnd(int64(array_nel)+int64(Widthptr), int64(Widthptr)))
351+
sizeof_String = int(Rnd(int64(slice_nel)+int64(Widthptr), int64(Widthptr)))
352352

353353
dowidth(types.Types[TSTRING])
354354
dowidth(types.Idealstring)

0 commit comments

Comments
 (0)