diff options
Diffstat (limited to 'vendor/github.com/bytedance/sonic/internal/rt/fastvalue.go')
-rw-r--r-- | vendor/github.com/bytedance/sonic/internal/rt/fastvalue.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/vendor/github.com/bytedance/sonic/internal/rt/fastvalue.go b/vendor/github.com/bytedance/sonic/internal/rt/fastvalue.go index 2b2757f5b..befaeb715 100644 --- a/vendor/github.com/bytedance/sonic/internal/rt/fastvalue.go +++ b/vendor/github.com/bytedance/sonic/internal/rt/fastvalue.go @@ -211,3 +211,24 @@ func findReflectRtypeItab() *GoItab { v := reflect.TypeOf(struct{}{}) return (*GoIface)(unsafe.Pointer(&v)).Itab } + +func AssertI2I2(t *GoType, i GoIface) (r GoIface) { + inter := IfaceType(t) + tab := i.Itab + if tab == nil { + return + } + if (*GoInterfaceType)(tab.it) != inter { + tab = Getitab(inter, tab.Vt, true) + if tab == nil { + return + } + } + r.Itab = tab + r.Value = i.Value + return +} + +//go:noescape +//go:linkname Getitab runtime.getitab +func Getitab(inter *GoInterfaceType, typ *GoType, canfail bool) *GoItab |