From a30f8d1e69238984fcb43fbd9d1c64d46602f6dd Mon Sep 17 00:00:00 2001
From: Keith Randall
+ The compiler's live variable analysis has improved. This may mean that
+ finalizers will be executed sooner in this release than in previous
+ releases. If that is a problem, consider the appropriate addition of a
+ runtime.KeepAlive call.
+
+ More functions are now eligible for inlining by default, including
+ functions that do nothing but call another function.
+ This extra inlining makes it additionally important to use
+ runtime.CallersFrames
+ instead of iterating over the result of
+ runtime.Callers directly.
+
+// Old code which no longer works correctly (it will miss inlined call frames).
+var pcs [10]uintptr
+n := runtime.Callers(1, pcs[:])
+for _, pc := range pcs[:n] {
+ f := runtime.FuncForPC(pc)
+ if f != nil {
+ fmt.Println(f.Name())
+ }
+}
+
+
+// New code which will work correctly.
+var pcs [10]uintptr
+n := runtime.Callers(1, pcs[:])
+frames := runtime.CallersFrames(pcs[:n])
+for {
+ frame, more := frames.Next()
+ fmt.Println(frame.Function)
+ if !more {
+ break
+ }
+}
+
+
+
-- 2.52.0