]> Cypherpunks.ru repositories - gostls13.git/commit
runtime: change heapObjectsCanMove to a func
authorRuss Cox <rsc@golang.org>
Thu, 25 May 2023 16:47:06 +0000 (12:47 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 25 May 2023 18:35:49 +0000 (18:35 +0000)
commit789701e93a6f0063b6ef2c52c0557c672553d0e2
tree1e754baa911ace6cab318780da065687ae14bb37
parent82d5ebce96761083f5313b180c6b368be1912d42
runtime: change heapObjectsCanMove to a func

A var is problematic because the zero value is already false,
so if it goes away, it will appear to be false.
I'm also not sure about go:linkname on vars,
so switch to func for both reasons.

Also add a test.

Change-Id: I2318a5390d98577aec025152e65543491489defb
Reviewed-on: https://go-review.googlesource.com/c/go/+/498261
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/heap_test.go [new file with mode: 0644]
src/runtime/mgc.go