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
Move trace_object() to SFT #110
Comments
We want to do a similar refactoring for |
|
I'd like to up the priority on this. Perhaps this can be done as part of the next bugfix/cleanup release. |
|
diff --git a/src/policy/copyspace.rs b/src/policy/copyspace.rs
index 77e75321..d6ad9154 100644
--- a/src/policy/copyspace.rs
+++ b/src/policy/copyspace.rs
@@ -182,12 +182,12 @@ impl<VM: VMBinding> CopySpace<VM> {
}
#[inline]
- pub fn trace_object<T: TransitiveClosure, C: CopyContext>(
+ pub fn trace_object(
&self,
- trace: &mut T,
+ trace: &mut impl TransitiveClosure,
object: ObjectReference,
semantics: AllocationSemantics,
- copy_context: &mut C,
+ copy_context: &mut impl CopyContext,
) -> ObjectReference {
trace!("copyspace.trace_object(, {:?}, {:?})", object, semantics,);
debug_assert!( |
I think |
This PR is a step towards #258 and #110. It mainly removes the plan-specific copy context, and replaces with a configurable GC worker copy context that uses policy-specific copy context (copy allocators). The `GCWorkerCopyContext` works similarly to the configurable `Mutator`: * `GCWorkerCopyContext` ≈ `Mutator` * `CopySemantics` ≈ `AllocationSemantics` * `CopyConfig` ≈ `MutatorConfig` This PR * renames `CopyContext` (plan-specific) to `PolicyCopyContext`, and moves it to `policy/copy_context`. * only copy policies provide implementation for it, namely `CopySpaceCopyContext` and `ImmixCopyContext`. * adds a `GCWorkerCopyContext` which is a combination of `PolicyCopyContext`, and will be used as the thread local data structure for a GC worker. * `CopySemantics` is introduced. * A plan needs to provide a `CopyConfig` that maps `CopySemantics` to copy allocators, and map copy allocators to spaces. * For copy operation, a proper `CopySemantics` need to be provided. * `GCWorkerLocalPtr` and a few type parameters about the `CopyContext` is removed, as now GC worker local and the copy context has the fixed type of `GCWorkerCopyContext`. * removes the plan specific copy context (such as `SSCopyContext`, `GenCopyCopyContext`, etc)
This PR adds a general implementation for `ProcessEdges`, called `SFTProcessEdges`. It uses `SFT.sft_trace_object()` for each policy. A plan does not need to implement their own process edges work packet if they use `SFTProcessEdges`. This PR greatly simplifies the GC work implementation for most GC plans. This PR closes #110, and it is an important step towards #258. Currently only Immix (including GenImmix) and mark compact uses custom process edges. All the other plans use `SFTProcessEdges`. This PR * adds `SFT.sft_trace_object()`. * adds `Space.set_copy_for_sft_trace()` to set copy context for each space, which is used when we invoke `sft_trace_object()`. * adds `SFTProcessEdges`, and use it for most plans (except immix/genimmix and mark compact).
As raised in #108 (comment), invoking
initialize_header()
from aSpace
trait object would result in dynamic dispatching in the fast path. We can moveinitialize_header()
toSFT
, this would solve the problem.The text was updated successfully, but these errors were encountered: