This fixes several issues identified while looking at #22264.
- Previously the write barrier of
resizeSmallArray#would incorrectly push empty arrays to the update remembered set. This resulted in invalid pointers on the remembered set. This was the cause of #22931 (closed) .
- Previously the nonmoving collector's treatment of weak pointer prevented some weak objects from being finalized, as described in #22327 (closed).
setNumCapabilitiescould race with the nonmoving mark thread, resulting in unsound behavior (#22926 (closed))
setNumCapabililiescould drop the update remembered sets of existing capabilities, resulting in unsound behavior (#22927 (closed))
- Previously the non-moving collector's treatment of the selector optimisation lacked a few necessary write barriers (#22930 (closed))
- Previously the non-moving collector was liable to exhibit unusually high sync pause times in some workloads. We address this with a cheap and cheerful fuel approach to limit serial-marking effort performed by the sync pause (#22929 (closed))
The weak pointer work was especially involved since it required tightening up quite a few invariants regarding weak object handling. This was a rather significant surgery but I think the result is a great improvement over the status quo.