diff --git a/doc/go1.12.html b/doc/go1.12.html index 7a2a50bacc..9a5d4bc621 100644 --- a/doc/go1.12.html +++ b/doc/go1.12.html @@ -66,6 +66,48 @@ Go 1.13 will require macOS 10.11 El Capitan or later. has no effect in Go 1.12.
+
+ 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
+ }
+}
+
+
+