return ret
}
-// typeptrsize returns the length in bytes of the prefix of t
+// typeptrdata returns the length in bytes of the prefix of t
// containing pointer data. Anything after this offset is scalar data.
-func typeptrsize(t *Type) uint64 {
+func typeptrdata(t *Type) uint64 {
if !haspointers(t) {
return 0
}
return uint64(Widthptr)
}
// haspointers already eliminated t.Bound == 0.
- return uint64(t.Bound-1)*uint64(t.Type.Width) + typeptrsize(t.Type)
+ return uint64(t.Bound-1)*uint64(t.Type.Width) + typeptrdata(t.Type)
case TSTRUCT:
// Find the last field that has pointers.
lastPtrField = t1
}
}
- return uint64(lastPtrField.Width) + typeptrsize(lastPtrField.Type)
+ return uint64(lastPtrField.Width) + typeptrdata(lastPtrField.Type)
default:
- Fatal("typeptrsize: unexpected type, %v", t)
+ Fatal("typeptrdata: unexpected type, %v", t)
return 0
}
}
// zero unsafe.Pointer
// }
ot = duintptr(s, ot, uint64(t.Width))
- ot = duintptr(s, ot, typeptrsize(t))
+ ot = duintptr(s, ot, typeptrdata(t))
ot = duint32(s, ot, typehash(t))
ot = duint8(s, ot, 0) // unused
// so that code cannot convert from, say, *arrayType to *ptrType.
type rtype struct {
size uintptr
- ptrsize uintptr
+ ptrdata uintptr
hash uint32 // hash of type; avoids computation in hash tables
_ uint8 // unused/padding
align uint8 // alignment of variable with this type
}
// overflow
gc.append(bitsPointer)
- tptrsize := gc.size
+ ptrdata := gc.size
if runtime.GOARCH == "amd64p32" {
gc.append(bitsScalar)
}
b := new(rtype)
b.size = gc.size
- b.ptrsize = tptrsize
+ b.ptrdata = ptrdata
b.kind = kind
b.gc[0], _ = gc.finalize()
s := "bucket(" + *ktyp.string + "," + *etyp.string + ")"
panic("reflect.ArrayOf: array size would exceed virtual address space")
}
array.size = typ.size * uintptr(count)
- if count > 0 && typ.ptrsize != 0 {
- array.ptrsize = typ.size*uintptr(count-1) + typ.ptrsize
+ if count > 0 && typ.ptrdata != 0 {
+ array.ptrdata = typ.size*uintptr(count-1) + typ.ptrdata
}
array.align = typ.align
array.fieldAlign = typ.fieldAlign
// build dummy rtype holding gc program
x := new(rtype)
x.size = gc.size
- x.ptrsize = gc.size // over-approximation
+ x.ptrdata = gc.size // over-approximation
var hasPtr bool
x.gc[0], hasPtr = gc.finalize()
if !hasPtr {