-
-
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
Teach compiler about partitioned bindings #56299
Changes from all commits
7120727
d7c93f9
967ab56
4efebe7
d63f2a2
70a4378
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -230,13 +230,20 @@ const BINDING_KIND_DECLARED = 0x7 | |
const BINDING_KIND_GUARD = 0x8 | ||
|
||
is_some_const_binding(kind::UInt8) = (kind == BINDING_KIND_CONST || kind == BINDING_KIND_CONST_IMPORT) | ||
is_some_imported(kind::UInt8) = (kind == BINDING_KIND_IMPLICIT || kind == BINDING_KIND_EXPLICIT || kind == BINDING_KIND_IMPORTED) | ||
is_some_guard(kind::UInt8) = (kind == BINDING_KIND_GUARD || kind == BINDING_KIND_DECLARED || kind == BINDING_KIND_FAILED) | ||
|
||
function lookup_binding_partition(world::UInt, b::Core.Binding) | ||
ccall(:jl_get_binding_partition, Ref{Core.BindingPartition}, (Any, UInt), b, world) | ||
end | ||
|
||
function lookup_binding_partition(world::UInt, gr::Core.GlobalRef) | ||
ccall(:jl_get_globalref_partition, Ref{Core.BindingPartition}, (Any, UInt), gr, world) | ||
if isdefined(gr, :binding) | ||
b = gr.binding | ||
else | ||
b = ccall(:jl_get_module_binding, Ref{Core.Binding}, (Any, Any, Cint), gr.mod, gr.name, true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That definition was probably wrong, but regardless, this code can't handle the binding not existing. |
||
end | ||
return lookup_binding_partition(world, b) | ||
end | ||
|
||
partition_restriction(bpart::Core.BindingPartition) = ccall(:jl_bpart_get_restriction_value, Any, (Any,), bpart) | ||
|
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.
nothrow=false
instead ofeffect_free=ALWAYS_FALSE
? This code path might not be too important though.