-
Notifications
You must be signed in to change notification settings - Fork 9
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 finalize/reference processor #150
Conversation
All tests for the current semispace have passed. I've rebased to the draft pull request. Changes: - I implemented process_weak_refs which is invoked by a workbucket to process weak references. Internally, it uses jtoc_call to reuse existing JikesRVM methods.
637771e
to
92bac4f
Compare
changes: - Refactor to use state machine style scanning - Remove unnecessary debugging code
92bac4f
to
fe6e302
Compare
update v1: i will test in my repo action first I just found that the ci is using GitHub ci runner, I am going to test it in my repo action. @qinsoon thanks for your commit to update jikesrvm version. |
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.
The code should function properly, although there may be some hidden problems that prevent some tests from passing. But JikesRVM is still one of our officially-supported VMs. We run binding tests for some PRs (will soon become all PRs) of mmtk-core, and JikesRVM is one of the VMs to run binding tests with. So I think it is not appropriate to merge this unstable change and disable some tests now.
I suggest we merge your change, but keep your change disabled by default. That is, the MMTK-JikesRVM will still use the reference processors in mmtk-core. But with a compile-time flag, MMTk-JikesRVM will use JikesRVM's reference/finalizer processors, instead.
You can use conditional compilation tricks to enable/disable the code.
For Rust code, you can use Cargo features. You can add a feature, such as binding_side_ref_proc
in Cargo.toml
. Inside Rust source files, you can use the attribute #[cfg(feature = "binding_side_ref_proc")]
to selectively enable types, functions, blocks, statements, etc. You can also use if cfg!(feature = "binding_side_ref_proc")
to guard the control flow.
For Java code, you can just write if SOME_CONSTANT { ... }
, and JikesRVM's compiler is smart enough to eliminate dead code. I'll discuss more in the review comments in your PR in the jikesrvm
repo.
For test scripts such as ci-test-assertions.sh
, instead of commenting out failing tests and changing heap sizes, I suggest copy those scripts, save to different files (such as ci-test-assertions-weakref.sh
), and edit the content there, including disabling failing tests and changing heap sizes. (p.s. You should change both -Xms
and -Xmx
so that on each line the -Xms
and -Xmx
are set to the same value.)
And you should create a compile script to compile jikesrvm
plus mmtk-jikesrvm
using your added conditional compilation flags.
* Add a new configuration setting. The test script has been updated to modify this configuration using `sed`. * Employ Rust's `cfg` attribute to conditionally compile specific modules/functions.
hi @qinsoon, I have pushed a new commit to solve the comment (basically, use conditional compile to keep the compatibility), can u activate the GitHub action workflow for this new commit? https://github.com/mmtk/mmtk-jikesrvm/actions/runs/6600465756 |
Yeah. I just did. I thought the workflows would be allowed as they were approved for the previous commit. I will keep an eye on the PR. |
Thank you 🙇 |
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.
Although not all tests passed, the current state of the code used conditional compilation and other techniques to keep the CI tests passing. In this sense, it looks good to me.
We should keep working on this feature to make it stable so that we can eventually use VM-side weak ref and finalization processing by default.
A recent upstream change (mmtk/mmtk-core@57af17f) moved the method The built-in reference processors and finalization processors can access the |
thanks I will fix later. |
`is_emergency_collection` is useful during weak reference processing. JVMs can choose not to retain referents of `SoftReference` during emergency GC. The `is_emergency_collection` function was moved from `Plan` to `GlobalState` in 57af17f. After that, the `MMTK:state` field is private and inaccessible to VM bindings. VM bindings that depend on the to-be-deprecated built-in `ReferenceProcessor` still work because it is part of the `mmtk` crate, and can `mmtk.state.is_emergency_collection`. However, VM bindings that do weak reference processing on the VM side using the `Scanning::process_weak_refs` API can no longer call that function. This makes [this PR](mmtk/mmtk-jikesrvm#150) unable to merge. In the future, the OpenJDK binding will also need it when it off-loads weak reference processing to the binding side. This PR adds a public API function `MMTK::is_emergency_collection` which can be called by the VM bindings.
hi, @qinsoon I have pushed a new commit to update with mmtk-core PR(expose the API for check emergency collection ) Plz activate the GitHub action workflow. |
The "Dacapo Tests / test" failed with a known bug that existed before this PR was introduced. I'll rerun the test. |
`is_emergency_collection` is useful during weak reference processing. JVMs can choose not to retain referents of `SoftReference` during emergency GC. The `is_emergency_collection` function was moved from `Plan` to `GlobalState` in mmtk@57af17f. After that, the `MMTK:state` field is private and inaccessible to VM bindings. VM bindings that depend on the to-be-deprecated built-in `ReferenceProcessor` still work because it is part of the `mmtk` crate, and can `mmtk.state.is_emergency_collection`. However, VM bindings that do weak reference processing on the VM side using the `Scanning::process_weak_refs` API can no longer call that function. This makes [this PR](mmtk/mmtk-jikesrvm#150) unable to merge. In the future, the OpenJDK binding will also need it when it off-loads weak reference processing to the binding side. This PR adds a public API function `MMTK::is_emergency_collection` which can be called by the VM bindings.
edit v1: sync latest status, i have finish the reference processor and integrate together.
edit v2: update with binding PR link.
fix #145
mmtk-jikesrvm PR #150
jikesRVM PR mmtk/jikesrvm#16
Modifications to the mmtk-jikesrvm repository encompass three key aspects: