Skip to content

Commit 3832b0d

Browse files
authored
Remove dead trace_object methods. (#1277)
Now that we are using the `#[derive(HasSpaces, PlanTraceObject)]` derive macros to generate the trace_object methods, we can remove the manually-written dead code.
1 parent 84545cc commit 3832b0d

File tree

3 files changed

+3
-74
lines changed

3 files changed

+3
-74
lines changed

docs/userguide/src/tutorial/code/mygc_semispace/gc_work.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ impl<VM: VMBinding> ProcessEdgesWork for MyGCProcessEdges<VM> {
7373
worker,
7474
)
7575
} else {
76-
self.plan.common.trace_object(queue, object, worker)
76+
use crate::plan::PlanTraceObject;
77+
use crate::policy::gc_work::DEFAULT_TRACE;
78+
self.plan.common.trace_object::<_, DEFAULT_TRACE>(queue, object, worker)
7779
}
7880
}
7981

src/plan/generational/global.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -202,25 +202,6 @@ impl<VM: VMBinding> CommonGenPlan<VM> {
202202
is_full_heap
203203
}
204204

205-
/// Trace objects for spaces in generational and common plans for a full heap GC.
206-
#[allow(unused)] // We now use `PlanTraceObject`, and this mehtod is not used.
207-
pub fn trace_object_full_heap<Q: ObjectQueue>(
208-
&self,
209-
queue: &mut Q,
210-
object: ObjectReference,
211-
worker: &mut GCWorker<VM>,
212-
) -> ObjectReference {
213-
if self.nursery.in_space(object) {
214-
return self.nursery.trace_object::<Q>(
215-
queue,
216-
object,
217-
Some(CopySemantics::PromoteToMature),
218-
worker,
219-
);
220-
}
221-
self.common.trace_object::<Q>(queue, object, worker)
222-
}
223-
224205
/// Trace objects for spaces in generational and common plans for a nursery GC.
225206
pub fn trace_object_nursery<Q: ObjectQueue, const KIND: TraceKind>(
226207
&self,

src/plan/global.rs

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -489,39 +489,6 @@ impl<VM: VMBinding> BasePlan<VM> {
489489
pages
490490
}
491491

492-
pub fn trace_object<Q: ObjectQueue>(
493-
&self,
494-
queue: &mut Q,
495-
object: ObjectReference,
496-
worker: &mut GCWorker<VM>,
497-
) -> ObjectReference {
498-
#[cfg(feature = "code_space")]
499-
if self.code_space.in_space(object) {
500-
trace!("trace_object: object in code space");
501-
return self.code_space.trace_object::<Q>(queue, object);
502-
}
503-
504-
#[cfg(feature = "code_space")]
505-
if self.code_lo_space.in_space(object) {
506-
trace!("trace_object: object in large code space");
507-
return self.code_lo_space.trace_object::<Q>(queue, object);
508-
}
509-
510-
#[cfg(feature = "ro_space")]
511-
if self.ro_space.in_space(object) {
512-
trace!("trace_object: object in ro_space space");
513-
return self.ro_space.trace_object(queue, object);
514-
}
515-
516-
#[cfg(feature = "vm_space")]
517-
if self.vm_space.in_space(object) {
518-
trace!("trace_object: object in boot space");
519-
return self.vm_space.trace_object(queue, object);
520-
}
521-
522-
VM::VMActivePlan::vm_trace_object::<Q>(queue, object, worker)
523-
}
524-
525492
pub fn prepare(&mut self, _tls: VMWorkerThread, _full_heap: bool) {
526493
#[cfg(feature = "code_space")]
527494
self.code_space.prepare();
@@ -621,27 +588,6 @@ impl<VM: VMBinding> CommonPlan<VM> {
621588
+ self.base.get_used_pages()
622589
}
623590

624-
pub fn trace_object<Q: ObjectQueue>(
625-
&self,
626-
queue: &mut Q,
627-
object: ObjectReference,
628-
worker: &mut GCWorker<VM>,
629-
) -> ObjectReference {
630-
if self.immortal.in_space(object) {
631-
trace!("trace_object: object in immortal space");
632-
return self.immortal.trace_object(queue, object);
633-
}
634-
if self.los.in_space(object) {
635-
trace!("trace_object: object in los");
636-
return self.los.trace_object(queue, object);
637-
}
638-
if self.nonmoving.in_space(object) {
639-
trace!("trace_object: object in nonmoving space");
640-
return self.nonmoving.trace_object(queue, object);
641-
}
642-
self.base.trace_object::<Q>(queue, object, worker)
643-
}
644-
645591
pub fn prepare(&mut self, tls: VMWorkerThread, full_heap: bool) {
646592
self.immortal.prepare();
647593
self.los.prepare(full_heap);

0 commit comments

Comments
 (0)