From 83ce7ba119ae49f968a74f64e423e0ff5c2fbc71 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Fri, 8 Jun 2018 14:40:00 -0400 Subject: [PATCH] improve some method signatures --- base/compiler/optimize.jl | 22 ++++++++++------------ base/compiler/ssair/inlining2.jl | 5 +++-- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/base/compiler/optimize.jl b/base/compiler/optimize.jl index 492c3e9214baf..48af74cd68807 100644 --- a/base/compiler/optimize.jl +++ b/base/compiler/optimize.jl @@ -66,8 +66,6 @@ function OptimizationState(linfo::MethodInstance, params::Params) return OptimizationState(linfo, src, params) end -include("compiler/ssair/driver.jl") - _topmod(sv::OptimizationState) = _topmod(sv.mod) function update_valid_age!(min_valid::UInt, max_valid::UInt, sv::OptimizationState) @@ -343,17 +341,15 @@ function finish(me::InferenceState) nothing end -function maybe_widen_conditional(vt) - if isa(vt, Conditional) - if vt.vtype === Bottom - vt = Const(false) - elseif vt.elsetype === Bottom - vt = Const(true) - else - vt = Bool - end +maybe_widen_conditional(@nospecialize vt) = vt +function maybe_widen_conditional(vt::Conditional) + if vt.vtype === Bottom + Const(false) + elseif vt.elsetype === Bottom + Const(true) + else + Bool end - vt end function annotate_slot_load!(e::Expr, vtypes::VarTable, sv::InferenceState, undefs::Array{Bool,1}) @@ -988,3 +984,5 @@ function return_type(@nospecialize(f), @nospecialize(t)) end return rt end + +include("compiler/ssair/driver.jl") diff --git a/base/compiler/ssair/inlining2.jl b/base/compiler/ssair/inlining2.jl index 94f420eb1892f..3433c54f86ec8 100644 --- a/base/compiler/ssair/inlining2.jl +++ b/base/compiler/ssair/inlining2.jl @@ -577,8 +577,9 @@ function singleton_type(@nospecialize(ft)) return nothing end -function analyze_method!(idx, f, ft, metharg, methsp, method, stmt, atypes, sv, atype_unlimited, isinvoke, isapply, invoke_data, - stmttyp) +function analyze_method!(idx::Int, @nospecialize(f), @nospecialize(ft), @nospecialize(metharg), methsp::SimpleVector, + method::Method, stmt::Expr, atypes::Vector{Any}, sv::OptimizationState, @nospecialize(atype_unlimited), + isinvoke::Bool, isapply::Bool, invoke_data::Union{InvokeData,Nothing}, @nospecialize(stmttyp)) methsig = method.sig # Check whether this call just evaluates to a constant