1
0
mirror of https://github.com/golang/go synced 2024-11-26 07:17:59 -07:00

doc/go1.21: document reflect.Value escape improvements

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>
This commit is contained in:
Cherry Mui 2023-05-12 15:09:03 -04:00
parent 7240d7e9e4
commit 51fe7062d3

View File

@ -105,6 +105,18 @@ Do not send CLs removing the interior tags from such phrases.
</dd> </dd>
</dl> </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> <dl id="sync"><dt><a href="/pkg/sync/">sync</a></dt>
<dd> <dd>
<p><!-- https://go.dev/issue/56102, CL 451356 --> <p><!-- https://go.dev/issue/56102, CL 451356 -->