From c08b01ecb4488fb3a95fd5cc7baa8b31812e7b76 Mon Sep 17 00:00:00 2001 From: David Chase Date: Wed, 6 Jun 2018 12:38:35 -0400 Subject: cmd/compile: fix panic-okay-to-inline change; adjust tests This line of the inlining tuning experiment https://go-review.googlesource.com/c/go/+/109918/1/src/cmd/compile/internal/gc/inl.go#347 was incorrectly rewritten in a later patch to use the call cost, not the panic cost, and thus the inlining of panic didn't occur when it should. I discovered this when I realized that tests should have failed, but didn't. Fix is to make the correct change, and also to modify the tests that this causes to fail. One test now asserts the new normal, the other calls "ppanic" instead which is designed to behave like panic but not be inlined. Change-Id: I423bb7f08bd66a70d999826dd9b87027abf34cdf Reviewed-on: https://go-review.googlesource.com/116656 Run-TryBot: David Chase TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- src/cmd/compile/internal/gc/inl.go | 2 +- src/runtime/runtime-gdb_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/cmd/compile/internal/gc/inl.go b/src/cmd/compile/internal/gc/inl.go index 46fe87e8c3..25452911eb 100644 --- a/src/cmd/compile/internal/gc/inl.go +++ b/src/cmd/compile/internal/gc/inl.go @@ -352,7 +352,7 @@ func (v *hairyVisitor) visit(n *Node) bool { v.budget -= v.extraCallCost case OPANIC: - v.budget -= v.extraCallCost + v.budget -= inlineExtraPanicCost case ORECOVER: // recover matches the argument frame pointer to find diff --git a/src/runtime/runtime-gdb_test.go b/src/runtime/runtime-gdb_test.go index 79f9cb3538..3f936b15b3 100644 --- a/src/runtime/runtime-gdb_test.go +++ b/src/runtime/runtime-gdb_test.go @@ -538,7 +538,7 @@ func TestGdbPanic(t *testing.T) { `main`, } for _, name := range bt { - s := fmt.Sprintf("#.* .* in main\\.%v", name) + s := fmt.Sprintf("(#.* .* in )?main\\.%v", name) re := regexp.MustCompile(s) if found := re.Find(got) != nil; !found { t.Errorf("could not find '%v' in backtrace", s) -- cgit v1.3-5-g9baa