Skip to content

Commit

Permalink
move code around
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Feb 14, 2024
1 parent 8e80469 commit 56520e0
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/abstractinterpret/typeinfer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,21 +212,6 @@ function CC.getindex(wvc::WorldView{<:AbstractAnalyzerView}, mi::MethodInstance)
return codeinst::CodeInstance
end

function CC.transform_result_for_cache(analyzer::AbstractAnalyzer,
linfo::MethodInstance, valid_worlds::WorldRange, result::InferenceResult)
cache = InferenceErrorReport[]
for report in get_any_reports(analyzer, result)
@static if JET_DEV_MODE
actual, expected = first(report.vst).linfo, linfo
@assert actual === expected "invalid global caching detected, expected $expected but got $actual"
end
cache_report!(cache, report)
end
inferred_result = @invoke transform_result_for_cache(analyzer::AbstractInterpreter,
linfo::MethodInstance, valid_worlds::WorldRange, result::InferenceResult)
return CachedAnalysisResult(inferred_result, cache)
end

function CC.setindex!(wvc::WorldView{<:AbstractAnalyzerView}, codeinst::CodeInstance, mi::MethodInstance)
analysis_cache = AnalysisCache(wvc)
@static if VERSION < v"1.11.0-DEV.1552"
Expand Down Expand Up @@ -545,6 +530,21 @@ function CC.cache_result!(analyzer::AbstractAnalyzer, caller::InferenceResult)
@invoke CC.cache_result!(analyzer::AbstractInterpreter, caller::InferenceResult)
end

function CC.transform_result_for_cache(analyzer::AbstractAnalyzer,
linfo::MethodInstance, valid_worlds::WorldRange, result::InferenceResult)
cache = InferenceErrorReport[]
for report in get_any_reports(analyzer, result)
@static if JET_DEV_MODE
actual, expected = first(report.vst).linfo, linfo
@assert actual === expected "invalid global caching detected, expected $expected but got $actual"
end
cache_report!(cache, report)
end
inferred_result = @invoke transform_result_for_cache(analyzer::AbstractInterpreter,
linfo::MethodInstance, valid_worlds::WorldRange, result::InferenceResult)
return CachedAnalysisResult(inferred_result, cache)
end

# top-level bridge
# ================

Expand Down

0 comments on commit 56520e0

Please sign in to comment.