Skip to content

Commit 1d42379

Browse files
authored
fix call_with_reactant_generator for Julia 1.11 (#359)
1 parent 91094d8 commit 1d42379

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/utils.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,10 @@ function call_with_reactant_generator(world::UInt, source::LineNumberNode, self,
237237
interp = ReactantInterpreter(; world)
238238

239239
sig = Tuple{args...}
240-
lookup_result = Core.Compiler.findall(sig, Core.Compiler.method_table(interp)).matches
240+
lookup_result = Core.Compiler.findall(sig, Core.Compiler.method_table(interp))
241+
@static if VERSION < v"1.11-"
242+
lookup_result = lookup_result.matches
243+
end
241244

242245
if lookup_result === nothing || lookup_result === missing
243246
return stub(world, source, method_error)
@@ -259,6 +262,10 @@ function call_with_reactant_generator(world::UInt, source::LineNumberNode, self,
259262
frame = Core.Compiler.InferenceState(result, #=cache_mode=#:local, interp)
260263
@assert frame !== nothing
261264
Core.Compiler.typeinf(interp, frame)
265+
@static if VERSION >= v"1.11"
266+
# `typeinf` doesn't update the cfg. We need to do it manually.
267+
frame.cfg = Core.Compiler.compute_basic_blocks(frame.src.code)
268+
end
262269
@assert Core.Compiler.is_inferred(frame)
263270

264271
method = match.method
@@ -279,7 +286,7 @@ function call_with_reactant_generator(world::UInt, source::LineNumberNode, self,
279286
ir = Core.Compiler.run_passes(opt.src, opt, caller)
280287
else
281288
ir = Core.Compiler.run_passes_ipo_safe(opt.src, opt, caller)
282-
Core.Compiler.ipo_dataflow_analysis!(interp, opt, ir, caller)
289+
Core.Compiler.ipo_dataflow_analysis!(interp, ir, caller)
283290
end
284291

285292
@show ir

0 commit comments

Comments
 (0)