[JuliaLowering] Invoke lowering hook + runtime utilities in fixed world#62302
Merged
Conversation
topolarity
force-pushed
the
ct/fix-JL-invalidations
branch
5 times, most recently
from
July 8, 2026 21:22
91f4192 to
c85256f
Compare
Member
|
Thanks! Would you (or claude) be willing to rebase onto #62221? |
topolarity
force-pushed
the
ct/fix-JL-invalidations
branch
3 times, most recently
from
July 10, 2026 19:50
b242f1a to
e621978
Compare
Member
Author
mlechu
approved these changes
Jul 10, 2026
mlechu
left a comment
Member
There was a problem hiding this comment.
SGTM. If you want to do Expr(:error) too while you're touching hooks.jl go ahead, since it should only be a few lines (though maybe make lowering in the REPL still pretty-print if possible)
Member
Author
|
I'll leave it out for now just because weekend - but I'll roll it up next week |
This shields JuliaLowering from invalidations, esp. those triggered by the code being lowered. Also resolve the macro MethodInstance once, before invoking the macro body, at the resolved macro_world (matching flisp's single lookup in jl_invoke_julia_macro): the body may load packages that perturb method-table visibility, so a post-hoc lookup for module attribution can return nothing, and it must not receive the raw typemax(UInt) "latest world" sentinel as a lookup world. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
These runtime utilities are easily invalidated (like the rest of JuliaLowering) but don't dispatch on user types so we can shield them by invoking in the lowering world. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Another runtime utility that requires invalidation shielding. Standalone CEnum include: 65s -> 0.66s (flisp: 0.04s). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Generated functions themselves run in a different world, but the lowering harness around them should still run in the lowering world to make it resilient to invalidations Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VBmeULb6ehNsozSJoqDUJq
topolarity
force-pushed
the
ct/fix-JL-invalidations
branch
from
July 11, 2026 02:16
e621978 to
b17d4ed
Compare
mlechu
reviewed
Jul 21, 2026
| macro_mi = lookup_method_instance(macfunc, macro_args, macro_world) | ||
| expanded = try | ||
| Base.invoke_in_world(ctx.world, macfunc, macro_args...) | ||
| _invoke_in_world(ctx.world, macfunc, macro_args...) |
Member
There was a problem hiding this comment.
Specializing on the function makes sense for calling our own runtime functions, but doesn't this compile a new specialization of _invoke_in_world for every unique macro we call?
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 helps some severe slowdowns when precompiling common packages due to invalidations:
Not quite up to flisp parity, but we're getting somewhere.
Invalidations and barrier locations found by Claude Fable 🤖 , but sensible IMO
(I tried to edit away any AI over-verbosity, etc.)