Skip to content
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

Expose VO bit functions #1157

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

udesou
Copy link
Contributor

@udesou udesou commented Jun 26, 2024

Currently Julia needs to bulk set the VO bit for boot image regions of code.
While hacky, this solution seems to work and shouldn't be too problematic given we only do that for permalloc-ed objects.
This PR makes the functions bzero_vo_bit and bset_vo_bit public via util/metadata/side_metadata/global.rs so that it can be called by the Julia binding.

@udesou udesou requested review from wks and qinsoon June 26, 2024 06:28
@@ -12,6 12,18 @@ use std::fmt;
use std::io::Result;
use std::sync::atomic::{AtomicU8, Ordering};

#[cfg(feature = "vo_bit")]
Copy link
Collaborator

@wks wks Jun 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just not right to put VO bit specific functions in side_metadata::global. I suggest we make the vo_bit module public, and mark functions not intended to be public as pub(crate). It is actually part of the plan to make vo_bit public. See: #804 (Update: Sorry. I think that issue conflicts with our recent discussion in some ways. But feel free to make the vo_bit module public.)

@qinsoon
Copy link
Member

qinsoon commented Jun 26, 2024

I am not sure if it is a good idea to bulk set vo bit. VO bit means a valid object. Bulk setting vo bits clearly violates the contract. Addresses with vo bits set may not be an object.

For example, when we have internal pointers and we try to find the base pointer, MMTk will give incorrect results, as the contract about VO bits is broken.

However, I dont know what we should do for Julia's boot image. Is it possible to find each object in the boot image? I looked at https://github.com/mmtk/julia/blob/d907a0630b4551cfbb321366da6e96242ada25d1/src/staticdata.c#L2844, and it doesn't look like an easy thing to do.

@udesou
Copy link
Contributor Author

udesou commented Jun 26, 2024

I am not sure if it is a good idea to bulk set vo bit. VO bit means a valid object. Bulk setting vo bits clearly violates the contract. Addresses with vo bits set may not be an object.

For example, when we have internal pointers and we try to find the base pointer, MMTk will give incorrect results, as the contract about VO bits is broken.

However, I dont know what we should do for Julia's boot image. Is it possible to find each object in the boot image? I looked at https://github.com/mmtk/julia/blob/d907a0630b4551cfbb321366da6e96242ada25d1/src/staticdata.c#L2844, and it doesn't look like an easy thing to do.

I guess the other option is to ignore immortal objects altogether. Would that make sense? I guess it wouldn't be a problem for Julia since we use the conservative stack scanning only for pinning (and immortal objects don't move), but if we do need them as roots, then it would definitely be a problem.

udesou added a commit to mmtk/mmtk-julia that referenced this pull request Jul 11, 2024
This PR introduces the `is_mmtk_object` feature supporting a valid
object (VO) bit for conservative stack scanning. It also sets this
feature as default.

NB: merge with mmtk/julia#59.
~NB2: it requires a change in `mmtk-core` to expose an api function to
bulk set the VO bit. (see mmtk/mmtk-core#1157
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants