]> Cypherpunks repositories - gostls13.git/commitdiff
doc: add relnotes for stack objects and mid-stack inlining
authorKeith Randall <khr@google.com>
Thu, 29 Nov 2018 17:47:11 +0000 (09:47 -0800)
committerKeith Randall <khr@golang.org>
Thu, 29 Nov 2018 18:00:44 +0000 (18:00 +0000)
Change-Id: Ief11612b67def93311707165910124d3ce28fb89
Reviewed-on: https://go-review.googlesource.com/c/151777
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
doc/go1.12.html

index 7a2a50bacc301fc8c483ec7eed4ace8d4d2fc7eb..9a5d4bc621c435fa3a9a23d7687a632ecdb0515c 100644 (file)
@@ -66,6 +66,48 @@ Go 1.13 will require macOS 10.11 El Capitan or later.
   has no effect in Go 1.12.
 </p>
 
+<h3 id="compiler">Compiler toolchain</h3>
+
+<p><!-- CL 134155, 134156 -->
+  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
+  <a href="/pkg/runtime/#KeepAlive"><code>runtime.KeepAlive</code></a> call.
+</p>
+
+<p><!-- CL 147361 -->
+  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
+  <a href="/pkg/runtime/#CallersFrames"><code>runtime.CallersFrames</code></a>
+  instead of iterating over the result of
+  <a href="/pkg/runtime/#Callers"><code>runtime.Callers</code></a> directly.
+<pre>
+// 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())
+       }
+}
+</pre>
+<pre>
+// 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
+       }
+}
+</pre>
+</p>
+
 <h3 id="godoc">Godoc</h3>
 
 <p>