From 677f5373d3c5d87b99e798edc789ca6bdf58f5d6 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Fri, 15 May 2015 23:31:07 -0400 Subject: [PATCH] switch inlining costs to use scaled integer math. this removes the need for floating point numbers in inference. --- base/inference.jl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/base/inference.jl b/base/inference.jl index dd49144dcab86..621d2141cd131 100644 --- a/base/inference.jl +++ b/base/inference.jl @@ -2303,12 +2303,12 @@ function inlineable(f::ANY, e::Expr, atype::ANY, sv::StaticVarInfo, enclosing_as body = Expr(:block) body.args = without_linenums(ast.args[3].args)::Array{Any,1} need_mod_annotate = true - cost = 1.0 + cost::Int = 1000 if incompletematch cost *= 4 end if is(f, next) || is(f, done) || is(f, unsafe_convert) || is(f, cconvert) - cost /= 4 + cost ÷= 4 end inline_op = (f===(+) || f===(*) || f===min || f===max) && (3 <= length(argexprs) <= 9) && meth[3].sig == Tuple{Any,Any,Any,Vararg{Any}} @@ -2676,17 +2676,18 @@ end # doesn't work on Tuples of TypeVars const inline_incompletematch_allowed = false -inline_worthy(body, cost::Real) = true -function inline_worthy(body::Expr, cost::Real=1.0) # precondition: 0true, symlim) < symlim return true end