Skip to content

Commit a842a77

Browse files
committed
fix interpretation of opaque closures on nightly
This is the best way I could think of to determine whether an OC contains inferred code after JuliaLang/julia#53219. Also deletes a fastpath we had for OCs containing inferred code in `maybe_evaluate_builtin` as it doesn't really seem necessary and we would otherwise scan the IR twice for OCs we do want to interpret.
1 parent ea16ee6 commit a842a77

File tree

3 files changed

+4
-21
lines changed

3 files changed

+4
-21
lines changed

bin/generate_builtins.jl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,6 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
132132
f = @lookup(frame, fex)
133133
end
134134
135-
if @static isdefined(Core, :OpaqueClosure) && f isa Core.OpaqueClosure
136-
if expand
137-
if !Core.Compiler.uncompressed_ir(f.source).inferred
138-
return Expr(:call, f, args[2:end]...)
139-
else
140-
@debug "not interpreting opaque closure \$f since it contains inferred code"
141-
end
142-
end
143-
return Some{Any}(f(args...))
144-
end
145135
if !(isa(f, Core.Builtin) || isa(f, Core.IntrinsicFunction))
146136
return call_expr
147137
end

src/builtins.jl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,6 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
3838
f = @lookup(frame, fex)
3939
end
4040

41-
if @static isdefined(Core, :OpaqueClosure) && f isa Core.OpaqueClosure
42-
if expand
43-
if !Core.Compiler.uncompressed_ir(f.source).inferred
44-
return Expr(:call, f, args[2:end]...)
45-
else
46-
@debug "not interpreting opaque closure $f since it contains inferred code"
47-
end
48-
end
49-
return Some{Any}(f(args...))
50-
end
5141
if !(isa(f, Core.Builtin) || isa(f, Core.IntrinsicFunction))
5242
return call_expr
5343
end

src/construct.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,10 @@ function prepare_call(@nospecialize(f), allargs; enter_generated = false)
244244
if @static isdefined(Core, :OpaqueClosure) && f isa Core.OpaqueClosure
245245
method = f.source
246246
# don't try to interpret optimized ir
247-
if Core.Compiler.uncompressed_ir(method).inferred
247+
is_inferred_ir = any(Core.Compiler.uncompressed_ir(f.source).code) do stmt
248+
stmt isa Core.PiNode || stmt isa Core.PhiNode || stmt isa Core.PhiCNode || stmt isa Core.UpsilonNode
249+
end
250+
if is_inferred_ir
248251
@debug "not interpreting opaque closure $f since it contains inferred code"
249252
return nothing
250253
end

0 commit comments

Comments
 (0)