-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Refactoring code that is specific to stock GC write barriers #57237
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
Conversation
1ff7739
to
1ce72aa
Compare
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.
Do we know yet how the write barriers for mmtk will look like?
The GCs share a tag layout?
I would prefer doing this code movement when we have a functional implementaion and not a "TODO implement these". That would also include tests for the new lowering in https://github.com/JuliaLang/julia/tree/master/test/llvmpasses
1ce72aa
to
19eb356
Compare
I agree that it's not ideal to have only the stubs for the MMTk implementation. This branch currently has the final implementation of sticky working: https://github.com/udesou/julia/tree/upstream-ready/sticky.
No, the log bit is currently implemented as part of a side metadata maintained by MMTk. We can potentially look into reusing Julia's tag layout but I think the code movement in this PR is actually orthogonal to it. Any other GC that we'd eventually plug in with a different layout would have to reimplement the barriers accordingly. So I think it makes sense that the code for implementing and lowering the write barriers should live in each gc-specific file. |
891dc4d
to
378b069
Compare
Huh, okay. That means we will need quite some more code-modifications in areas where we are currently directly modifying the GC bits?
I love small refactorings, but they must make the code clearer on their own. Currently, without knowing the other side of this code, it's difficult to tell if this refactoring is beneficial or if a different strategy would be better.
It's good to start with tests for the code as is. Then you can test everything and show that once you actually add the implementation what the emitted code will look like. |
The general idea here looks fine to me (have some minor comments which I will post shortly). I believe that we proposed this refactor in the GC interface document already -- https://docs.google.com/document/d/1v0jtSrIpdEDNOxj5S9g1jPqSpuAkNWhr_T8ToFC9RLI/edit?usp=drivesdk.
|
Could you clarify these concerns about code clarity @vchuravy? Asking because I'd expect the code structure to remain fairly similar after we merge the generational MMTk and implement proper write barriers. I.e. I think the call-sites of these functions will remain the same, though we will change some of them (e.g. |
If that's the kind of refactor we will do, then I'm not sure how much more clarity we will be able to get by squashing this into a larger PR that introduces the generational MMTk. |
ed999a6
to
1253399
Compare
I've removed the llvm-specific code, and left the refactoring of the |
1253399
to
5b5c0e8
Compare
The MMTk build seems to be segfaulting. |
The PR #57253 has changed the layout for |
d05772f
to
ebf6838
Compare
5e520f4
to
6effd12
Compare
ef6435f
to
f8cbb6a
Compare
…rom `genericmemory.c` (#57252) This PR moves stock-specific write barriers from `jl_genericmemory_copyto` into `julia.h`. Note that this PR can be merged independently, but is heavily connected with #57237. Ideally they should be combined, but this PR actually introduces new functions to the GC interface, and that is the main reason I'd like them to be reviewed separately. The code for either PR will have to be adapted depending on which one gets merged first.
c5d10ef
to
755e511
Compare
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. Perhaps rewrite the comments at the top of the WB header files
6dcfa67
to
2248ab1
Compare
2248ab1
to
73018de
Compare
The OOMs on 32 bit architectures are a bit concerning. |
I'm skeptical they are related to this PR (which only moves a few functions to new files). Let's rebase to rerun CI and see. |
73018de
to
40fb554
Compare
I see these all the time |
This PR moves some code responsible for implementing write barriers around: the write barrier functions are lifted from
julia.h
into the newgc-wb-*.h
files.