Skip to content

Commit fb9155a

Browse files
committed
Put MAX_TYPEUNION_LEN in InferenceParams, relying in global state for now.
1 parent 70b2fe8 commit fb9155a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

base/inference.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
import Core: _apply, svec, apply_type, Builtin, IntrinsicFunction
44

55
#### parameters limiting potentially-infinite types ####
6-
const MAX_TYPEUNION_LEN = 3
7-
8-
const UNION_SPLIT_MISMATCH_ERROR = false
9-
106
immutable InferenceParams
7+
MAX_TYPEUNION_LEN
118
MAX_TYPE_DEPTH
129
MAX_TUPLETYPE_LEN
10+
MAX_TUPLE_DEPTH
11+
1312
MAX_TUPLE_SPLAT
1413
MAX_UNION_SPLITTING
15-
MAX_TUPLE_DEPTH
1614
end
17-
const DEFAULT_PARAMS = InferenceParams(7, 15, 16, 4, 4)
15+
const DEFAULT_PARAMS = InferenceParams(3, 7, 15, 16, 4, 4)
16+
17+
const UNION_SPLIT_MISMATCH_ERROR = false
1818

1919
# alloc_elim_pass! relies on `Slot_AssignedOnce | Slot_UsedUndef` being
2020
# SSA. This should be true now but can break if we start to track conditional
@@ -1334,7 +1334,7 @@ function tmerge(typea::ANY, typeb::ANY)
13341334
end
13351335
end
13361336
u = Union{typea, typeb}
1337-
if length(u.types) > MAX_TYPEUNION_LEN || type_too_complex(u, 0, global_sv) # FIXME: use of global_sv
1337+
if length(u.types) > global_sv.params.MAX_TYPEUNION_LEN || type_too_complex(u, 0, global_sv)
13381338
# don't let type unions get too big
13391339
# TODO: something smarter, like a common supertype
13401340
return Any

demo.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ end
4848
hooks = Core.Inference.InferenceHooks(call_hook)
4949

5050
# raise limits on inference parameters, performing a more exhaustive search
51-
params = Core.Inference.InferenceParams(7, 15, 16, 4, 4)
51+
params = Core.Inference.InferenceParams(3, 7, 15, 16, 4, 4)
5252

5353
(linfo, rettyp, inferred) =
5454
Core.Inference.typeinf_uncached(m, sig, spvals, optimize=true,

0 commit comments

Comments
 (0)