From 72b6a89ca5cd3c3bfd13b9b17be976e8feb91ecc Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Thu, 21 Oct 2021 18:09:07 -0700 Subject: cmd/compile: revert most of CL 349169 The method of using references to dictionaries to hold methods live during linker deadcode elimination wasn't working very well. I implemented a new scheme in the CL below this, so this CL strips out the old method. The new method has the added benefit of having 0 runtime overhead (unlike the stuff we're ripping out here, which does have a small overhead). Update #48047 Change-Id: I68ac57119792d53c58f1480f407de6ab2bb53211 Reviewed-on: https://go-review.googlesource.com/c/go/+/357836 Trust: Keith Randall Trust: Dan Scales Run-TryBot: Keith Randall TryBot-Result: Go Bot Reviewed-by: Dan Scales --- src/cmd/compile/internal/noder/transform.go | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'src/cmd/compile/internal/noder/transform.go') diff --git a/src/cmd/compile/internal/noder/transform.go b/src/cmd/compile/internal/noder/transform.go index 29ee601d82..47e6397206 100644 --- a/src/cmd/compile/internal/noder/transform.go +++ b/src/cmd/compile/internal/noder/transform.go @@ -132,9 +132,7 @@ func transformConvCall(n *ir.CallExpr) ir.Node { // transformCall transforms a normal function/method call. Corresponds to last half // (non-conversion, non-builtin part) of typecheck.tcCall. This code should work even // in the case of OCALL/OFUNCINST. -// The dict parameter is used for OCALLINTER nodes to ensure that the called method -// is retained by the linker. -func transformCall(n *ir.CallExpr, dict *ir.Name) { +func transformCall(n *ir.CallExpr) { // n.Type() can be nil for calls with no return value assert(n.Typecheck() == 1) transformArgs(n) @@ -144,17 +142,6 @@ func transformCall(n *ir.CallExpr, dict *ir.Name) { switch l.Op() { case ir.ODOTINTER: n.SetOp(ir.OCALLINTER) - if n.X.(*ir.SelectorExpr).X.Type().HasShape() { - if dict == nil { - base.Fatalf("calls on shape interfaces need a dictionary reference") - } - dict.SetAddrtaken(true) - // KeepAlive isn't exactly the right thing here, as we only - // need to keep the dictionary live in the linker-deadcode - // sense, not the at-runtime sense. But the at-runtime sense - // is stronger, so it works. See issue 48047. - n.KeepAlive = append(n.KeepAlive, dict) - } case ir.ODOTMETH: l := l.(*ir.SelectorExpr) -- cgit v1.3