add VM::ALWAYS_TRACE

This commit is contained in:
playX18 2025-02-15 19:55:06 +07:00
parent 5518088601
commit 32662e9fc8
2 changed files with 8 additions and 0 deletions

View file

@ -29,6 +29,11 @@ pub trait VirtualMachine: Sized + 'static + Send + Sync {
type Slot: SlotExtra; type Slot: SlotExtra;
type MemorySlice: MemorySlice<SlotType = Self::Slot>; type MemorySlice: MemorySlice<SlotType = Self::Slot>;
/// Should we always trace objects? If `true` then `support_slot_enqueing` will always return
/// false to MMTk and we will always work through `ObjectTracer` to trace objects.
const ALWAYS_TRACE: bool = false;
/*#[cfg(feature = "address_based_hashing")] /*#[cfg(feature = "address_based_hashing")]
const HASH_STATE_SPEC: VMLocalHashStateSpec = VMLocalHashStateSpec::in_header(61);*/ const HASH_STATE_SPEC: VMLocalHashStateSpec = VMLocalHashStateSpec::in_header(61);*/
/// 1-word local metadata for spaces that may copy objects. /// 1-word local metadata for spaces that may copy objects.

View file

@ -124,6 +124,9 @@ impl<VM: VirtualMachine> Scanning<MemoryManager<VM>> for VMKitScanning<VM> {
_tls: mmtk::util::VMWorkerThread, _tls: mmtk::util::VMWorkerThread,
object: mmtk::util::ObjectReference, object: mmtk::util::ObjectReference,
) -> bool { ) -> bool {
if VM::ALWAYS_TRACE {
return true;
}
let object = VMKitObject::from(object); let object = VMKitObject::from(object);
let metadata = object.header::<VM>().metadata(); let metadata = object.header::<VM>().metadata();