internal/abi: clean up type of Kind and Type.Kind_

Currently, Type.Kind_ is a uint8, Kind is a uint, and some of the
abi.Kind consts are not of type Kind. Clean this all up by making Kind
a uint8, then making Type.Kind a Kind, and finally making all Kind
consts actually have type Kind. This has some ripple effect, but I
think all of the changes are improvements.

Change-Id: If39be74699c2cdb52bf0ad7092d392bc8fb68d15
Reviewed-on: https://go-review.googlesource.com/c/go/+/575579
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Austin Clements 2024-04-01 15:39:41 -04:00 committed by Gopher Robot
parent cb6d15a747
commit 94dba61276
6 changed files with 13 additions and 13 deletions

View file

@ -512,7 +512,7 @@ func (d *deadcodePass) decodeIfaceMethod(ldr *loader.Loader, arch *sys.Arch, sym
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)
@ -533,7 +533,7 @@ func (d *deadcodePass) decodetypeMethods(ldr *loader.Loader, arch *sys.Arch, sym
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