Skip to content

Commit

Permalink
don't cache top-level frames
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Jan 15, 2024
1 parent e4aaf29 commit 9b56ddc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/JET.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ get_slotname(sv::State, slot::Int) = sv.src.slotnames[slot]

# check if we're in a toplevel module
istoplevel(sv::State) = istoplevel(sv.linfo)
istoplevel(linfo::MethodInstance) = isa(linfo.def, Module)
istoplevel(mi::MethodInstance) = isa(mi.def, Module)

# we can retrieve program-counter-level slottype during inference
get_slottype(s::Tuple{InferenceState,Int}, slot::Int) = (get_states(s)[slot]::VarState).typ
Expand Down
5 changes: 5 additions & 0 deletions src/abstractinterpret/typeinfer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,11 @@ end

end

function CC.cache_result!(analyzer::AbstractAnalyzer, caller::InferenceResult)
istoplevel(caller.linfo) && return nothing # don't need to cache toplevel frame
@invoke CC.cache_result!(analyzer::AbstractInterpreter, caller::InferenceResult)
end

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

Expand Down

0 comments on commit 9b56ddc

Please sign in to comment.