Skip to content

Commit

Permalink
turn off inline_partialmatch optimization due to #7074
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Jun 4, 2014
1 parent 7638658 commit 0cc5968
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
20 changes: 19 additions & 1 deletion base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1853,6 +1853,17 @@ function without_linenums(a::Array{Any,1})
l
end

contains_typevar(T::ANY) = false
contains_typevar(T::TypeVar) = true
function contains_typevar(T::DataType)
for p in T.parameters
if contains_typevar(p)
return true
end
end
return false
end

const _pure_builtins = {tuple, tupleref, tuplelen, fieldtype, apply_type, is, isa, typeof, typeassert} # known affect-free calls (also effect-free)
const _pure_builtins_volatile = {getfield, arrayref} # known effect-free calls (might not be affect-free)

Expand Down Expand Up @@ -2042,7 +2053,7 @@ function inlineable(f, e::Expr, atypes, sv, enclosing_ast)
sp = tuple(sp..., linfo.sparams...)
spvals = { sp[i] for i in 2:2:length(sp) }
for i=1:length(spvals)
if isa(spvals[i],TypeVar)
if contains_typevar(spvals[i])
return NF
end
if isa(spvals[i],Symbol)
Expand All @@ -2054,6 +2065,9 @@ function inlineable(f, e::Expr, atypes, sv, enclosing_ast)
nm = length(methargs)
if !(atypes <: methargs)
incompletematch = true
if !inline_incompletematch_allowed
return NF
end
else
incompletematch = false
end
Expand Down Expand Up @@ -2421,6 +2435,10 @@ function inlineable(f, e::Expr, atypes, sv, enclosing_ast)
end
return (expr, stmts)
end
# The inlining incomplete matches optimization doesn't work well during the first
# pass of bootstrapping, since it assumes the method call list is relatively stable.
# It is disabled here, and enabled later in sysimg.jl
inline_incompletematch_allowed = false

inline_worthy(body, cost::Real) = true
function inline_worthy(body::Expr, cost::Real=1.0) # precondition: 0<cost
Expand Down
4 changes: 3 additions & 1 deletion src/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,9 @@ DLLEXPORT size_t jl_static_show(JL_STREAM *out, jl_value_t *v)
n += jl_static_show(out, ((jl_typector_t*)v)->body);
}
else if (jl_is_typevar(v)) {
n += JL_PRINTF(out, "%s", ((jl_tvar_t*)v)->name->name);
n += jl_static_show(out, ((jl_tvar_t*)v)->lb);
n += JL_PRINTF(out, "<:%s<:", ((jl_tvar_t*)v)->name->name);
n += jl_static_show(out, ((jl_tvar_t*)v)->ub);
}
else if (jl_is_module(v)) {
jl_module_t *m = (jl_module_t*)v;
Expand Down

0 comments on commit 0cc5968

Please sign in to comment.