Check that write barrier routines cannot be preempted.
Go1.5Maybe because we may have time to add the checks to a local copy
and at least verify that there aren't any missing go:nosplits that are needed
(or add the ones that are needed) in the release branch.
The text was updated successfully, but these errors were encountered:
Changes the torture test in #12068 from failing about 1/10 times
to not failing in almost 2,000 runs.
This was only happening in -race mode because functions are
bigger in -race mode, so a few of the helpers for heapBitsBulkBarrier
were not being inlined, and they were not marked nosplit,
so (only in -race mode) the write barrier was being preempted by GC,
causing missed pointer updates.
Filed issue #12069 for diagnosis of any other similar errors.
Reviewed-by: Austin Clements <firstname.lastname@example.org>
To be clear, this is about things like typedmemmove, not the regular write barrier, which runs on the system stack and hence is not preemptible.
It seems like the way to do this is to add a new "go:nopreempt" annotation that's like a recursive nosplit and replace nosplits with nopreempts where that's what we really mean. One sticking point may be functions that increment mp.locks or set mp.preemptoff that must not be preempted before this point, but can grow the stack once they've dynamically disallowed preemption. Maybe for these we just keep using nosplit.