Skip to content

Commit f791f4a

Browse files
authored
1 parent 2d4f5ce commit f791f4a

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

src/stage2/interpreter.jl

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,13 @@ Cthulhu.get_cursor(c::ADCursor, cs::Cthulhu.Callsite) = Cthulhu.get_cursor(c, cs
1515
Cthulhu.get_cursor(c::ADCursor, callinfo) = ADCursor(c.level, Cthulhu.get_mi(callinfo))
1616
=#
1717

18-
1918
struct ADGraph
2019
code::OffsetVector{Dict{MethodInstance, Any}}
2120
msgs::Vector{Tuple{Int, MethodInstance, Int, String}}
2221
entry_mi::MethodInstance
2322
end
2423
entrypoint(graph::ADGraph) = ADCursor(0, graph.entry_mi)
2524

26-
#=
27-
Compiler3.has_codeinfo(graph::ADGraph, cursor::ADCursor) =
28-
lastindex(graph.code) >= cursor.level && haskey(graph.code[cursor.level], cursor.mi)
29-
function Compiler3.get_codeinstance(graph::ADGraph, cursor::ADCursor)
30-
return graph.code[cursor.level][cursor.mi]
31-
end
32-
=#
33-
3425
using Core: MethodInstance, CodeInstance
3526
using .CC: AbstractInterpreter, ArgInfo, Effects, InferenceResult, InferenceState,
3627
IRInterpretationState, NativeInterpreter, OptimizationState, StmtInfo, WorldRange
@@ -275,23 +266,17 @@ CC.may_compress(ei::ADInterpreter) = false
275266
CC.may_discard_trees(ei::ADInterpreter) = false
276267

277268
function CC.add_remark!(interp::ADInterpreter, sv::InferenceState, msg)
278-
key = CC.any(sv.result.overridden_by_const) ? sv.result : sv.linfo
269+
key = (@static VERSION v"1.12.0-DEV.317" ? CC.is_constproped(sv) : CC.any(sv.result.overridden_by_const)) ? sv.result : sv.linfo
279270
push!(get!(Cthulhu.PC2Remarks, interp.remarks[interp.current_level], key), sv.currpc=>msg)
280271
end
281272

282273
# TODO: `get_remarks` should get a cursor?
283274
Cthulhu.get_remarks(interp::ADInterpreter, key::Union{MethodInstance,InferenceResult}) = get(interp.remarks[interp.current_level], key, nothing)
284275

285-
#=
286-
function CC.const_prop_heuristic(interp::AbstractInterpreter, method::Method, mi::MethodInstance)
287-
return true
288-
end
289-
=#
290-
291-
function CC.finish(state::InferenceState, interp::ADInterpreter)
292-
res = @invoke CC.finish(state::InferenceState, interp::AbstractInterpreter)
293-
key = CC.any(state.result.overridden_by_const) ? state.result : state.linfo
294-
interp.unopt[interp.current_level][key] = Cthulhu.InferredSource(state)
276+
function CC.finish(sv::InferenceState, interp::ADInterpreter)
277+
res = @invoke CC.finish(sv::InferenceState, interp::AbstractInterpreter)
278+
key = (@static VERSION v"1.12.0-DEV.317" ? CC.is_constproped(sv) : CC.any(sv.result.overridden_by_const)) ? sv.result : sv.linfo
279+
interp.unopt[interp.current_level][key] = Cthulhu.InferredSource(sv)
295280
return res
296281
end
297282

0 commit comments

Comments
 (0)