Skip to content

staticdata: Track "CI for external Method" in specsigflags #58162

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

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

Conversation

topolarity
Copy link
Member

@topolarity topolarity commented Apr 18, 2025

The list of "newly-inferred" CI's was awkwardly sharing responsibilities for enqueuing code for pre-compilation and labelling CodeInstances for correct de-serialization (any CodeInstance for an external Method needs to be specially installed into the cache by staticdata.jl)

This splits the latter responsibility to a specsigflags bit, so that this list is used exclusively for enqueuement + serialization of code-instances (esp. code instances for foreign Methods that have been triggered via precompile(...) statements + foreign abs-int CI's)

Split from #58133

…lags

The list of "newly-inferred" CI's was awkwardly sharing responsibilities
for both enqueuing code to be serialized and labelling "external" vs.
"internal" properties for CodeInstances so that they can be correctly
installed into the cache upon deserialization.

This splits the latter responsibility to a `specsigflags` bit, so that
this list is used exclusively for enqueuement of code-instances (esp.
code instances for foreign Methods that have been triggered via
`precompile(...)` statements)
@topolarity topolarity requested a review from vtjnash April 18, 2025 02:27
@topolarity topolarity marked this pull request as draft April 18, 2025 13:44
This code is a bit awkward because we'd really like `jl_precompile(...)`
to be in charge of telling us all the CodeInstances it generated (and
therefore the ones we'd like to serialize), but we only run that function
if generating native code.
_Atomic(uint8_t) specsigflags; // & 0b0001 == specptr is a specialized function signature for specTypes->rettype
// & 0b0010 == invokeptr matches specptr
// & 0b0100 == from image
// & 0b1000 == targets external method (serialized in another pkgimage), implies from image
Copy link
Member

Choose a reason for hiding this comment

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

Should this then be 0b1100?

@@ -2446,7 +2455,8 @@ static void jl_update_all_fptrs(jl_serializer_state *s, jl_image_t *image)
}
if (specfunc) {
jl_atomic_store_relaxed(&codeinst->specptr.fptr, fptr);
jl_atomic_store_relaxed(&codeinst->specsigflags, 0b111); // TODO: set only if confirmed to be true
uint8_t specsigflags = jl_atomic_load_relaxed(&codeinst->specsigflags);
jl_atomic_store_relaxed(&codeinst->specsigflags, (specsigflags & 0b1100) | 0b0011); // TODO: set only if confirmed to be true
Copy link
Member

Choose a reason for hiding this comment

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

Maybe time to use a enum instead of magic constants?

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.

2 participants