cmd/compile: avoid ifaceeq call if we know the interface is direct

We can just use == if the interface is direct.

Fixes #70738

Change-Id: Ia9a644791a370fec969c04c42d28a9b58f16911f
Reviewed-on: https://go-review.googlesource.com/c/go/+/635435
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Keith Randall 2024-12-09 12:55:33 -08:00 committed by Gopher Robot
parent c8664ced4e
commit 072eea9b3b
7 changed files with 230 additions and 8 deletions

View file

@ -603,6 +603,22 @@ func (s *LSym) NewTypeInfo() *TypeInfo {
return t
}
// An ItabInfo contains information for a symbol
// that contains a runtime.itab.
type ItabInfo struct {
Type interface{} // a *cmd/compile/internal/types.Type
}
func (s *LSym) NewItabInfo() *ItabInfo {
if s.Extra != nil {
panic(fmt.Sprintf("invalid use of LSym - NewItabInfo with Extra of type %T", *s.Extra))
}
t := new(ItabInfo)
s.Extra = new(interface{})
*s.Extra = t
return t
}
// WasmImport represents a WebAssembly (WASM) imported function with
// parameters and results translated into WASM types based on the Go function
// declaration.