From 0efefcda3cfa7378d2ce0897b9c483935dc0c394 Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Sun, 5 May 2024 23:03:28 +0000 Subject: [PATCH] Adjust to upcoming julia#54341 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. --- src/codegen/reverse.jl | 8 ++++++++ src/stage1/recurse.jl | 5 +++++ src/stage1/recurse_fwd.jl | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/src/codegen/reverse.jl b/src/codegen/reverse.jl index fff17b77..d00d5802 100644 --- a/src/codegen/reverse.jl +++ b/src/codegen/reverse.jl @@ -111,9 +111,17 @@ function diffract_ir!(ir, ci, meth, sparams::Core.SimpleVector, nargs::Int, N::I if nc % 2 == 1 opaque_ci.slotnames = Symbol[Symbol("#self#"), :Δ] opaque_ci.slotflags = UInt8[0, 0] + if isdefined(Base, :__has_internal_change) && Base.__has_internal_change(v"1.12-alpha", :codeinfonargs) + opaque_ci.nargs = 2 + opaque_ci.isva = false + end else opaque_ci.slotnames = [Symbol("#oc#"), ci.slotnames...] opaque_ci.slotflags = UInt8[0, ci.slotflags...] + if isdefined(Base, :__has_internal_change) && Base.__has_internal_change(v"1.12-alpha", :codeinfonargs) + opaque_ci.nargs = 1 + ci.nargs + opaque_ci.isva = ci.isva + end end @static if VERSION ≥ v"1.12.0-DEV.173" opaque_ci.debuginfo = ci.debuginfo diff --git a/src/stage1/recurse.jl b/src/stage1/recurse.jl index 39131d80..a1240418 100644 --- a/src/stage1/recurse.jl +++ b/src/stage1/recurse.jl @@ -314,5 +314,10 @@ function optic_transform!(ci::CodeInfo, mi::MethodInstance, nargs::Int, N::Int) ci.method_for_inference_limit_heuristics = meth ci.edges = MethodInstance[mi] + if isdefined(Base, :__has_internal_change) && Base.__has_internal_change(v"1.12-alpha", :codeinfonargs) + ci.nargs = 2 + ci.isva = true + end + return ci end diff --git a/src/stage1/recurse_fwd.jl b/src/stage1/recurse_fwd.jl index efb31611..a01084d4 100644 --- a/src/stage1/recurse_fwd.jl +++ b/src/stage1/recurse_fwd.jl @@ -210,6 +210,11 @@ function fwd_transform!(ci::CodeInfo, mi::MethodInstance, nargs::Int, N::Int, E) ci.method_for_inference_limit_heuristics = meth ci.edges = MethodInstance[mi] + if isdefined(Base, :__has_internal_change) && Base.__has_internal_change(v"1.12-alpha", :codeinfonargs) + ci.nargs = 2 + ci.isva = true + end + return ci end