-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Consolidate various isdefined functionality into a new builtin #56985
Open
Keno
wants to merge
1
commit into
master
Choose a base branch
from
kf/isdefinedglobal
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
aviatesk
reviewed
Jan 8, 2025
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.
Since we dropped the :isdefined
for globals, do we now need to update some files modified in #54999, like verify.jl, validation.jl and ast.md?
vtjnash
reviewed
Jan 8, 2025
vtjnash
reviewed
Jan 8, 2025
vtjnash
reviewed
Jan 8, 2025
vtjnash
reviewed
Jan 8, 2025
vtjnash
reviewed
Jan 8, 2025
Keno
force-pushed
the
kf/isdefinedglobal
branch
from
January 8, 2025 18:44
31f2278
to
6d957c3
Compare
In #54999 I extended `:isdefined` with the ability to specify whether or not to consider imported bindings defined. As a result, we now have two mechanisms for querying `isdefined` on globals (the other being `Core.isdefined`) with incompatible feature sets (`Core.isdefined` supports an atomic ordering argument, but not `allow_import`). Additionally, only one of them had proper codegen support. I also don't like to have IR forms for things that could be perfectly well handled by builtin calls (along the lines of #56713). So this tries to clean that all up by: 1. Adding a new builtin `isdefinedglobal` that has the full feature set 2. Dropping `:isdefined` on globals as an IR form (the frontend form gets lowered to the intrinsic if called on globals) 3. Wiring up codegen and correcting inference for that new builtin An additional motivation is that `isdefined` on globals needs support for partition edges (like other builtins), and having to have a special case for :isdefined was marginally annoying. Just using an intrinsic for this is much cleaner. Lastly, the reason for a new intrinsic over extending the existing `isdefined`, is that over time we've moved away from conflating fields and globals for Module (e.g. introducing `getglobal`/`setglobal!`), so this is a natural extension of that. Of course, the existing behavior is retained for ordinary `isdefined`.
Keno
force-pushed
the
kf/isdefinedglobal
branch
from
January 8, 2025 21:56
6d957c3
to
47bcb34
Compare
vtjnash
approved these changes
Jan 8, 2025
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.
In #54999 I extended
:isdefined
with the ability to specify whether or not to consider imported bindings defined. As a result, we now have two mechanisms for queryingisdefined
on globals (the other beingCore.isdefined
) with incompatible feature sets (Core.isdefined
supports an atomic ordering argument, but notallow_import
). Additionally, only one of them had proper codegen support. I also don't like to have IR forms for things that could be perfectly well handled by builtin calls (along the lines of #56713). So this tries to clean that all up by:isdefinedglobal
that has the full feature set:isdefined
on globals as an IR form (the frontend form gets lowered to the intrinsic if called on globals)An additional motivation is that
isdefined
on globals needs support for partition edges (like other builtins), and having to have a special case for :isdefined was marginally annoying. Just using an intrinsic for this is much cleaner.Lastly, the reason for a new intrinsic over extending the existing
isdefined
, is that over time we've moved away from conflating fields and globals for Module (e.g. introducinggetglobal
/setglobal!
), so this is a natural extension of that. Of course, the existing behavior is retained for ordinaryisdefined
.