Skip to content

Commit

Permalink
Merge branch 'master' into kf/constpropbig
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk authored Oct 23, 2022
2 parents ead2227 + c97adbb commit cbebf22
Show file tree
Hide file tree
Showing 11 changed files with 237 additions and 164 deletions.
4 changes: 2 additions & 2 deletions base/compiler/optimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ code_cache(state::InliningState) = WorldView(code_cache(state.interp), state.wor

include("compiler/ssair/driver.jl")

mutable struct OptimizationState{IState<:InliningState}
mutable struct OptimizationState{Interp<:AbstractInterpreter}
linfo::MethodInstance
src::CodeInfo
ir::Union{Nothing, IRCode}
stmt_info::Vector{CallInfo}
mod::Module
sptypes::Vector{Any}
slottypes::Vector{Any}
inlining::IState
inlining::InliningState{Interp}
cfg::Union{Nothing,CFG}
end
function OptimizationState(frame::InferenceState, params::OptimizationParams,
Expand Down
16 changes: 10 additions & 6 deletions base/compiler/ssair/EscapeAnalysis/EscapeAnalysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import ._TOP_MOD: # Base definitions
pop!, push!, pushfirst!, empty!, delete!, max, min, enumerate, unwrap_unionall,
ismutabletype
import Core.Compiler: # Core.Compiler specific definitions
Bottom, InferenceResult, IRCode, IR_FLAG_NOTHROW,
Bottom, OptimizerLattice, InferenceResult, IRCode, IR_FLAG_NOTHROW,
isbitstype, isexpr, is_meta_expr_head, println, widenconst, argextype, singleton_type,
fieldcount_noerror, try_compute_field, try_compute_fieldidx, hasintersect, ,
intrinsic_nothrow, array_builtin_common_typecheck, arrayset_typecheck,
Expand Down Expand Up @@ -1596,12 +1596,16 @@ function escape_builtin!(::typeof(setfield!), astate::AnalysisState, pc::Int, ar
add_escape_change!(astate, val, ssainfo)
# compute the throwness of this setfield! call here since builtin_nothrow doesn't account for that
@label add_thrown_escapes
argtypes = Any[]
for i = 2:length(args)
push!(argtypes, argextype(args[i], ir))
if length(args) == 4 && setfield!_nothrow(OptimizerLattice(),
argextype(args[2], ir), argextype(args[3], ir), argextype(args[4], ir))
return true
elseif length(args) == 3 && setfield!_nothrow(OptimizerLattice(),
argextype(args[2], ir), argextype(args[3], ir))
return true
else
add_thrown_escapes!(astate, pc, args, 2)
return true
end
setfield!_nothrow(argtypes) || add_thrown_escapes!(astate, pc, args, 2)
return true
end

function escape_builtin!(::typeof(arrayref), astate::AnalysisState, pc::Int, args::Vector{Any})
Expand Down
Loading

0 comments on commit cbebf22

Please sign in to comment.