]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: test change to adapt to new inliner
authorThan McIntosh <thanm@google.com>
Mon, 14 Aug 2023 13:41:43 +0000 (09:41 -0400)
committerThan McIntosh <thanm@google.com>
Fri, 8 Sep 2023 23:04:18 +0000 (23:04 +0000)
The new inliner tries to de-prioritize inlining of call sites on panic
paths, e.g. for a call such as the one to "foo" below, the inliner
will use a much lower size threshold when deciding whether to inline,
since the path is very likely to be "cold".

   if mumble() {
      foo()           <<-- here
      panic("bad")
   }

This patch reworks one of the traceback tests is relying on the old
inliner's "inline F everywhere if F inlinable" strategy by tweaking
the code slightly (no change in test functionality).

Change-Id: I83a686b0cc4d94a6cfc63d1e84e45455c1afd5b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/519196
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/runtime/traceback_test.go

index 1617612418809dea1f2921362f4dd1f413ede690..204b4f5316c99d653a85fa62ae303b42351855d7 100644 (file)
@@ -108,7 +108,13 @@ func ttiSigpanic1() (res *ttiResult) {
                recover()
        }()
        ttiSigpanic2()
-       panic("did not panic")
+       // without condition below the inliner might decide to de-prioritize
+       // the callsite above (since it would be on an "always leads to panic"
+       // path).
+       if alwaysTrue {
+               panic("did not panic")
+       }
+       return nil
 }
 func ttiSigpanic2() {
        ttiSigpanic3()
@@ -118,6 +124,8 @@ func ttiSigpanic3() {
        *p = 3
 }
 
+var alwaysTrue = true
+
 //go:noinline
 func ttiWrapper1() *ttiResult {
        var w ttiWrapper