cmd/compile: remove unnecessary code in keepAliveAt

TypeWord and SrcRType are only needed for interface expression
conversion. Since CL 725180, the kept alive nodes are passed directly to
runtime.KeepAlive, so there's no interface conversion anymore.

Change-Id: I37ad8016bf76a1bf8ba36efea043fc71341b33c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/737840
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
This commit is contained in:
Cuong Manh Le 2026-01-21 15:20:27 +07:00 committed by Gopher Robot
parent dae71067ce
commit a535896627

View file

@ -39,7 +39,6 @@ package bloop
import (
"cmd/compile/internal/base"
"cmd/compile/internal/ir"
"cmd/compile/internal/reflectdata"
"cmd/compile/internal/typecheck"
"cmd/compile/internal/types"
"cmd/internal/src"
@ -117,11 +116,6 @@ func keepAliveAt(ns ir.Nodes, curNode ir.Node) ir.Node {
base.FatalfAt(n.Pos(), "keepAliveAt: node %v is not addressable", n)
}
arg := ir.NewConvExpr(pos, ir.OCONV, types.Types[types.TUNSAFEPTR], typecheck.NodAddr(n))
if !n.Type().IsInterface() {
srcRType0 := reflectdata.TypePtrAt(pos, n.Type())
arg.TypeWord = srcRType0
arg.SrcRType = srcRType0
}
callExpr := typecheck.Call(pos, typecheck.LookupRuntime("KeepAlive"), ir.Nodes{arg}, false).(*ir.CallExpr)
callExpr.IsCompilerVarLive = true
callExpr.NoInline = true