-
Notifications
You must be signed in to change notification settings - Fork 78
Replace TransitiveClosure with an ObjectQueue trait #607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
97c31ab
b50f8da
6f0f4b2
d93e944
21fb066
d5a9cfb
5b770c8
b315156
03e6e08
89a20ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ use super::gc_requester::GCRequester; | |
| use super::PlanConstraints; | ||
| use crate::mmtk::MMTK; | ||
| use crate::plan::generational::global::Gen; | ||
| use crate::plan::transitive_closure::TransitiveClosure; | ||
| use crate::plan::tracing::ObjectQueue; | ||
| use crate::plan::Mutator; | ||
| use crate::policy::immortalspace::ImmortalSpace; | ||
| use crate::policy::largeobjectspace::LargeObjectSpace; | ||
|
|
@@ -601,33 +601,33 @@ impl<VM: VMBinding> BasePlan<VM> { | |
| pages | ||
| } | ||
|
|
||
| pub fn trace_object<T: TransitiveClosure>( | ||
| pub fn trace_object<Q: ObjectQueue>( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if it is helpful to mark this as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. It may reduce the inline code size. But I am not sure if we should mark it as
|
||
| &self, | ||
| _trace: &mut T, | ||
| _queue: &mut Q, | ||
| _object: ObjectReference, | ||
| ) -> ObjectReference { | ||
| #[cfg(feature = "code_space")] | ||
| if self.code_space.in_space(_object) { | ||
| trace!("trace_object: object in code space"); | ||
| return self.code_space.trace_object::<T>(_trace, _object); | ||
| return self.code_space.trace_object::<Q>(_queue, _object); | ||
| } | ||
|
|
||
| #[cfg(feature = "code_space")] | ||
| if self.code_lo_space.in_space(_object) { | ||
| trace!("trace_object: object in large code space"); | ||
| return self.code_lo_space.trace_object::<T>(_trace, _object); | ||
| return self.code_lo_space.trace_object::<Q>(_queue, _object); | ||
| } | ||
|
|
||
| #[cfg(feature = "ro_space")] | ||
| if self.ro_space.in_space(_object) { | ||
| trace!("trace_object: object in ro_space space"); | ||
| return self.ro_space.trace_object(_trace, _object); | ||
| return self.ro_space.trace_object(_queue, _object); | ||
| } | ||
|
|
||
| #[cfg(feature = "vm_space")] | ||
| if self.vm_space.in_space(_object) { | ||
| trace!("trace_object: object in boot space"); | ||
| return self.vm_space.trace_object(_trace, _object); | ||
| return self.vm_space.trace_object(_queue, _object); | ||
| } | ||
| panic!("No special case for space in trace_object({:?})", _object); | ||
| } | ||
|
|
@@ -903,20 +903,20 @@ impl<VM: VMBinding> CommonPlan<VM> { | |
| self.immortal.reserved_pages() + self.los.reserved_pages() + self.base.get_used_pages() | ||
| } | ||
|
|
||
| pub fn trace_object<T: TransitiveClosure>( | ||
| pub fn trace_object<Q: ObjectQueue>( | ||
| &self, | ||
| trace: &mut T, | ||
| queue: &mut Q, | ||
| object: ObjectReference, | ||
| ) -> ObjectReference { | ||
| if self.immortal.in_space(object) { | ||
| trace!("trace_object: object in immortal space"); | ||
| return self.immortal.trace_object(trace, object); | ||
| return self.immortal.trace_object(queue, object); | ||
| } | ||
| if self.los.in_space(object) { | ||
| trace!("trace_object: object in los"); | ||
| return self.los.trace_object(trace, object); | ||
| return self.los.trace_object(queue, object); | ||
| } | ||
| self.base.trace_object::<T>(trace, object) | ||
| self.base.trace_object::<Q>(queue, object) | ||
| } | ||
|
|
||
| pub fn prepare(&mut self, tls: VMWorkerThread, full_heap: bool) { | ||
|
|
@@ -974,9 +974,9 @@ pub trait PlanTraceObject<VM: VMBinding> { | |
| /// * `trace`: the current transitive closure | ||
| /// * `object`: the object to trace. This is a non-nullable object reference. | ||
| /// * `worker`: the GC worker that is tracing this object. | ||
| fn trace_object<T: TransitiveClosure, const KIND: TraceKind>( | ||
| fn trace_object<Q: ObjectQueue, const KIND: TraceKind>( | ||
| &self, | ||
| trace: &mut T, | ||
| queue: &mut Q, | ||
| object: ObjectReference, | ||
| worker: &mut GCWorker<VM>, | ||
| ) -> ObjectReference; | ||
|
|
||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we mark this as
#[inline(always)]? Also thetrace_object_nurseryfunction below as wellThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried. However, if I mark this as
#[inline(always)], the Rust compiler will decide not to inline another call inside this function. Then I marked another function as#[inline(always)], and then the Rust compiler will again decide not to inline yet another function. And this went on and on. So I decided to fix the inlining problem later, not in this PR, because the performance of generational GC doesn't seem to be affected by this PR.