-
Notifications
You must be signed in to change notification settings - Fork 69
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
Refactor derive macros and add HasSpaces trait #934
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Make attributes less specific to tracing.
wks
force-pushed
the
feature/improve-macros
branch
from
September 1, 2023 02:56
0621d99
to
a9fa818
Compare
The Plan trait also requires the HasSpaces trait.
Remove the manually written `get_spaces` method in favor for the auto-generated `for_each_space` method.
Replace the hand-written implementations of `verify_side_metadata_sanity` with a generic implementation using `Plan::for_each_space` to visit all spaces.
qinsoon
approved these changes
Sep 4, 2023
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.
LGTM
qinsoon
added
the
PR-testing
Run binding tests for the pull request (deprecated: use PR-extended-testing instead)
label
Sep 4, 2023
Added the missing `#[parent]` attribute to the `PageProtect::common` field. It didn't have the `#[fallback_trace]` attribute, but it worked because the PageProtect plan only ever allocates into `PageProtect::space` which is an LOS. Now that the `#[parent]` attribute is also used for enumerating spaces and verifying space metadata, it can no longer be omitted. Omitting `#[parent]` will cause failure when the "extreme_assertions" feature is enabled.
wks
added a commit
to wks/mmtk-core
that referenced
this pull request
May 6, 2024
`ScanObjectsWork::make_another` is unused. It was used when `ScanObjectsWork` was used for scanning node roots. Now that node roots are scanned by the dedicated `ProcessRootNode` work packet, we can remove it. `WorkCounter::get_base_mut` is never used. All derived counters use `merge_val` to update all fields at the same time. We use `Box::as_ref()` to get the reference to its underlying element. It fixes a compilation error related to CommonFreeListPageResource. But we should eventually remove CommonFreeListPageResource completely as it is a workaround for mimicking the legacy design from JikesRVM that allow VMMap to enumerate and patch existing FreeListPageResource instances by registering them in a global list, which is not idiomatic in Rust. See mmtk#934 and mmtk#953
github-merge-queue bot
pushed a commit
that referenced
this pull request
May 6, 2024
`ScanObjectsWork::make_another` is unused. It was used when `ScanObjectsWork` was used for scanning node roots. Now that node roots are scanned by the dedicated `ProcessRootNode` work packet, we can remove it. `WorkCounter::get_base_mut` is never used. All derived counters use `merge_val` to update all fields at the same time. We use `Box::as_ref()` to get the reference to its underlying element. It fixes a compilation error related to CommonFreeListPageResource. But we should eventually remove CommonFreeListPageResource completely as it is a workaround for mimicking the legacy design from JikesRVM that allow VMMap to enumerate and patch existing FreeListPageResource instances by registering them in a global list, which is not idiomatic in Rust. See #934 and #953.
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
PR-testing
Run binding tests for the pull request (deprecated: use PR-extended-testing instead)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.HasSpaces
trait that enumerates spaces of a plan. Plans (including NoGC) are now required to implement this trait.HasSpaces
#[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 fortrace_object
.Plan::get_spaces()
method is removed in favor for the automatically generatedHasSpace::for_each_space
method.Plan::verify_side_metadata_sanity
that callsSpace::verify_side_metadata_sanity
for all spaces in the plan. This replaces the manual invocations ofSpace::verify_side_metadata_sanity
in the constructors of plans.This PR also slightly refactors the mmtk-macros crate.
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.