Skip to content

Commit

Permalink
some compiler performance improvements (#26897)
Browse files Browse the repository at this point in the history
mostly due to avoiding specialization of closures in comprehensions in the compiler itself
  • Loading branch information
JeffBezanson authored and ararslan committed May 8, 2018
1 parent 4bfabb6 commit 93ca169
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion base/expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ copy(e::Expr) = (n = Expr(e.head);
# copy parts of an AST that the compiler mutates
copy_exprs(x::Expr) = copy(x)
copy_exprs(x::ANY) = x
copy_exprargs(x::Array{Any,1}) = Any[copy_exprs(a) for a in x]
copy_exprargs(x::Array{Any,1}) = Any[copy_exprs(x[i]) for i in 1:length(x)]

==(x::Expr, y::Expr) = x.head === y.head && isequal(x.args, y.args)
==(x::QuoteNode, y::QuoteNode) = isequal(x.value, y.value)
Expand Down
8 changes: 4 additions & 4 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,7 @@ function precise_container_type(arg::ANY, typ::ANY, vtypes::VarTable, sv::Infere
if isa(typ, Const)
val = typ.val
if isa(val, SimpleVector) || isa(val, Tuple)
return Any[ abstract_eval_constant(x) for x in val ]
return Any[ abstract_eval_constant(val[i]) for i in 1:length(val) ]
end
end

Expand Down Expand Up @@ -1898,7 +1898,7 @@ function abstract_call(f::ANY, fargs::Union{Tuple{},Vector{Any}}, argtypes::Vect
end

function abstract_eval_call(e::Expr, vtypes::VarTable, sv::InferenceState)
argtypes = Any[abstract_eval(a, vtypes, sv) for a in e.args]
argtypes = Any[abstract_eval(e.args[i], vtypes, sv) for i in 1:length(e.args)]
#print("call ", e.args[1], argtypes, "\n\n")
for x in argtypes
x === Bottom && return Bottom
Expand Down Expand Up @@ -4459,12 +4459,12 @@ function inlining_pass(e::Expr, sv::InferenceState, stmts, ins)
newargs[i-2] = aarg.args[2:end]
elseif isa(argt,Const) && (isa(argt.val, Tuple) || isa(argt.val, SimpleVector)) &&
effect_free(aarg, sv.src, sv.mod, true)
newargs[i-2] = Any[ QuoteNode(x) for x in argt.val ]
newargs[i-2] = Any[ QuoteNode(argt.val[i]) for i in 1:length(argt.val) ]
elseif isa(aarg, Tuple) || (isa(aarg, QuoteNode) && (isa(aarg.value, Tuple) || isa(aarg.value, SimpleVector)))
if isa(aarg, QuoteNode)
aarg = aarg.value
end
newargs[i-2] = Any[ QuoteNode(x) for x in aarg ]
newargs[i-2] = Any[ QuoteNode(aarg[i]) for i in 1:length(aarg) ]
elseif isa(t, DataType) && t.name === Tuple.name && !isvatuple(t) &&
length(t.parameters) <= sv.params.MAX_TUPLE_SPLAT
for k = (effect_free_upto+1):(i-3)
Expand Down
2 changes: 1 addition & 1 deletion base/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ false
"""
isbits(t::DataType) = (@_pure_meta; !t.mutable & (t.layout != C_NULL) && datatype_pointerfree(t))
isbits(t::Type) = (@_pure_meta; false)
isbits(x) = (@_pure_meta; isbits(typeof(x)))
isbits(x::ANY) = (@_pure_meta; isbits(typeof(x)))

"""
isleaftype(T)
Expand Down

0 comments on commit 93ca169

Please sign in to comment.