Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/packagedef.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ Base.Experimental.@optlevel 1

using Core: SimpleVector, MethodTable
using Core.IR: CodeInfo, GotoIfNot, GotoNode, IR, MethodInstance, ReturnNode
@static if isdefinedglobal(Core.IR, :EnterNode)
@static if isdefined(Core.IR, :EnterNode)
using Core.IR: EnterNode
end
using .CC:
BasicBlock, CFG,
compute_basic_blocks, construct_domtree, construct_postdomtree,
nearest_common_dominator, postdominates

@static if isdefinedglobal(CC, :IRShow)
@static if isdefined(CC, :IRShow)
using .CC: IRShow
else
using Base: IRShow
Expand Down
11 changes: 5 additions & 6 deletions src/signatures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,7 @@ function set_to_running_name!(interp::Interpreter, replacements::Dict{GlobalRef,
replacements[callee] = cname
mi = methodinfos[cname] = methodinfos[callee]
src = frame.framecode.src
replacename!(@view(src.code[mi.start:mi.stop]), callee=>cname) # the method itself
for r in mi.refs # the references
replacename!((src.code[r])::Expr, callee=>cname)
end
replacename!(src, callee=>cname) # the method itself
return replacements
end

Expand Down Expand Up @@ -398,7 +395,7 @@ end
"""
replacename!(stmts, oldname=>newname)

Replace a Symbol `oldname` with `newname` in `stmts`.
Replace a Symbol `oldname` with GlobalRef `newname` in `stmts`.
"""
function replacename!(ex::Expr, pr)
replacename!(ex.args, pr)
Expand All @@ -417,14 +414,16 @@ function replacename!(args::AbstractVector, pr)
replacename!(a.code, pr)
elseif isa(a, QuoteNode) && a.value === oldname
args[i] = QuoteNode(newname)
elseif isa(a, QuoteNode) && a.value === oldname.name
args[i] = QuoteNode(newname.name)
elseif isa(a, Vector{Any})
replacename!(a, pr)
elseif isa(a, Core.ReturnNode) && isdefined(a, :val) && a.val isa Expr
# there is something like `ReturnNode(Expr(:method, Symbol(...)))`
replacename!(a.val::Expr, pr)
elseif a === oldname
args[i] = newname
elseif isa(a, Symbol) && a == oldname.name
elseif a == oldname.name
args[i] = newname.name
end
end
Expand Down
Loading