optimize the new setglobal! function#44753
Merged
DilumAluthge merged 3 commits intomasterfrom Mar 28, 2022
Merged
Conversation
simeonschaub
approved these changes
Mar 28, 2022
Member
simeonschaub
left a comment
There was a problem hiding this comment.
Not super familiar with all the codegen parts, but otherwise LGTM
| if (ty == (jl_value_t*)jl_nothing) { | ||
| jl_binding_t *b = jl_get_binding_wr(mod, sym, 0); | ||
| if (b) { | ||
| if (b && b->owner == mod) { |
The codegen declares this is callee rooted (since we do not usually alllocate), but we might call jl_isa now, which could. The annotations on this function previously were incorrect.
Main exports everything, so it is not useful to include in this test. Refs: #44740
Fixes some atomic ordering issues also where we were ignoring the argument. Uses the new builtin where we could. But also fixes some cases where we would allocate the global binding at the wrong time (which is a globally visible side-effect of compilation), or might throw from inside codegen accidentally there instead.
ccd83f2 to
bcbdfc3
Compare
Member
Author
|
This should probably not have been squashed, as the commit message now is somewhat gibberish |
Keno
pushed a commit
that referenced
this pull request
Jun 5, 2024
* add missing gc root for typed global assignment The codegen declares this is callee rooted (since we do not usually alllocate), but we might call jl_isa now, which could. The annotations on this function previously were incorrect. * test: make exports of modules check ignore Main Main exports everything, so it is not useful to include in this test. Refs: #44740 * codegen: optimize setglobal like assignment Fixes some atomic ordering issues also where we were ignoring the argument. Uses the new builtin where we could. But also fixes some cases where we would allocate the global binding at the wrong time (which is a globally visible side-effect of compilation), or might throw from inside codegen accidentally there instead.
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 optimizes
setglobal!in codegen, as well as fixes some issues encountered with itside note: our set of random things that might happen when you declare something global (e.g. assign to it, look up its type, using it, import it–possibly as something else–create a method, or write the
globalkeyword in some context—all conditional on whether it wasconstsomewhere at some point) is quite a bit intractable to deal with