-
Notifications
You must be signed in to change notification settings - Fork 13
Track GlobalRef
consistently
#107
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
Conversation
Companion PR to JuliaDebug/LoweredCodeUtils.jl#107. With both of these and JuliaDebug/JuliaInterpreter.jl#634, basic Revise functionality is working for me again on Julia master.
I think I may have hit this too on Julia 1.11: ┌ Error: Failed to revise /home/james/git/CImGui.jl/src/CImGui.jl
│ exception =
│ TypeError: in typeassert, expected Symbol, got a value of type GlobalRef
│ Stacktrace:
│ [1] identify_framemethod_calls(frame::JuliaInterpreter.Frame)
│ @ LoweredCodeUtils ~/.julia/packages/LoweredCodeUtils/yox6n/src/signatures.jl:149
└ @ Revise ~/.julia/packages/Revise/bAgL0/src/packagedef.jl:724 There's a global variable in the package with type |
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.
LGTM once tests pass.
elseif name in (nothing, false) | ||
else | ||
@show stmt | ||
error("name ", typeof(name), " not recognized") |
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.
Is this transient or permanent? I'm fine with it either way, just curious.
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.
Should be unreachable in current julia, but intended to fail loudly if julia base changes.
Tests on nightly are known to fail, you don't have to get those working. |
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.
Currently dependencies for `GlobalRef` and `Symbol` are tracked separately. Unfortunately, our lowering is not consistent about which one it uses (after lowering, all `Symbols` refer to globals in the current module), so the same variable can appear twice in the same expression, once as a `GlobalRef`, once as a symbol. Currently, in that situation, this package misses a dependency, because it considers them two separate objects. Fix that by always normalizing to `GlobalRef`. This does require the caller to pass through a Module, but the alternative, would be for the caller to keep track of these dependencies implicitly, which would be painful. I think consistently using `GlobalRef` here would be cleanest.
Alright, I fixed the tests. The only issue is that since this changes the API surface that Revise uses, the versioning will be need to be bumped appropriately. |
@timholy Can we make a plan to get this in? I think between this and my JuliaInterpreter changes we're most of the way there to get Revise back to working on 1.12. |
In particular, maybe we should fix #99 |
Companion PR to JuliaDebug/LoweredCodeUtils.jl#107. With both of these and JuliaDebug/JuliaInterpreter.jl#634, basic Revise functionality is working for me again on Julia master.
Companion PR to JuliaDebug/LoweredCodeUtils.jl#107. With both of these and JuliaDebug/JuliaInterpreter.jl#634, basic Revise functionality is working for me again on Julia master. However, tests are still failing, so there will be more work needed for full functionality. Co-authored-by: Tim Holy <[email protected]>
Something broke in the final version of this. It no longer fixes LCU tests on julia master. |
There's a Revise integration test that only runs on CI. But I presume that's not what you mean. I'll build julia master and give it a whirl too. |
It's also possibly related to further changes on master. I looked at it a bit and it looks similar to the case this PR fixed, but for
|
Currently dependencies for
GlobalRef
andSymbol
are tracked separately. Unfortunately, our lowering is not consistent about which one it uses (after lowering, allSymbols
refer to globals in the current module), so the same variable can appear twice in the same expression, once as a globalref, once as a symbol. Currently, in that situation, this package misses a dependency, because it considers them two separate objects. Fix that by always normalizing to GlobalRef. This does require the caller to pass through a Module, but the alternative, would be for the caller to keep track of these dependencies implicitly, which would be painful. I think consistently usignGlobalRef
here is cleanest.