From af40b502b72903b9069b8b11286d561b96d2cbcf Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Tue, 7 May 2024 15:06:59 -0400 Subject: [PATCH] Adjust to upcoming julia#54341 (#125) The feature check is done using julia#53849 (which is itself a bit of an experiment), so the idea is to merge/tag this before the base PR is merged to prevent breakage on julia master. See also https://github.com/JuliaDiff/Diffractor.jl/pull/292 --- src/eval.jl | 4 ++++ src/reflection/dynamo.jl | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/eval.jl b/src/eval.jl index 14ccf4f..59e0f2f 100644 --- a/src/eval.jl +++ b/src/eval.jl @@ -15,6 +15,10 @@ function build_codeinfo(ir::IR) push!(ci.slotnames, Symbol("")) push!(ci.slotflags, 0) end + if isdefined(Base, :__has_internal_change) && Base.__has_internal_change(v"1.12-alpha", :codeinfonargs) + ci.nargs = length(arguments(ir)) + 1 + ci.isva = false + end argument!(ir, at = 1) update!(ci, ir) end diff --git a/src/reflection/dynamo.jl b/src/reflection/dynamo.jl index daff4bb..fa4942a 100644 --- a/src/reflection/dynamo.jl +++ b/src/reflection/dynamo.jl @@ -100,6 +100,10 @@ function dynamo(cache, world, f, args...) m === nothing && error("Error looking up metadata for $f") m.code.method_for_inference_limit_heuristics = nothing end + if isdefined(Base, :__has_internal_change) && Base.__has_internal_change(v"1.12-alpha", :codeinfonargs) + m.code.nargs = 2 + m.code.isva = true + end _self = splicearg!(ir) prewalk!(x -> x === self ? _self : x, ir) return update!(m.code, ir) @@ -112,6 +116,10 @@ function dynamo_lambda(cache, world, f::Type{<:Lambda{S,I}}) where {S,I} closureargs!(ir) m = @meta world dummy(1) m.code.method_for_inference_limit_heuristics = nothing + if isdefined(Base, :__has_internal_change) && Base.__has_internal_change(v"1.12-alpha", :codeinfonargs) + m.code.nargs = 2 + m.code.isva = true + end return update!(m.code, ir) end