1
0
mirror of https://github.com/golang/go synced 2024-11-26 22:41:23 -07:00

runtime: test change to adapt to new inliner

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>
This commit is contained in:
Than McIntosh 2023-08-14 09:41:43 -04:00
parent 746f7e1744
commit 3997fb9243

View 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