]> Cypherpunks repositories - gostls13.git/commit
runtime: use wb flag instead of gcphase for allocate-black check
authorMichael Anthony Knyszek <mknyszek@google.com>
Thu, 3 Oct 2024 18:18:11 +0000 (18:18 +0000)
committerGopher Robot <gobot@golang.org>
Mon, 21 Oct 2024 15:46:44 +0000 (15:46 +0000)
commitd8997c8c1fd2b666b1f145b8006e6a7871e48f45
treef551e5779e953d8b272bd2c14eaf63ce1fb7f92a
parent31437f25f2a65171b25ba1418509fd019c68a6b9
runtime: use wb flag instead of gcphase for allocate-black check

This is an allocator microoptimization. There's no reason to check
gcphase in general, since it's mostly for debugging anyway.
writeBarrier.enabled is set in all the same cases here, and we force one
fewer cache line (probably) to be touched during malloc.

Conceptually, it also makes a bit more sense. The allocate-black policy
is partly informed by the write barrier design.

Change-Id: Ia5ff593d64c29cf7f4d1bced3204056566444a98
Reviewed-on: https://go-review.googlesource.com/c/go/+/617875
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
src/runtime/malloc.go