You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor derive macros and add HasSpaces trait (#934)
The main part of this PR is adding a `HasSpaces` trait that enumerates
spaces in a plan. This trait can be automatically generated using derive
macro and attributes, saving the effort to enumerate spaces by hand.
- This PR adds a `HasSpaces` trait that enumerates spaces of a plan.
Plans (including NoGC) are now required to implement this trait.
- This PR implements derived macro for `HasSpaces`
- The `#[trace]` and `#[fallback_trace]` attributes are replaced by the
`#[space]` and `#[parent]` attributes for generality. A dedicated
`#[copy_semantics(xxxxx)]` attribute is added to specify copy semantics
for `trace_object`.
- The manually written `Plan::get_spaces()` method is removed in favor
for the automatically generated `HasSpace::for_each_space` method.
- Added a `Plan::verify_side_metadata_sanity` that calls
`Space::verify_side_metadata_sanity` for all spaces in the plan. This
replaces the manual invocations of `Space::verify_side_metadata_sanity`
in the constructors of plans.
This PR also slightly refactors the mmtk-macros crate.
- The `syn` dependency is one major version behind the latest. This PR
bumps the version and refactors the code to adapt to this change.
- `mmtk-core/macros/src/lib.rs` is cleaned up so that it only contains
functions with minimum function bodies. Those functions for derive
macros are required to be in the root module of the crate. Their
function bodies are off-loaded to other modules.
This PR is a stepping stone for
#925. This PR makes it possible to
enumerate spaces of a plan without resorting to unsafe global maps.
0 commit comments