From: Cherry Mui Date: Thu, 16 Nov 2023 02:35:37 +0000 (-0500) Subject: reflect: remove go121noForceValueEscape X-Git-Tag: go1.22rc1~302 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=23ca33009571a55eda926b7a41f5ceb04277bbd9;p=gostls13.git reflect: remove go121noForceValueEscape Before Go 1.21, ValueOf always escapes and a Value's content is always heap allocated. In Go 1.21, we made it no longer always escape, guarded by go121noForceValueEscape. This behavior has been released for some time and there is no issue so far. We can remove the guard now. Change-Id: I81f5366412390f6c63b642f4c7c016da534da76a Reviewed-on: https://go-review.googlesource.com/c/go/+/542795 Reviewed-by: David Chase LUCI-TryBot-Result: Go LUCI --- diff --git a/src/reflect/value.go b/src/reflect/value.go index 705d74f6b8..5bfdb55fd9 100644 --- a/src/reflect/value.go +++ b/src/reflect/value.go @@ -3232,25 +3232,12 @@ func Indirect(v Value) Value { return v.Elem() } -// Before Go 1.21, ValueOf always escapes and a Value's content -// is always heap allocated. -// Set go121noForceValueEscape to true to avoid the forced escape, -// allowing Value content to be on the stack. -// Set go121noForceValueEscape to false for the legacy behavior -// (for debugging). -const go121noForceValueEscape = true - // ValueOf returns a new Value initialized to the concrete value // stored in the interface i. ValueOf(nil) returns the zero Value. func ValueOf(i any) Value { if i == nil { return Value{} } - - if !go121noForceValueEscape { - escapes(i) - } - return unpackEface(i) }