Moving GC Extensions to Julia's FFI#95
Merged
d-netto merged 1 commit intommtk-support-moving-upstreamfrom Aug 21, 2025
Merged
Conversation
Collaborator
Author
Member
|
Possibly in the future, the pin count could be directly stored with MMTk for each object, and we don't need a table for it. The API seems to allow this as well, which is good. |
Member
|
I think we can merge this. |
Collaborator
Author
udesou
approved these changes
Aug 21, 2025
NHDaly
reviewed
Aug 22, 2025
Comment on lines
+54
to
+56
| function decrement_pin_count!(obj) | ||
| ccall(:jl_decrement_pin_count, Cvoid, (Any,), obj) | ||
| end |
There was a problem hiding this comment.
I think this should throw if you try to dec something that's not pinned.
Otherwise it will be easy to accidentally increment_pin but decrement_tpin
There was a problem hiding this comment.
(I'd probs change the c function to return the new count or -1 if not foudn)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements the APIs proposed in our Julep.
In the next few days, I plan to start using these APIs to fix a few
JuliaLangtests (e.g.Downloads.jl) that are failing due to incorrect memory management in foreign function calls.The initial implementation of these APIs is fairly simple: it uses two global maps to store objects and their pinning/transitive pinning counts. It's probably not the most performant implementation, but should be good enough for us to start fixing a few tests.
For now, the APIs are only available in our fork, so we have some flexibility to adjust function names, semantics, etc. before committing to a final version.