-
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
Supporting moving immix #93
Conversation
…he correct version
… when copying objects
…ature collections
mmtk/src/julia_scanning.rs
Outdated
process_offset_edge(closure, Address::from_ptr(data_addr), offset); | ||
} else if owner_flags.how_custom() == 1 { | ||
// the data inside the owner array is a julia allocated buffer (which at least currently is always pinned) | ||
// FIXME: if buffers may move a->data needs to be updated! |
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.
Is this the reason why buffers cannot move?
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.
That's correct. And I removed the code that introspects the owner in scan_julia_object
, but that means either buffers and the owner object must be pinned.
…to avoid introspecting into owner object during scanning
This PR adds support for (partially) moving objects in Julia and should be merged with mmtk/julia#27 and mmtk/mmtk-core#897. - It adds support for pinning/unpinning objects and checking if an object is pinned (the implementation uses a pin bit). (`mmtk_pin_object`, `mmtk_unpin_object` and `mmtk_is_pinned`) - It adds support for providing transitively pinned (`tpinned`) roots . - It implements the `copy` function in `object_model.rs`. Note that arrays with inlined data must be treated specially, as their `a->data` pointer needs to be updated after copying. - It uses Julia's GC bits to store forwarding information and the object's header to store the forwarding pointer. - Currently, all stack roots are transitively pinned. Note that we also need to traverse the `tls->live_tasks` to make sure that any stack root from these tasks are transitively pinned. - `scan_julia_object` had to be adapted to cover a few corner cases: - when an array object contains a pointer to the owner of the data, `a->data` needs to be updated in case the owner moves. - the `using` field inside a `jl_module_t` may also be inlined inside the module, and if that's the case, we need to make sure that field is updated if the module moves. - when marking finalizers, traversing the list of malloced arrays, and the list of live tasks at the end of GC, we need to updated these lists with objects that have possibly been moved. - Added a few debug assertions to capture scanning of misaligned objects and roots. NB: I've only tested moving immix; sticky immix is still non-moving. --------- Co-authored-by: Luis Eduardo de Souza Amorim <[email protected]> Co-authored-by: Luis Eduardo de Souza Amorim <[email protected]> Co-authored-by: mmtkgc-bot <[email protected]> (cherry picked from commit 1622162) # Conflicts: # julia/mmtk_julia.c # mmtk/Cargo.lock # mmtk/Cargo.toml # mmtk/api/mmtk.h # mmtk/src/julia_scanning.rs # mmtk/src/lib.rs # mmtk/src/scanning.rs
This is an automatic backport of pull request #93 done by [Mergify](https://mergify.com). Cherry-pick of 1622162 has failed: ``` On branch mergify/bp/v1.9.2+RAI/pr-93 Your branch is up to date with 'origin/v1.9.2+RAI'. You are currently cherry-picking commit 1622162. (fix conflicts and run "git cherry-pick --continue") (use "git cherry-pick --skip" to skip this patch) (use "git cherry-pick --abort" to cancel the cherry-pick operation) Changes to be committed: modified: .github/scripts/ci-build.sh modified: .github/scripts/ci-test-patching.sh modified: .github/workflows/binding-tests.yml modified: .github/workflows/ci.yml modified: mmtk/src/api.rs modified: mmtk/src/edges.rs modified: mmtk/src/julia_finalizer.rs modified: mmtk/src/object_model.rs modified: mmtk/src/util.rs Unmerged paths: (use "git add <file>..." to mark resolution) both modified: julia/mmtk_julia.c both modified: mmtk/Cargo.lock both modified: mmtk/Cargo.toml both modified: mmtk/api/mmtk.h both modified: mmtk/src/julia_scanning.rs both modified: mmtk/src/lib.rs both modified: mmtk/src/scanning.rs ``` To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally --- <details> <summary>Mergify commands and options</summary> <br /> More conditions and actions can be found in the [documentation](https://docs.mergify.com/). You can also trigger Mergify actions by commenting on this pull request: - `@Mergifyio refresh` will re-evaluate the rules - `@Mergifyio rebase` will rebase this PR on its base branch - `@Mergifyio update` will merge the base branch into this PR - `@Mergifyio backport <destination>` will backport this PR on `<destination>` branch Additionally, on Mergify [dashboard](https://dashboard.mergify.com) you can: - look at your merge queues - generate the Mergify configuration with the config editor. Finally, you can contact us on https://mergify.com </details> --------- Co-authored-by: Eduardo Souza <[email protected]>
This PR adds support for (partially) moving objects in Julia and should be merged with mmtk/julia#27 and mmtk/mmtk-core#897.
mmtk_pin_object
,mmtk_unpin_object
andmmtk_is_pinned
)tpinned
) roots .copy
function inobject_model.rs
. Note that arrays with inlined data must be treated specially, as theira->data
pointer needs to be updated after copying.tls->live_tasks
to make sure that any stack root from these tasks are transitively pinned.scan_julia_object
had to be adapted to cover a few corner cases:a->data
needs to be updated in case the owner moves.using
field inside ajl_module_t
may also be inlined inside the module, and if that's the case, we need to make sure that field is updated if the module moves.NB: I've only tested moving immix; sticky immix is still non-moving.