cmd/compile: use descriptors for type assertion runtime calls

Mostly a reorganization to make further changes easier.

This reorganization will make it easier to add a cache in front
of the runtime call.

Leave the old code alone for dynamic type assertions (aka generics).

Change-Id: Ia7dcb7aeb1f63baf93584ccd792e8e31510e8aea
Reviewed-on: https://go-review.googlesource.com/c/go/+/529196
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
This commit is contained in:
Keith Randall 2023-09-18 10:13:18 -07:00
parent 7499257016
commit b455e239ae
9 changed files with 119 additions and 35 deletions

View file

@ -673,6 +673,9 @@ type TypeAssertExpr struct {
// Runtime type information provided by walkDotType for
// assertions from non-empty interface to concrete type.
ITab Node `mknode:"-"` // *runtime.itab for Type implementing X's type
// An internal/abi.TypeAssert descriptor to pass to the runtime.
Descriptor *obj.LSym
}
func NewTypeAssertExpr(pos src.XPos, x Node, typ *types.Type) *TypeAssertExpr {