From 6e038f2873eee217756b1a7962bc23c8aec9c2c1 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Tue, 16 Sep 2025 19:46:08 +0000 Subject: [PATCH 1/2] fix more replacename changes required Missed in f111efebb594e08fbf00d8768123da5944458f57, caught in trying to test https://github.com/JuliaLang/julia/pull/58279. --- src/signatures.jl | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/signatures.jl b/src/signatures.jl index 3a3378c..f3ac837 100644 --- a/src/signatures.jl +++ b/src/signatures.jl @@ -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 @@ -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) @@ -417,6 +414,8 @@ 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 @@ -424,7 +423,7 @@ function replacename!(args::AbstractVector, pr) 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 From 6c56ad111665018ef765f2acc70a9593c9a5a834 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Wed, 17 Sep 2025 14:21:57 -0400 Subject: [PATCH 2/2] Revert "use `isdefinedglobal` instead of `isdefined`" (#136) This reverts commit 5736a50b15162e4b70658a69e36ed4d7b9123ca2. There doesn't seem to be any explanation for this change, and it breaks on old versions. --- src/packagedef.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/packagedef.jl b/src/packagedef.jl index fd529c8..21c7d21 100644 --- a/src/packagedef.jl +++ b/src/packagedef.jl @@ -2,7 +2,7 @@ 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: @@ -10,7 +10,7 @@ using .CC: 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