Repository navigation
Adapt to JuliaLowering's IR #174
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -230,8 +230,8 @@ function identify_framemethod_calls(frame::Frame) | |
| elseif mstmt.head === :meta && mstmt.args[1] === :generated | ||
| newex = mstmt.args[2] | ||
| if isa(newex, Expr) | ||
| if newex.head === :new && length(newex.args) >= 2 && is_global_ref(newex.args[1], Core, :GeneratedFunctionStub) | ||
| mkey = newex.args[2] | ||
| if newex.head === :new && length(newex.args) >= 3 | ||
|
Member
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. I don't think the consequences are too bad here, but boy does it feel icky to match any |
||
| mkey = is_global_ref(newex.args[1], Core, :GeneratedFunctionStub) ? newex.args[2] : newex.args[3] | ||
| if isa(mkey, Symbol) | ||
| mkey = GlobalRef(moduleof(frame), mkey) | ||
| end | ||
|
|
@@ -365,10 +365,10 @@ end | |
| rename_framemethods!(frame::Frame) = rename_framemethods!(RecursiveInterpreter(), frame) | ||
|
|
||
| """ | ||
| pctop, isgen = find_name_caller_sig(interp::Interpreter, frame::Frame, pc::Int, name::GlobalRef) | ||
| pctop, isgen, pcmeth = find_name_caller_sig(interp::Interpreter, frame::Frame, pc::Int, name::GlobalRef) | ||
|
|
||
| Scans forward from `pc` in `frame` until a method is found that calls `name`. | ||
| `pctop` points to the beginning of that method's signature. | ||
| `pctop` points to the beginning of that method's signature, and `pcmeth` to its 3-argument `:method` expression. | ||
| `isgen` is true if `name` corresponds to a generated-function stub. | ||
|
|
||
| Alternatively, this returns `nothing` if `pc` does not appear to point to either | ||
|
|
@@ -387,13 +387,13 @@ function find_name_caller_sig(interp::Interpreter, frame::Frame, pc::Int, name:: | |
| # This might be the GeneratedFunctionStub for a @generated method | ||
| for (i, bodystmt) in enumerate(body.code) | ||
| if isexpr(bodystmt, :meta) && (bodystmt::Expr).args[1] === :generated | ||
| return signature_top(frame, stmt, pc), true | ||
| return signature_top(frame, stmt, pc), true, pc | ||
| end | ||
| i >= 5 && break # we should find this early | ||
| end | ||
| if length(body.code) > 1 | ||
| bodystmt = body.code[end-1] # the line before the final return | ||
| iscallto(bodystmt, moduleof(frame), name, body) && return signature_top(frame, stmt, pc), false | ||
| iscallto(bodystmt, moduleof(frame), name, body) && return signature_top(frame, stmt, pc), false, pc | ||
| end | ||
| end | ||
| pc = next_or_nothing(interp, frame, pc) | ||
|
|
@@ -448,7 +448,7 @@ function get_running_name(interp::Interpreter, frame::Frame, pc::Int, name::Glob | |
| pc = next_or_nothing(interp, frame, pc) | ||
| return name, pc, nothing | ||
| end | ||
| pctop, isgen = nameinfo | ||
| pctop, isgen, pcmeth = nameinfo | ||
| # Sometimes signature_top---which follows SSAValue links backwards to find the first | ||
| # line needed to define the signature---misses out on a SlotNumber assignment. | ||
| # Fix https://github.com/timholy/Revise.jl/issues/422 | ||
|
|
@@ -458,6 +458,12 @@ function get_running_name(interp::Interpreter, frame::Frame, pc::Int, name::Glob | |
| stmt = pc_expr(frame, pctop) | ||
| end # end fix | ||
| methinfo, lastpcparent = signature(interp, frame, pctop) | ||
| # Other methods may be defined among the statements of the caller's signature | ||
| while methinfo !== nothing && frame.pc < pcmeth | ||
| pcnext = next_or_nothing!(interp, frame) | ||
| pcnext === nothing && break | ||
| methinfo, lastpcparent = signature(interp, frame, pcnext) | ||
| end | ||
| methinfo === nothing && return name, pc, lastpcparent | ||
| mt, sigtparent = methinfo | ||
| # Resolve against the live method tables at the latest committed world, not `whichtt`'s | ||
|
|
||
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
Oops, something went wrong.
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.
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.
Bit adversarial example-wise, but these accesses are stricter than what
isanonymous_typedefchecks: