diff options
author | Kostis Sagonas <[email protected]> | 2010-12-13 15:37:43 +0200 |
---|---|---|
committer | Kostis Sagonas <[email protected]> | 2010-12-13 15:37:43 +0200 |
commit | 8b92ac49d021b4634d660c5b2637c3ebec0f1d9f (patch) | |
tree | 80b020fd6983989e6107b2fd414312165206edd2 /lib/hipe/cerl/erl_types.erl | |
parent | 9f4dd4934d427f0fb2caeb034115e0227cc4610a (diff) | |
download | otp-8b92ac49d021b4634d660c5b2637c3ebec0f1d9f.tar.gz otp-8b92ac49d021b4634d660c5b2637c3ebec0f1d9f.tar.bz2 otp-8b92ac49d021b4634d660c5b2637c3ebec0f1d9f.zip |
Fix native code compiler infinite loop and update type info for 're'
The introduction of filenames being unicode binaries revealed a problem
in the type analysis of the native code compiler which resulted in an
infinite loop when compiling the 'filename' module.
In addition, the hard-coded type information for the built-in functions
of the 're' module was out-of-date, which resulted in erroneous type
information for 'filelib' functions being stored in the PLT.
Diffstat (limited to 'lib/hipe/cerl/erl_types.erl')
-rw-r--r-- | lib/hipe/cerl/erl_types.erl | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/hipe/cerl/erl_types.erl b/lib/hipe/cerl/erl_types.erl index 1ed85af172..c8dc162457 100644 --- a/lib/hipe/cerl/erl_types.erl +++ b/lib/hipe/cerl/erl_types.erl @@ -62,6 +62,7 @@ t_boolean/0, t_byte/0, t_char/0, + t_charlist/0, t_collect_vars/1, t_cons/0, t_cons/2, @@ -1455,6 +1456,21 @@ t_is_tuple(_) -> false. %% Non-primitive types, including some handy syntactic sugar types %% +-spec t_charlist() -> erl_type(). + +t_charlist() -> + t_charlist(1). + +-spec t_charlist(non_neg_integer()) -> erl_type(). + +t_charlist(N) when N > 0 -> + t_maybe_improper_list(t_sup([t_unicode_char(), + t_unicode_binary(), + t_charlist(N-1)]), + t_sup(t_unicode_binary(), t_nil())); +t_charlist(0) -> + t_maybe_improper_list(t_any(), t_sup(t_unicode_binary(), t_nil())). + -spec t_constant() -> erl_type(). t_constant() -> @@ -1549,6 +1565,16 @@ t_parameterized_module() -> t_timeout() -> t_sup(t_non_neg_integer(), t_atom('infinity')). +-spec t_unicode_binary() -> erl_type(). + +t_unicode_binary() -> + t_binary(). % with characters encoded in UTF-8 coding standard + +-spec t_unicode_char() -> erl_type(). + +t_unicode_char() -> + t_integer(). % representing a valid unicode codepoint + %%----------------------------------------------------------------------------- %% Some built-in opaque types %% @@ -2825,7 +2851,7 @@ t_subtract(?list(Contents1, Termination1, Size1) = T, true -> case {Size1, Size2} of {?nonempty_qual, ?unknown_qual} -> ?none; - {?unknown_qual, ?nonempty_qual} -> Termination1; + {?unknown_qual, ?nonempty_qual} -> ?nil; {S, S} -> ?none end; false -> |