Skip to content

Commit

Permalink
parameterize Core.Compiler.optimize on AbstractInterpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy committed Nov 3, 2020
1 parent 8b44973 commit 14beadd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion base/compiler/optimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ function finish(opt::OptimizationState, params::OptimizationParams, ir, @nospeci
end

# run the optimization work
function optimize(opt::OptimizationState, params::OptimizationParams, @nospecialize(result))
function optimize(interp::AbstractInterpreter, opt::OptimizationState, params::OptimizationParams, @nospecialize(result))
nargs = Int(opt.nargs) - 1
@timeit "optimizer" ir = run_passes(opt.src, nargs, opt)
finish(opt, params, ir, result)
Expand Down
4 changes: 2 additions & 2 deletions base/compiler/typeinfer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function _typeinf(interp::AbstractInterpreter, frame::InferenceState)
if opt isa OptimizationState
run_optimizer = doopt && may_optimize(interp)
if run_optimizer
optimize(opt, OptimizationParams(interp), caller.result)
optimize(interp, opt, OptimizationParams(interp), caller.result)
finish(opt.src, interp)
# finish updating the result struct
validate_code_in_debug_mode(opt.linfo, opt.src, "optimized")
Expand Down Expand Up @@ -768,7 +768,7 @@ function typeinf_code(interp::AbstractInterpreter, method::Method, @nospecialize
if typeinf(interp, frame) && run_optimizer
opt_params = OptimizationParams(interp)
opt = OptimizationState(frame, opt_params, interp)
optimize(opt, opt_params, result.result)
optimize(interp, opt, opt_params, result.result)
opt.src.inferred = true
end
ccall(:jl_typeinf_end, Cvoid, ())
Expand Down

0 comments on commit 14beadd

Please sign in to comment.