// Needed by the prettyprinter code for interface inspection.
for _, typ := range []string{
"type:runtime._type",
- "type:runtime.arraytype",
+ "type:internal/abi.ArrayType",
"type:runtime.chantype",
"type:runtime.functype",
"type:runtime.maptype",
}
want := map[string]bool{
- "runtime._type": true,
- "runtime.arraytype": true,
+ "runtime._type": true,
+ // "runtime.arraytype": true,
"runtime.chantype": true,
"runtime.functype": true,
"runtime.maptype": true,
)
// arrayType represents a fixed array type.
-type arrayType struct {
- rtype
- elem *rtype // array element type
- slice *rtype // slice type
- len uintptr
-}
+type arrayType = abi.ArrayType
// chanType represents a channel type.
type chanType struct {
switch t.Kind() {
case Array:
tt := (*arrayType)(unsafe.Pointer(t))
- return toType(tt.elem)
+ return toType((*rtype)(tt.Elem))
case Chan:
tt := (*chanType)(unsafe.Pointer(t))
return toType(tt.elem)
panic("reflect: Len of non-array type")
}
tt := (*arrayType)(unsafe.Pointer(t))
- return int(tt.len)
+ return int(tt.Len)
}
func (t *rtype) NumField() int {
switch k {
case Array:
tt := (*arrayType)(unsafe.Pointer(v.typ))
- return int(tt.len)
+ return int(tt.Len)
case Chan:
return chanlen(v.pointer())
case Map:
return a.assignIntN(offset, goarch.PtrSize, 3, 0b001)
case Array:
tt := (*arrayType)(unsafe.Pointer(t))
- switch tt.len {
+ switch tt.Len {
case 0:
// There's nothing to assign, so don't modify
// a.steps but succeed so the caller doesn't
// try to stack-assign this value.
return true
case 1:
- return a.regAssign(tt.elem, offset)
+ return a.regAssign((*rtype)(tt.Elem), offset)
default:
return false
}
)
// arrayType represents a fixed array type.
-type arrayType struct {
- rtype
- elem *rtype // array element type
- slice *rtype // slice type
- len uintptr
-}
+type arrayType = abi.ArrayType
// chanType represents a channel type.
type chanType struct {
switch t.Kind() {
case Array:
tt := (*arrayType)(unsafe.Pointer(t))
- return toType(tt.elem)
+ return toType((*rtype)(tt.Elem))
case Chan:
tt := (*chanType)(unsafe.Pointer(t))
return toType(tt.elem)
panic("reflect: Len of non-array type " + t.String())
}
tt := (*arrayType)(unsafe.Pointer(t))
- return int(tt.len)
+ return int(tt.Len)
}
func (t *rtype) NumField() int {
return false
case Array:
tt := (*arrayType)(unsafe.Pointer(t))
- return isReflexive(tt.elem)
+ return isReflexive((*rtype)(tt.Elem))
case Struct:
tt := (*structType)(unsafe.Pointer(t))
for _, f := range tt.fields {
return true
case Array:
tt := (*arrayType)(unsafe.Pointer(t))
- return needKeyUpdate(tt.elem)
+ return needKeyUpdate((*rtype)(tt.Elem))
case Struct:
tt := (*structType)(unsafe.Pointer(t))
for _, f := range tt.fields {
return true
case Array:
tt := (*arrayType)(unsafe.Pointer(t))
- return hashMightPanic(tt.elem)
+ return hashMightPanic((*rtype)(tt.Elem))
case Struct:
tt := (*structType)(unsafe.Pointer(t))
for _, f := range tt.fields {
s := "[" + strconv.Itoa(length) + "]" + typ.String()
for _, tt := range typesByString(s) {
array := (*arrayType)(unsafe.Pointer(tt))
- if array.elem == typ {
+ if (*rtype)(array.Elem) == typ {
ti, _ := lookupCache.LoadOrStore(ckey, tt)
return ti.(Type)
}
array.Hash = fnv1(array.Hash, byte(n))
}
array.Hash = fnv1(array.Hash, ']')
- array.elem = typ
+ array.Elem = (*abi.Type)(typ)
array.PtrToThis = 0
if typ.Size_ > 0 {
max := ^uintptr(0) / typ.Size_
}
array.Align_ = typ.Align_
array.FieldAlign_ = typ.FieldAlign_
- array.len = uintptr(length)
- array.slice = SliceOf(elem).(*rtype)
+ array.Len = uintptr(length)
+ array.Slice = (*abi.Type)(SliceOf(elem).(*rtype))
switch {
case typ.PtrBytes == 0 || array.Size_ == 0:
// Runtime needs pointer masks to be a multiple of uintptr in size.
n = (n + goarch.PtrSize - 1) &^ (goarch.PtrSize - 1)
mask := make([]byte, n)
- emitGCMask(mask, 0, typ, array.len)
+ emitGCMask(mask, 0, typ, array.Len)
array.GCData = &mask[0]
default:
array.Kind_ &^= kindDirectIface
}
- ti, _ := lookupCache.LoadOrStore(ckey, &array.rtype)
+ ti, _ := lookupCache.LoadOrStore(ckey, (*rtype)(&array.Type))
return ti.(Type)
}
case Array:
// repeat inner type
tt := (*arrayType)(unsafe.Pointer(t))
- for i := 0; i < int(tt.len); i++ {
- addTypeBits(bv, offset+uintptr(i)*tt.elem.Size_, tt.elem)
+ for i := 0; i < int(tt.Len); i++ {
+ addTypeBits(bv, offset+uintptr(i)*tt.Elem.Size_, (*rtype)(tt.Elem))
}
case Struct:
panic("reflect.Value.Bytes of unaddressable byte array")
}
p := (*byte)(v.ptr)
- n := int((*arrayType)(unsafe.Pointer(v.typ)).len)
+ n := int((*arrayType)(unsafe.Pointer(v.typ)).Len)
return unsafe.Slice(p, n)
}
panic(&ValueError{"reflect.Value.Bytes", v.kind()})
switch v.kind() {
case Array:
tt := (*arrayType)(unsafe.Pointer(v.typ))
- if uint(i) >= uint(tt.len) {
+ if uint(i) >= uint(tt.Len) {
panic("reflect: array index out of range")
}
- typ := tt.elem
+ typ := (*rtype)(tt.Elem)
offset := uintptr(i) * typ.Size_
// Either flagIndir is set and v.ptr points at array,
switch k := v.kind(); k {
case Array:
tt := (*arrayType)(unsafe.Pointer(v.typ))
- return int(tt.len)
+ return int(tt.Len)
case Chan:
return chanlen(v.pointer())
case Map:
panic("reflect.Value.Slice: slice of unaddressable array")
}
tt := (*arrayType)(unsafe.Pointer(v.typ))
- cap = int(tt.len)
- typ = (*sliceType)(unsafe.Pointer(tt.slice))
+ cap = int(tt.Len)
+ typ = (*sliceType)(unsafe.Pointer(tt.Slice))
base = v.ptr
case Slice:
panic("reflect.Value.Slice3: slice of unaddressable array")
}
tt := (*arrayType)(unsafe.Pointer(v.typ))
- cap = int(tt.len)
- typ = (*sliceType)(unsafe.Pointer(tt.slice))
+ cap = int(tt.Len)
+ typ = (*sliceType)(unsafe.Pointer(tt.Slice))
base = v.ptr
case Slice:
return interhash(p, h)
case kindArray:
a := (*arraytype)(unsafe.Pointer(t))
- for i := uintptr(0); i < a.len; i++ {
- h = typehash(a.elem, add(p, i*a.elem.Size_), h)
+ for i := uintptr(0); i < a.Len; i++ {
+ h = typehash((*_type)(a.Elem), add(p, i*a.Elem.Size_), h)
}
return h
case kindStruct:
case kindArray:
at := (*arraytype)(unsafe.Pointer(t))
if !indir {
- if at.len != 1 {
+ if at.Len != 1 {
throw("can't happen")
}
- cgoCheckArg(at.elem, p, at.elem.Kind_&kindDirectIface == 0, top, msg)
+ cgoCheckArg((*_type)(at.Elem), p, at.Elem.Kind_&kindDirectIface == 0, top, msg)
return
}
- for i := uintptr(0); i < at.len; i++ {
- cgoCheckArg(at.elem, p, true, top, msg)
- p = add(p, at.elem.Size_)
+ for i := uintptr(0); i < at.Len; i++ {
+ cgoCheckArg((*_type)(at.Elem), p, true, top, msg)
+ p = add(p, at.Elem.Size_)
}
case kindChan, kindMap:
// These types contain internal pointers that will
throw("can't happen")
case kindArray:
at := (*arraytype)(unsafe.Pointer(typ))
- for i := uintptr(0); i < at.len; i++ {
- if off < at.elem.Size_ {
- cgoCheckUsingType(at.elem, src, off, size)
+ for i := uintptr(0); i < at.Len; i++ {
+ if off < at.Elem.Size_ {
+ cgoCheckUsingType((*_type)(at.Elem), src, off, size)
}
- src = add(src, at.elem.Size_)
+ src = add(src, at.Elem.Size_)
skipped := off
- if skipped > at.elem.Size_ {
- skipped = at.elem.Size_
+ if skipped > at.Elem.Size_ {
+ skipped = at.Elem.Size_
}
- checked := at.elem.Size_ - skipped
+ checked := at.Elem.Size_ - skipped
off -= skipped
if size <= checked {
return
}
case kindArray:
at := (*arraytype)(unsafe.Pointer(t))
- if at.len == 1 {
- return p.tryRegAssignArg(at.elem, offset)
+ if at.Len == 1 {
+ return p.tryRegAssignArg((*_type)(at.Elem), offset)
}
case kindStruct:
st := (*structtype)(unsafe.Pointer(t))
return mt.flags&16 != 0
}
-type arraytype struct {
- typ _type
- elem *_type
- slice *_type
- len uintptr
-}
+type arraytype = abi.ArrayType
type chantype struct {
typ _type
case kindArray:
at := (*arraytype)(unsafe.Pointer(t))
av := (*arraytype)(unsafe.Pointer(v))
- return typesEqual(at.elem, av.elem, seen) && at.len == av.len
+ return typesEqual((*_type)(at.Elem), (*_type)(av.Elem), seen) && at.Len == av.Len
case kindChan:
ct := (*chantype)(unsafe.Pointer(t))
cv := (*chantype)(unsafe.Pointer(v))