]> Cypherpunks repositories - gostls13.git/commitdiff
doc/go1.21: document reflect.Value escape improvements
authorCherry Mui <cherryyz@google.com>
Fri, 12 May 2023 19:09:03 +0000 (15:09 -0400)
committerCherry Mui <cherryyz@google.com>
Tue, 16 May 2023 21:37:42 +0000 (21:37 +0000)
With CL 408826, CL 413474, etc. reflect.ValueOf no longer
unconditionally escapes its argument, allowing a Value's content
to be allocated on the stack.

Change-Id: I3a0af85c11e2fd0df42b056095565f0ce5548886
Reviewed-on: https://go-review.googlesource.com/c/go/+/494657
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
doc/go1.21.html

index 14a2e5fabc4f89f5c02bad23746120c909da98a8..e483e1e556ae8ecd68f8cce5f1682572403a1f56 100644 (file)
@@ -105,6 +105,18 @@ Do not send CLs removing the interior tags from such phrases.
   </dd>
 </dl>
 
+<dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
+  <dd>
+    <p><!-- CL 408826, CL 413474 -->
+      In Go 1.21, <a href="/pkg/reflect/#ValueOf"><code>ValueOf</code></a>
+      no longer forces its argument to be allocated on the heap, allowing
+      a <code>Value</code>'s content to be allocated on the stack. Most
+      operations on a <code>Value</code> also allow the underlying value
+      to be stack allocated.
+    </p>
+  </dd>
+</dl>
+
 <dl id="sync"><dt><a href="/pkg/sync/">sync</a></dt>
   <dd>
     <p><!-- https://go.dev/issue/56102, CL 451356 -->