1
2
3
4
5 package abi
6
7 import "internal/goarch"
8
9 type InterfaceSwitch struct {
10 Cache *InterfaceSwitchCache
11 NCases int
12
13
14
15 Cases [1]*InterfaceType
16 }
17
18 type InterfaceSwitchCache struct {
19 Mask uintptr
20 Entries [1]InterfaceSwitchCacheEntry
21 }
22
23 type InterfaceSwitchCacheEntry struct {
24
25 Typ uintptr
26
27 Case int
28
29 Itab uintptr
30 }
31
32 func UseInterfaceSwitchCache(arch goarch.ArchFamilyType) bool {
33
34
35 switch arch {
36 case goarch.AMD64, goarch.ARM64, goarch.LOONG64, goarch.MIPS, goarch.MIPS64, goarch.PPC64, goarch.RISCV64, goarch.S390X:
37 return true
38 default:
39 return false
40 }
41 }
42
43 type TypeAssert struct {
44 Cache *TypeAssertCache
45 Inter *InterfaceType
46 CanFail bool
47 }
48 type TypeAssertCache struct {
49 Mask uintptr
50 Entries [1]TypeAssertCacheEntry
51 }
52 type TypeAssertCacheEntry struct {
53
54 Typ uintptr
55
56
57 Itab uintptr
58 }
59
View as plain text