// The receiver is always one word.
a.valueStart = append(a.valueStart, len(a.steps))
var ok, ptr bool
- if ifaceIndir(rcvr) || rcvr.Pointers() {
+ if rcvr.IfaceIndir() || rcvr.Pointers() {
ok = a.assignIntN(0, goarch.PtrSize, 1, 0b1)
ptr = true
} else {
}
switch {
- case len(fs) == 1 && !ifaceIndir(fs[0].Typ):
+ case len(fs) == 1 && !fs[0].Typ.IfaceIndir():
// structs of 1 direct iface type can be direct
typ.Kind_ |= abi.KindDirectIface
default:
}
switch {
- case length == 1 && !ifaceIndir(typ):
+ case length == 1 && !typ.IfaceIndir():
// array of 1 direct iface type can be direct
array.Kind_ |= abi.KindDirectIface
default:
return lt.t, lt.framePool, lt.abid
}
-// ifaceIndir reports whether t is stored indirectly in an interface value.
-func ifaceIndir(t *abi.Type) bool {
- return t.Kind_&abi.KindDirectIface == 0
-}
-
// Note: this type must agree with runtime.bitvector.
type bitVector struct {
n uint32 // number of bits
}
// Handle pointers passed in registers.
- if !ifaceIndir(tv) {
+ if !tv.IfaceIndir() {
// Pointer-valued data gets put directly
// into v.ptr.
if steps[0].kind != abiStepPointer {
v := Value{typ, nil, flag(typ.Kind())}
steps := abid.call.stepsForValue(i)
if st := steps[0]; st.kind == abiStepStack {
- if ifaceIndir(typ) {
+ if typ.IfaceIndir() {
// value cannot be inlined in interface data.
// Must make a copy, because f might keep a reference to it,
// and we cannot let f keep a reference to the stack frame
v.ptr = *(*unsafe.Pointer)(add(ptr, st.stkOff, "1-ptr"))
}
} else {
- if ifaceIndir(typ) {
+ if typ.IfaceIndir() {
// All that's left is values passed in registers that we need to
// create space for the values.
v.flag |= flagIndir
// the interface data word becomes the receiver word
iface := (*nonEmptyInterface)(v.ptr)
*(*unsafe.Pointer)(p) = iface.word
- } else if v.flag&flagIndir != 0 && !ifaceIndir(t) {
+ } else if v.flag&flagIndir != 0 && !t.IfaceIndir() {
*(*unsafe.Pointer)(p) = *(*unsafe.Pointer)(v.ptr)
} else {
*(*unsafe.Pointer)(p) = v.ptr
case Pointer:
ptr := v.ptr
if v.flag&flagIndir != 0 {
- if ifaceIndir(v.typ()) {
+ if v.typ().IfaceIndir() {
// This is a pointer to a not-in-heap object. ptr points to a uintptr
// in the heap. That uintptr is the address of a not-in-heap object.
// In general, pointers to not-in-heap objects can be total junk.
t := tt.Elem
val = Value{t, nil, flag(t.Kind())}
var p unsafe.Pointer
- if ifaceIndir(t) {
+ if t.IfaceIndir() {
p = unsafe_New(t)
val.ptr = p
val.flag |= flagIndir
}
t := &typ.(*rtype).t
pt := ptrTo(t)
- if ifaceIndir(pt) {
+ if pt.IfaceIndir() {
// This is a pointer to a not-in-heap type.
panic("reflect: New of type that may not be allocated in heap (possibly undefined cgo C type)")
}