}
sval := ldr.SymValue(s)
- if decodetypeUsegcprog(p.ctxt.Arch, typData) == 0 {
+ if !decodetypeUsegcprog(p.ctxt.Arch, typData) {
// Copy pointers from mask into program.
mask := decodetypeGcmask(p.ctxt, typ)
for i := int64(0); i < nptr; i++ {
if p == nil {
panic(fmt.Sprintf("missing symbol %q", ldr.SymName(symIdx)))
}
- if abi.Kind(decodetypeKind(arch, p)&abi.KindMask) != abi.Interface {
+ if decodetypeKind(arch, p) != abi.Interface {
panic(fmt.Sprintf("symbol %q is not an interface", ldr.SymName(symIdx)))
}
relocs := ldr.Relocs(symIdx)
panic(fmt.Sprintf("no methods on %q", ldr.SymName(symIdx)))
}
off := commonsize(arch) // reflect.rtype
- switch abi.Kind(decodetypeKind(arch, p) & abi.KindMask) {
+ switch decodetypeKind(arch, p) {
case abi.Struct: // reflect.structType
off += 4 * arch.PtrSize
case abi.Pointer: // reflect.ptrType
func uncommonSize(arch *sys.Arch) int { return int(abi.UncommonSize()) } // runtime.uncommontype
// Type.commonType.kind
-func decodetypeKind(arch *sys.Arch, p []byte) uint8 {
- return p[2*arch.PtrSize+7] & abi.KindMask // 0x13 / 0x1f
+func decodetypeKind(arch *sys.Arch, p []byte) abi.Kind {
+ return abi.Kind(p[2*arch.PtrSize+7]) & abi.KindMask // 0x13 / 0x1f
}
// Type.commonType.kind
-func decodetypeUsegcprog(arch *sys.Arch, p []byte) uint8 {
- return p[2*arch.PtrSize+7] & abi.KindGCProg // 0x13 / 0x1f
+func decodetypeUsegcprog(arch *sys.Arch, p []byte) bool {
+ return abi.Kind(p[2*arch.PtrSize+7])&abi.KindGCProg != 0 // 0x13 / 0x1f
}
// Type.commonType.size
bytesize := decodetypeSize(d.arch, tdata)
var die, typedefdie *dwarf.DWDie
- switch abi.Kind(kind) {
+ switch kind {
case abi.Bool:
die = d.newdie(&dwtypes, dwarf.DW_ABRV_BASETYPE, name)
newattr(die, dwarf.DW_AT_encoding, dwarf.DW_CLS_CONSTANT, dwarf.DW_ATE_boolean, 0)
const (
// TODO (khr, drchase) why aren't these in TFlag? Investigate, fix if possible.
- KindDirectIface = 1 << 5
- KindGCProg = 1 << 6 // Type.gc points to GC program
- KindMask = (1 << 5) - 1
+ KindDirectIface Kind = 1 << 5
+ KindGCProg Kind = 1 << 6 // Type.gc points to GC program
+ KindMask Kind = (1 << 5) - 1
)
// TFlag is used by a Type to signal what extra type information is
UnsafePointer: "unsafe.Pointer",
}
-func (t *Type) Kind() Kind { return Kind(t.Kind_ & KindMask) }
+func (t *Type) Kind() Kind { return t.Kind_ & KindMask }
func (t *Type) HasName() bool {
return t.TFlag&TFlagNamed != 0
// ifaceIndir reports whether t is stored indirectly in an interface value.
func ifaceIndir(t *abi.Type) bool {
- return t.Kind_&abi.KindDirectIface == 0
+ return abi.Kind(t.Kind_)&abi.KindDirectIface == 0
}