Draft: compiler: Rework handling of mutator aborting
Previously -dtag-inference-checks
, -dcheck-prim-bounds
, and
-falignment-sanitization
all aborted by calling barf
from the
mutator. However, this can lead to deadlocks in the threaded RTS. For
instance, in the case of -dcheck-prim-bounds
the following can happen
- the mutator takes a capability and begins execution
- the bounds check fails, calling
barf
-
barf
callsrtsFatalInternalErrorFn
, which in turn callsendEventLogging
-
endEventLogging
callsflushEventLog
, which it turn initiates a sync to request that all capabilities flush their local event logs - we deadlock as the the capability held by the crashing mutator can never join the sync
To avoid this we now have a more principled means of aborting: we return
to the scheduler setting the thread's return value to ThreadAborting.
The scheduler will see this and call barf
.
Fixes #22038.