Skip to content

Refactor log bits #1364

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

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

Refactor log bits #1364

wants to merge 13 commits into from

Conversation

qinsoon
Copy link
Member

@qinsoon qinsoon commented Aug 8, 2025

This PR refactors the log bits: the current implementation assumes log bits are used for generational plans, and they carry generation semantics. This PR removes such assumptions.

With this PR, log bits are global metadata, and its semantic is defined by the plans. A plan may directly manipulate log bits, and may tell policies how to deal with log bits. A policy should never assume the semantics of log bits, and they just do whatever they are instructed to.

Some policies assume the log bit may be in the side, and this PR does not try to address this issue.

@@ -45,6 +45,10 @@ pub struct PlanConstraints {
/// `MutatorConfig::prepare_func`). Those plans can set this to `false` so that the
/// `PrepareMutator` work packets will not be created at all.
pub needs_prepare_mutator: bool,
/// Should a policy unlog newly allocated objects?
pub unlog_allocated_object: bool,
Copy link
Member Author

@qinsoon qinsoon Aug 8, 2025

Choose a reason for hiding this comment

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

I think this field needs to be defined per space, rather than per plan. In our generational plans, this value should be false for the nursery space and any space that allows mixed generation (such as LOS, or sticky immix's immix space). And the value should be true for other spaces.

Copy link
Collaborator

@k-sareen k-sareen Aug 8, 2025

Choose a reason for hiding this comment

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

Hm. It should also be false for LOS since it has a nursery. What spaces do we directly allocate into that would need this for generational GCs? Immortal space, I guess. Because LOS and nursery space should be the main spaces where new objects are allocated into. Again, I'm only talking about generational GCs. I'm aware that SATB requires this.
Nvm. I misread what you said, sorry. Yes I agree with what you said.

Copy link
Member Author

Choose a reason for hiding this comment

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

What spaces do we directly allocate into that would need this for generational GCs?

Immortal, non moving, code, VM space (we don't allocate into VM space, but we ask the binding to call our post_alloc after their allocation), etc. Also if we allow pretenure allocation, we may directly allocate into a mature space and also unlog the objects.

@qinsoon qinsoon force-pushed the plan-use-log-bits branch from 017a060 to 62cb89e Compare August 8, 2025 05:13
@qinsoon qinsoon added the PR-extended-testing Run extended tests for the pull request label Aug 13, 2025
This reverts commit 9c7695c.
@qinsoon qinsoon marked this pull request as ready for review August 13, 2025 05:35
@qinsoon qinsoon requested a review from wks August 13, 2025 05:35
@@ -45,3 +45,6 @@ jobs:
cd mmtk-openjdk
export RUST_BACKTRACE=1
./.github/scripts/${{ inputs.test-script }}
- name: Setup tmate session
Copy link
Member Author

Choose a reason for hiding this comment

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

This was used for debugging. I will revert this.

@wks
Copy link
Collaborator

wks commented Aug 13, 2025

@qinsoon Among the comments I have given above, only #1364 (comment) can be a result of potential bugs. Others are aesthetic comments which may be fixed or may be left as is, depending you your taste.

The style check failure in the CI should be fixed by #1367

@k-sareen
Copy link
Collaborator

I think we need to ensure that the bug we found and fixed in #1169 is not re-introduced.

@qinsoon
Copy link
Member Author

qinsoon commented Aug 14, 2025

I think we need to ensure that the bug we found and fixed in #1169 is not re-introduced.

We can only ensure 1. a PR passes the current tests, 2. a PR passes code review. You can leave comments if you believe some changes in the PR may break #1169.

@wks
Copy link
Collaborator

wks commented Aug 14, 2025

There are new methods introduced in this PR that return PlanCreateSpaceArgs<VM>, which Clippy warns about. We should change them to PlanCreateSpaceArgs<&'_, VM>.

@qinsoon qinsoon force-pushed the plan-use-log-bits branch from aed8dfe to cabdd66 Compare August 14, 2025 03:52
Copy link
Collaborator

@wks wks left a comment

Choose a reason for hiding this comment

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

LGTM

@qinsoon
Copy link
Member Author

qinsoon commented Aug 15, 2025

We saw a test failure in https://github.com/mmtk/mmtk-core/actions/runs/16955407376/job/48133843550?pr=1364. It is probably not related with this PR. I opened an issue for it: mmtk/mmtk-openjdk#317.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-extended-testing Run extended tests for the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants