aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/ld/deadcode.go
diff options
context:
space:
mode:
authorqiulaidongfeng <2645477756@qq.com>2024-04-02 13:08:24 +0000
committerGopher Robot <gobot@golang.org>2024-04-02 15:10:48 +0000
commitdaaf1f222063174eb7f0938eee38f7f9f364263c (patch)
tree4187c39caf622b61276555ab72ad00f1145ad280 /src/cmd/link/internal/ld/deadcode.go
parente3ec1ca17e339e21ca50fbdb375b4294783bc385 (diff)
downloadgo-daaf1f222063174eb7f0938eee38f7f9f364263c.tar.gz
go-daaf1f222063174eb7f0938eee38f7f9f364263c.zip
all: use kind* of abi
For #59670 Change-Id: Id66e102f13e529dd041b68ce869026a56f0a1b9b GitHub-Last-Rev: 43aa9376f72bc02a9d86518cdc99494a6b2f8573 GitHub-Pull-Request: golang/go#65564 Reviewed-on: https://go-review.googlesource.com/c/go/+/562298 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Austin Clements <austin@google.com>
Diffstat (limited to 'src/cmd/link/internal/ld/deadcode.go')
-rw-r--r--src/cmd/link/internal/ld/deadcode.go21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/cmd/link/internal/ld/deadcode.go b/src/cmd/link/internal/ld/deadcode.go
index de4395d5df..f635d7582f 100644
--- a/src/cmd/link/internal/ld/deadcode.go
+++ b/src/cmd/link/internal/ld/deadcode.go
@@ -11,6 +11,7 @@ import (
"cmd/link/internal/loader"
"cmd/link/internal/sym"
"fmt"
+ "internal/abi"
"internal/buildcfg"
"strings"
"unicode"
@@ -511,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 decodetypeKind(arch, p)&kindMask != kindInterface {
+ if abi.Kind(decodetypeKind(arch, p)&abi.KindMask) != abi.Interface {
panic(fmt.Sprintf("symbol %q is not an interface", ldr.SymName(symIdx)))
}
relocs := ldr.Relocs(symIdx)
@@ -532,22 +533,22 @@ 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 decodetypeKind(arch, p) & kindMask {
- case kindStruct: // reflect.structType
+ switch abi.Kind(decodetypeKind(arch, p) & abi.KindMask) {
+ case abi.Struct: // reflect.structType
off += 4 * arch.PtrSize
- case kindPtr: // reflect.ptrType
+ case abi.Pointer: // reflect.ptrType
off += arch.PtrSize
- case kindFunc: // reflect.funcType
+ case abi.Func: // reflect.funcType
off += arch.PtrSize // 4 bytes, pointer aligned
- case kindSlice: // reflect.sliceType
+ case abi.Slice: // reflect.sliceType
off += arch.PtrSize
- case kindArray: // reflect.arrayType
+ case abi.Array: // reflect.arrayType
off += 3 * arch.PtrSize
- case kindChan: // reflect.chanType
+ case abi.Chan: // reflect.chanType
off += 2 * arch.PtrSize
- case kindMap: // reflect.mapType
+ case abi.Map: // reflect.mapType
off += 4*arch.PtrSize + 8
- case kindInterface: // reflect.interfaceType
+ case abi.Interface: // reflect.interfaceType
off += 3 * arch.PtrSize
default:
// just Sizeof(rtype)