Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/memory_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ pub fn harness_begin<VM: VMBinding>(mmtk: &MMTK<VM>, tls: VMMutatorThread) {
///
/// Arguments:
/// * `mmtk`: A reference to an MMTk instance.
pub fn harness_end<VM: VMBinding>(mmtk: &'static MMTK<VM>) {
pub fn harness_end<VM: VMBinding>(mmtk: &MMTK<VM>) {
mmtk.harness_end();
}

Expand All @@ -831,7 +831,7 @@ pub fn harness_end<VM: VMBinding>(mmtk: &'static MMTK<VM>) {
/// * `mmtk`: A reference to an MMTk instance
/// * `object`: The object that has a finalizer
pub fn add_finalizer<VM: VMBinding>(
mmtk: &'static MMTK<VM>,
mmtk: &MMTK<VM>,
object: <VM::VMReferenceGlue as ReferenceGlue<VM>>::FinalizableType,
) {
if *mmtk.options.no_finalizer {
Expand Down Expand Up @@ -891,7 +891,7 @@ pub fn is_pinned(object: ObjectReference) -> bool {
/// Arguments:
/// * `mmtk`: A reference to an MMTk instance.
pub fn get_finalized_object<VM: VMBinding>(
mmtk: &'static MMTK<VM>,
mmtk: &MMTK<VM>,
) -> Option<<VM::VMReferenceGlue as ReferenceGlue<VM>>::FinalizableType> {
if *mmtk.options.no_finalizer {
warn!("get_finalized_object() is called when no_finalizer = true");
Expand All @@ -911,7 +911,7 @@ pub fn get_finalized_object<VM: VMBinding>(
/// Arguments:
/// * `mmtk`: A reference to an MMTk instance.
pub fn get_all_finalizers<VM: VMBinding>(
mmtk: &'static MMTK<VM>,
mmtk: &MMTK<VM>,
) -> Vec<<VM::VMReferenceGlue as ReferenceGlue<VM>>::FinalizableType> {
if *mmtk.options.no_finalizer {
warn!("get_all_finalizers() is called when no_finalizer = true");
Expand All @@ -930,7 +930,7 @@ pub fn get_all_finalizers<VM: VMBinding>(
/// * `mmtk`: A reference to an MMTk instance.
/// * `object`: the given object that MMTk will pop its finalizers
pub fn get_finalizers_for<VM: VMBinding>(
mmtk: &'static MMTK<VM>,
mmtk: &MMTK<VM>,
object: ObjectReference,
) -> Vec<<VM::VMReferenceGlue as ReferenceGlue<VM>>::FinalizableType> {
if *mmtk.options.no_finalizer {
Expand All @@ -949,7 +949,7 @@ pub fn get_finalizers_for<VM: VMBinding>(
///
/// Arguments:
/// * `mmtk`: A reference to an MMTk instance.
pub fn num_of_workers<VM: VMBinding>(mmtk: &'static MMTK<VM>) -> usize {
pub fn num_of_workers<VM: VMBinding>(mmtk: &MMTK<VM>) -> usize {
mmtk.scheduler.num_workers()
}

Expand All @@ -961,7 +961,7 @@ pub fn num_of_workers<VM: VMBinding>(mmtk: &'static MMTK<VM>) -> usize {
/// * `bucket`: Which work bucket to add this packet to.
/// * `packet`: The work packet to be added.
pub fn add_work_packet<VM: VMBinding, W: GCWork<VM>>(
mmtk: &'static MMTK<VM>,
mmtk: &MMTK<VM>,
bucket: WorkBucketStage,
packet: W,
) {
Expand All @@ -976,7 +976,7 @@ pub fn add_work_packet<VM: VMBinding, W: GCWork<VM>>(
/// * `bucket`: Which work bucket to add these packets to.
/// * `packet`: The work packets to be added.
pub fn add_work_packets<VM: VMBinding>(
mmtk: &'static MMTK<VM>,
mmtk: &MMTK<VM>,
bucket: WorkBucketStage,
packets: Vec<Box<dyn GCWork<VM>>>,
) {
Expand Down
6 changes: 3 additions & 3 deletions src/mmtk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ impl<VM: VMBinding> MMTK<VM> {
/// is only safe for the VM to call `fork()` after the underlying **native threads** of the GC
/// threads have exited. After calling this function, the VM should wait for their underlying
/// native threads to exit in VM-specific manner before calling `fork()`.
pub fn prepare_to_fork(&'static self) {
pub fn prepare_to_fork(&self) {
assert!(
self.state.is_initialized(),
"MMTk collection has not been initialized, yet (was initialize_collection() called before?)"
Expand All @@ -307,7 +307,7 @@ impl<VM: VMBinding> MMTK<VM> {
/// * `tls`: The thread that wants to respawn MMTk threads after forking. This value will be
/// passed back to the VM in `Collection::spawn_gc_thread()` so that the VM knows the
/// context.
pub fn after_fork(&'static self, tls: VMThread) {
pub fn after_fork(&self, tls: VMThread) {
assert!(
self.state.is_initialized(),
"MMTk collection has not been initialized, yet (was initialize_collection() called before?)"
Expand All @@ -330,7 +330,7 @@ impl<VM: VMBinding> MMTK<VM> {
/// Generic hook to allow benchmarks to be harnessed. MMTk will stop collecting
/// statistics, and print out the collected statistics in a defined format.
/// This is usually called by the benchmark harness right after the actual benchmark.
pub fn harness_end(&'static self) {
pub fn harness_end(&self) {
self.stats.stop_all(self);
self.state.inside_harness.store(false, Ordering::SeqCst);
probe!(mmtk, harness_end);
Expand Down
6 changes: 3 additions & 3 deletions src/plan/compressor/gc_work.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct GenerateWork<VM: VMBinding, F: Fn(&'static CompressorSpace<VM>) + Sen
impl<VM: VMBinding, F: Fn(&'static CompressorSpace<VM>) + Send + 'static> GCWork<VM>
for GenerateWork<VM, F>
{
fn do_work(&mut self, _worker: &mut GCWorker<VM>, _mmtk: &'static MMTK<VM>) {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, _mmtk: &MMTK<VM>) {
(self.f)(self.compressor_space);
}
}
Expand All @@ -40,7 +40,7 @@ pub struct UpdateReferences<VM: VMBinding> {
unsafe impl<VM: VMBinding> Send for UpdateReferences<VM> {}

impl<VM: VMBinding> GCWork<VM> for UpdateReferences<VM> {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, mmtk: &'static MMTK<VM>) {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, mmtk: &MMTK<VM>) {
// The following needs to be done right before the second round of root scanning
VM::VMScanning::prepare_for_roots_re_scanning();
mmtk.state.prepare_for_stack_scanning();
Expand Down Expand Up @@ -71,7 +71,7 @@ pub struct AfterCompact<VM: VMBinding> {
}

impl<VM: VMBinding> GCWork<VM> for AfterCompact<VM> {
fn do_work(&mut self, worker: &mut GCWorker<VM>, _mmtk: &'static MMTK<VM>) {
fn do_work(&mut self, worker: &mut GCWorker<VM>, _mmtk: &MMTK<VM>) {
self.compressor_space.after_compact(worker, self.los);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/plan/concurrent/concurrent_marking_work.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ unsafe impl<VM: VMBinding, P: ConcurrentPlan<VM = VM> + PlanTraceObject<VM>, con
impl<VM: VMBinding, P: ConcurrentPlan<VM = VM> + PlanTraceObject<VM>, const KIND: TraceKind>
GCWork<VM> for ConcurrentTraceObjects<VM, P, KIND>
{
fn do_work(&mut self, worker: &mut GCWorker<VM>, _mmtk: &'static MMTK<VM>) {
fn do_work(&mut self, worker: &mut GCWorker<VM>, _mmtk: &MMTK<VM>) {
self.worker = worker;
let mut num_objects = 0;
let mut num_next_objects = 0;
Expand Down Expand Up @@ -175,17 +175,17 @@ impl<VM: VMBinding, P: ConcurrentPlan<VM = VM> + PlanTraceObject<VM>, const KIND
impl<VM: VMBinding, P: ConcurrentPlan<VM = VM> + PlanTraceObject<VM>, const KIND: TraceKind>
GCWork<VM> for ProcessModBufSATB<VM, P, KIND>
{
fn do_work(&mut self, worker: &mut GCWorker<VM>, mmtk: &'static MMTK<VM>) {
fn do_work(&mut self, worker: &mut GCWorker<VM>, _mmtk: &MMTK<VM>) {
let mut w = if let Some(nodes) = self.nodes.take() {
if nodes.is_empty() {
return;
}

ConcurrentTraceObjects::<VM, P, KIND>::new(nodes, mmtk)
ConcurrentTraceObjects::<VM, P, KIND>::new(nodes, worker.mmtk)
} else {
return;
};
GCWork::do_work(&mut w, worker, mmtk);
GCWork::do_work(&mut w, worker, worker.mmtk);
}
}

Expand Down
12 changes: 2 additions & 10 deletions src/plan/gc_work.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ pub(super) struct SetCommonPlanUnlogBits<VM: VMBinding> {
}

impl<VM: VMBinding> GCWork<VM> for SetCommonPlanUnlogBits<VM> {
fn do_work(
&mut self,
_worker: &mut crate::scheduler::GCWorker<VM>,
_mmtk: &'static crate::MMTK<VM>,
) {
fn do_work(&mut self, _worker: &mut crate::scheduler::GCWorker<VM>, _mmtk: &crate::MMTK<VM>) {
self.common_plan.set_side_log_bits();
}
}
Expand All @@ -22,11 +18,7 @@ pub(super) struct ClearCommonPlanUnlogBits<VM: VMBinding> {
}

impl<VM: VMBinding> GCWork<VM> for ClearCommonPlanUnlogBits<VM> {
fn do_work(
&mut self,
_worker: &mut crate::scheduler::GCWorker<VM>,
_mmtk: &'static crate::MMTK<VM>,
) {
fn do_work(&mut self, _worker: &mut crate::scheduler::GCWorker<VM>, _mmtk: &crate::MMTK<VM>) {
self.common_plan.clear_side_log_bits();
}
}
6 changes: 3 additions & 3 deletions src/plan/generational/gc_work.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl<E: ProcessEdgesWork> ProcessModBuf<E> {
}

impl<E: ProcessEdgesWork> GCWork<E::VM> for ProcessModBuf<E> {
fn do_work(&mut self, worker: &mut GCWorker<E::VM>, mmtk: &'static MMTK<E::VM>) {
fn do_work(&mut self, worker: &mut GCWorker<E::VM>, mmtk: &MMTK<E::VM>) {
// Process and scan modbuf only if the current GC is a nursery GC
let gen = mmtk.get_plan().generational().unwrap();
if gen.is_current_gc_nursery() {
Expand Down Expand Up @@ -157,7 +157,7 @@ impl<E: ProcessEdgesWork> ProcessRegionModBuf<E> {
}

impl<E: ProcessEdgesWork> GCWork<E::VM> for ProcessRegionModBuf<E> {
fn do_work(&mut self, worker: &mut GCWorker<E::VM>, mmtk: &'static MMTK<E::VM>) {
fn do_work(&mut self, worker: &mut GCWorker<E::VM>, mmtk: &MMTK<E::VM>) {
// Scan modbuf only if the current GC is a nursery GC
if mmtk
.get_plan()
Expand All @@ -174,7 +174,7 @@ impl<E: ProcessEdgesWork> GCWork<E::VM> for ProcessRegionModBuf<E> {
}
// Forward entries
GCWork::do_work(
&mut E::new(slots, false, mmtk, WorkBucketStage::Closure),
&mut E::new(slots, false, worker.mmtk, WorkBucketStage::Closure),
worker,
mmtk,
)
Expand Down
6 changes: 3 additions & 3 deletions src/plan/markcompact/gc_work.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct CalculateForwardingAddress<VM: VMBinding> {
}

impl<VM: VMBinding> GCWork<VM> for CalculateForwardingAddress<VM> {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, _mmtk: &'static MMTK<VM>) {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, _mmtk: &MMTK<VM>) {
self.mc_space.calculate_forwarding_pointer();
}
}
Expand All @@ -39,7 +39,7 @@ pub struct UpdateReferences<VM: VMBinding> {
unsafe impl<VM: VMBinding> Send for UpdateReferences<VM> {}

impl<VM: VMBinding> GCWork<VM> for UpdateReferences<VM> {
fn do_work(&mut self, worker: &mut GCWorker<VM>, mmtk: &'static MMTK<VM>) {
fn do_work(&mut self, worker: &mut GCWorker<VM>, mmtk: &MMTK<VM>) {
// The following needs to be done right before the second round of root scanning
VM::VMScanning::prepare_for_roots_re_scanning();
mmtk.state.prepare_for_stack_scanning();
Expand Down Expand Up @@ -81,7 +81,7 @@ pub struct Compact<VM: VMBinding> {
}

impl<VM: VMBinding> GCWork<VM> for Compact<VM> {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, _mmtk: &'static MMTK<VM>) {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, _mmtk: &MMTK<VM>) {
self.mc_space.compact();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/policy/compressor/compressorspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ pub struct CalculateOffsetVector<VM: VMBinding> {
}

impl<VM: VMBinding> GCWork<VM> for CalculateOffsetVector<VM> {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, _mmtk: &'static MMTK<VM>) {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, _mmtk: &MMTK<VM>) {
self.compressor_space
.calculate_offset_vector_for_region(self.region, self.cursor);
}
Expand All @@ -453,7 +453,7 @@ pub struct Compact<VM: VMBinding> {
}

impl<VM: VMBinding> GCWork<VM> for Compact<VM> {
fn do_work(&mut self, worker: &mut GCWorker<VM>, _mmtk: &'static MMTK<VM>) {
fn do_work(&mut self, worker: &mut GCWorker<VM>, _mmtk: &MMTK<VM>) {
self.compressor_space.compact_region(worker, self.index);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/policy/immix/immixspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ impl<VM: VMBinding> PrepareBlockState<VM> {
}

impl<VM: VMBinding> GCWork<VM> for PrepareBlockState<VM> {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, mmtk: &'static MMTK<VM>) {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, mmtk: &MMTK<VM>) {
// Clear object mark table for this chunk
self.reset_object_mark();
// Iterate over all blocks in this chunk
Expand Down Expand Up @@ -984,7 +984,7 @@ struct SweepChunk<VM: VMBinding> {
}

impl<VM: VMBinding> GCWork<VM> for SweepChunk<VM> {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, mmtk: &'static MMTK<VM>) {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, mmtk: &MMTK<VM>) {
assert!(self.space.chunk_map.get(self.chunk).unwrap().is_allocated());

let mut histogram = self.space.defrag.new_histogram();
Expand Down Expand Up @@ -1199,7 +1199,7 @@ struct ClearVOBitsAfterPrepare {

#[cfg(feature = "vo_bit")]
impl<VM: VMBinding> GCWork<VM> for ClearVOBitsAfterPrepare {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, _mmtk: &'static MMTK<VM>) {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, _mmtk: &MMTK<VM>) {
match self.scope {
VOBitsClearingScope::FullGC => {
vo_bit::bzero_vo_bit(self.chunk.start(), Chunk::BYTES);
Expand Down
2 changes: 1 addition & 1 deletion src/policy/marksweepspace/malloc_ms/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ pub struct MSSweepChunk<VM: VMBinding> {
}

impl<VM: VMBinding> GCWork<VM> for MSSweepChunk<VM> {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, _mmtk: &'static MMTK<VM>) {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, _mmtk: &MMTK<VM>) {
self.ms.sweep_chunk(self.chunk);
}
}
6 changes: 3 additions & 3 deletions src/policy/marksweepspace/native_ms/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ struct PrepareChunkMap<VM: VMBinding> {
}

impl<VM: VMBinding> GCWork<VM> for PrepareChunkMap<VM> {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, _mmtk: &'static MMTK<VM>) {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, _mmtk: &MMTK<VM>) {
debug_assert!(self.space.chunk_map.get(self.chunk).unwrap().is_allocated());
// number of allocated blocks.
let mut n_occupied_blocks = 0;
Expand Down Expand Up @@ -609,7 +609,7 @@ struct ReleaseMarkSweepSpace<VM: VMBinding> {
}

impl<VM: VMBinding> GCWork<VM> for ReleaseMarkSweepSpace<VM> {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, _mmtk: &'static MMTK<VM>) {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, _mmtk: &MMTK<VM>) {
{
let mut abandoned = self.space.abandoned.lock().unwrap();
abandoned.sweep_later(self.space);
Expand All @@ -629,7 +629,7 @@ struct SweepChunk<VM: VMBinding> {
}

impl<VM: VMBinding> GCWork<VM> for SweepChunk<VM> {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, _mmtk: &'static MMTK<VM>) {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, _mmtk: &MMTK<VM>) {
assert!(self.space.chunk_map.get(self.chunk).unwrap().is_allocated());

// number of allocated blocks.
Expand Down
Loading
Loading