From 14beadd6d105744d9ed6524dde25652e6f8ce61e Mon Sep 17 00:00:00 2001 From: Valentin Churavy Date: Mon, 2 Nov 2020 20:21:09 -0500 Subject: [PATCH] parameterize Core.Compiler.optimize on AbstractInterpreter --- base/compiler/optimize.jl | 2 +- base/compiler/typeinfer.jl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/base/compiler/optimize.jl b/base/compiler/optimize.jl index 0d6eaec0f3142..9cdeb94c3c79d 100644 --- a/base/compiler/optimize.jl +++ b/base/compiler/optimize.jl @@ -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) diff --git a/base/compiler/typeinfer.jl b/base/compiler/typeinfer.jl index 04c0edb9a0fde..dedc042dcaa46 100644 --- a/base/compiler/typeinfer.jl +++ b/base/compiler/typeinfer.jl @@ -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") @@ -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, ())