Skip to content

Commit

Permalink
Get Cthulhu working
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Atol committed Apr 1, 2022
1 parent 409226d commit 5660b85
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ function abstract_call_method_with_const_args(interp::AbstractInterpreter, resul
code = get(mi_cache, mi, nothing)
if code !== nothing
ir = codeinst_to_ir(interp, code)
if ir !== nothing
if isa(ir, IRCode)
T = ir_abstract_constant_propagation(interp, mi_cache, sv, mi, ir, arginfo.argtypes)
if !isa(T, Type) || typeintersect(T, Bool) === Union{}
return ConstCallResults(T, SemiConcreteResult(mi, ir, result.edge_effects), result.edge_effects)
Expand Down
12 changes: 7 additions & 5 deletions base/compiler/ssair/irinterp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ function codeinst_to_ir(interp::AbstractInterpreter, code::CodeInstance)
src = code.inferred
mi = code.def

src === nothing && return src
isa(src, Union{CodeInfo, Vector{UInt8}}) || return src

if !isa(src, CodeInfo)
if isa(src, Vector{UInt8})
src = ccall(:jl_uncompress_ir, Any, (Any, Ptr{Cvoid}, Any), mi.def, C_NULL, src::Vector{UInt8})::CodeInfo
end

Expand Down Expand Up @@ -83,8 +83,10 @@ function complete!(tpdum::TwoPhaseDefUseMap)
end

function TwoPhaseDefUseMap(nssas::Int)
TwoPhaseDefUseMap(zeros(Int, nssas),
Int[], false)
ssa_uses = zeros(Int, nssas)
data = Int[]
complete = false
return TwoPhaseDefUseMap(ssa_uses, data, complete)
end

function count!(tpdum::TwoPhaseDefUseMap, arg::SSAValue)
Expand All @@ -100,7 +102,7 @@ function kill_def_use!(tpdum::TwoPhaseDefUseMap, def::Int, use::Int)
end
end
kill_def_use!(tpdum::TwoPhaseDefUseMap, def::SSAValue, use::Int) =
kill_def_use!(tpdum::TwoPhaseDefUseMap, def.id, use)
kill_def_use!(tpdum, def.id, use)

function getindex(tpdum::TwoPhaseDefUseMap, idx::Int)
@assert tpdum.complete
Expand Down
2 changes: 1 addition & 1 deletion base/compiler/typeinfer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ function typeinf_edge(interp::AbstractInterpreter, method::Method, @nospecialize
if code isa CodeInstance # return existing rettype if the code is already inferred
if code.inferred === nothing && is_stmt_inline(get_curr_ssaflag(caller))
# we already inferred this edge previously and decided to discarded the inferred code
# but the inlinear will request to use it, we re-infer it here and keep it around in the local cache
# but the inliner will request to use it, we re-infer it here and keep it around in the local cache
cache = :local
else
effects = ipo_effects(code)
Expand Down

0 comments on commit 5660b85

Please sign in to comment.