cmd/compile: split TSLICE into separate Type kind
Instead of using TARRAY for both arrays and slices, create a new
TSLICE kind to handle slices.
Also, get rid of the "DDDArray" distinction. While kinda ugly, it
seems likely we'll need to defer evaluating the constant bounds
expressions for golang.org/issue/13890.
Passes toolstash/buildall.
Change-Id: I8e45d4900e7df3a04cce59428ec8b38035d3cc3a
Reviewed-on: https://go-review.googlesource.com/22329
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/src/cmd/compile/internal/gc/gen.go b/src/cmd/compile/internal/gc/gen.go
index cc624cc..d16c4fa 100644
--- a/src/cmd/compile/internal/gc/gen.go
+++ b/src/cmd/compile/internal/gc/gen.go
@@ -1031,7 +1031,7 @@
// Emit vardef if needed.
if nl.Op == ONAME {
switch nl.Type.Etype {
- case TARRAY, TSTRING, TINTER, TSTRUCT:
+ case TARRAY, TSLICE, TSTRING, TINTER, TSTRUCT:
Gvardef(nl)
}
}
@@ -1204,13 +1204,12 @@
return f(Ptrto(Types[TUINT8]), startOffset) &&
f(Types[Simtype[TUINT]], startOffset+int64(Widthptr))
- case TARRAY:
- if t.IsSlice() {
- return f(Ptrto(t.Elem()), startOffset+int64(Array_array)) &&
- f(Types[Simtype[TUINT]], startOffset+int64(Array_nel)) &&
- f(Types[Simtype[TUINT]], startOffset+int64(Array_cap))
- }
+ case TSLICE:
+ return f(Ptrto(t.Elem()), startOffset+int64(Array_array)) &&
+ f(Types[Simtype[TUINT]], startOffset+int64(Array_nel)) &&
+ f(Types[Simtype[TUINT]], startOffset+int64(Array_cap))
+ case TARRAY:
// Short-circuit [1e6]struct{}.
if t.Elem().Width == 0 {
return true