Work items:
Currently the MarkState implements cyclic mark state for ImmortalSpace and VMSpace. But both ImmixSpace and LargeObjectSpace reinvent the wheel, i.e. they implement the mark states in their own fields. The native MarkSweepSpace for some reasons doesn't use cyclic mark states.
And the re-inveneted mark_state: u8 field is one field that needs to be modified in prepare or release, and it is one of the reasons why fn prepare and fn release have to have the &mut self parameter instead of &self.
We should use the MarkState struct for the mark bit and not reinvent the wheel.
To address the "uniqueness of &mut Plan" problem mentioned in #852 (comment), MarkState should internally use AtomicU8.
Work items:
ImmixSpace,LargeObjectSpaceandMarkSweepSpaceuseMarkStatefor markingMarkStateuseAtomicU8internally, removing the need to use&mut selfto flip the mark stateCurrently the
MarkStateimplements cyclic mark state forImmortalSpaceandVMSpace. But bothImmixSpaceandLargeObjectSpacereinvent the wheel, i.e. they implement the mark states in their own fields. The nativeMarkSweepSpacefor some reasons doesn't use cyclic mark states.And the re-inveneted
mark_state: u8field is one field that needs to be modified in prepare or release, and it is one of the reasons whyfn prepareandfn releasehave to have the&mut selfparameter instead of&self.We should use the
MarkStatestruct for the mark bit and not reinvent the wheel.To address the "uniqueness of
&mut Plan" problem mentioned in #852 (comment),MarkStateshould internally useAtomicU8.