Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow src.slottypes === nothing for unoptimized src #445

Merged
merged 1 commit into from
Apr 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions src/interpreter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -135,24 +135,9 @@ function CC.type_annotate!(interp::CthulhuInterpreter, sv::InferenceState, run_o
end
end

function annotate_slottypes!(sv::InferenceState)
slottypes = sv.slottypes
for i = 1:length(slottypes)
slottypes[i] = CC.widenconditional(slottypes[i])
end
CC.record_slot_assign!(sv)
return sv.src.slottypes
end

function InferredSource(state::InferenceState)
unoptsrc = copy(state.src)
@static if VERSION ≥ v"1.10.0-DEV.1033"
if unoptsrc.slottypes === nothing
# `slottypes::Vector{Any}` hasn't been generated due to recursion,
# so manually generate it here
unoptsrc.slottypes = annotate_slottypes!(state)
end
else
@static if VERSION < v"1.10.0-DEV.1033"
# xref: https://github.com/JuliaLang/julia/pull/49378
unoptsrc.slottypes = let slottypes = unoptsrc.slottypes
slottypes === nothing ? nothing : copy(slottypes)
Expand Down