Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
Also, some of the branches were testing sizes in bits against a constant
?MAX_BINSIZE, which was in bytes. The signed comparisons masked this
mistake. These branches have been removed since all sizes in bits that
fit in a machine word are valid binary sizes.
Finally, a test that reproduces the issue was added to bs_construct,
along with a test for one of the cases (bs_init<0>(...)) when the test
against ?MAX_BINSIZE must be changed to unsigned rather than removed.
|
|
|
|
The HiPE compiler was leaking exceptions out of guards involving
binaries with `strange' arithmetic in them. Fixed by the set of
changes in this pull request.
|
|
Some more cases (taken from the BEAM bs_construct suite) that used to
show different behaviour than BEAM when compiled to native code were
included in the appropriate test file of the HiPE test suite.
|
|
This allows us to compile bs_match_int_SUITE with HiPE without a
system_limit crash.
|
|
Bugs were fixed in
hipe_rtl_binary_match:{first_part/3,make_size/3,set_high/1} in commit
5aea81c49, but it turns out these had been copy-pasted verbatim into
hipe_rtl_binary_construct, where they were causing further bugs. They
have now moved to hipe_rtl_binary, from where they are included by the
other two modules.
Furthermore, first_part/3 (reamed get_word_integer/3, since it loads
integers that fits into an unsigned word), and make_size/3 now accepts a
fourth argument to distinguish too large arguments (which should cause a
system_limit exception) from negative or non-integral arguments.
The use of first_part/3 (get_word_integer/3) from 5aea81c49 in
hipe_rtl_binary_construct now allows several binary construction
instructions to accept bignum sizes, as they were supposed to.
Additionally, calls to
hipe_rtl_binary_construct:check_and_untag_fixnum/3 were replaced with
get_word_integer/4 since all of them were also supposed to accept
sufficiently small bignums, but didn't, and check_and_untag_fixnum/3 was
essentially identical to first_part/3 anyway.
HiPE is now capable of passing bs_construct_SUITE completely unmodified.
|
|
Expressions like <<0:(fun(X)->X end(anka))>> would fail with 'badarith'
in HiPE, but 'badarg' in BEAM.
hipe_beam_to_icode was attempting to optimise the amount of code
generated by letting the arithmetic error propagate instead of
catching it. However, since it was emitting a block to throw 'badarg' in
that case anyway, we can just reuse it to achieve just as compact code
that behaves exactly like BEAM.
|
|
hipe_rtl_arith is only used by hipe_rtl_ssa_const_prop, which applies it
to any RTL, including RTL where the intent is to do unsigned math. Since
signed and unsigned operations produce the same 2's complement result,
this change is harmless.
On 32-bit architectures it caused HiPE crashes when compiling code like
<<0:((1 bsl 32)-1)>>, because the size of the field is too large to fit
in a signed integer.
|
|
The unit size field was previously completely discarded when lowering
this instruction from BEAM to Icode.
This feature was previously missing and expressions such as <<0,
<<1:1>>/binary>> would succeed construction when compiled with HiPE.
|
|
This feature was previously missing and expressions such as
<<<<1:1>>/binary>> would succeed construction when compiled with HiPE.
A primop is_divisible is introduced to handle the case when the unit
size is not a power of two.
|
|
Relying on double-precision floating-point arithmetic to compute the
log2 of an integer up to 64 bits long leads to rounding errors.
|
|
* lucafavatella/dialyzer-remote-type:
Delete remote types-related dead code in erl_types
OTP-13104
|
|
|
|
* kostis/hipe-bs-match-huge-bin:
Fix matching with huge binaries
Compile without errors for exported variables
OTP-13092
|
|
* maint:
[erl_docgen] Correct documentation
[dialyzer] Correct documentation
[hipe] Correct documentation
[test_server] Correct documentation
[tools] Correct documentation
[erts] Correct documentation
[stdlib] Correct documentation
[kernel] Correct documentation
Conflicts:
lib/stdlib/doc/src/erl_scan.xml
|
|
Fix mistakes found by 'xmllint'.
|
|
|
|
|
|
* lucafavatella/dialyzer-fun-literal-arity:
Teach Dialyzer arity of funs with literal arity
OTP-13068
|
|
Code became dead in 854ee8b.
|
|
|
|
copy_offset_int_big was assuming (Offset + Size - 1) (Tmp9 in the first
BB) would not underflow. It was also unconditionally reading and writing
the binary even when Size was zero, unlike copy_int_little, which is the
only other case of bs_put_integer that does not have a short-circuit on
Size = 0.
This was causing segfaults when constructing binaries starting with a
zero-length integer field, because a logical right shift was used to
compute an offset in bytes (which became 0x1fffffffffffffff) to read in
the binary.
Tests, taken from the emulator bs_construct_SUITE, were also added.
The complete credit for the report and the fix goes to Magnus Lång.
|
|
The bulk of the changes concerns cleanups and code refactorings concerning
record constructions that assigned 'undefined' to record fields whose type
did not contain this value. See commit 8ce35b2.
While at it, some new type definitions were introduced and type names were
used instead of record type notation. Minor code cleaups were also done.
|
|
Background
-----------
In record fields with a type declaration but without an initializer, the
Erlang parser inserted automatically the singleton type 'undefined' to
the list of declared types, if that value was not present there.
I.e. the record declaration:
-record(rec, {f1 :: float(),
f2 = 42 :: integer(),
f3 :: some_mod:some_typ()}).
was translated by the parser to:
-record(rec, {f1 :: float() | 'undefined',
f2 = 42 :: integer(),
f3 :: some_mod:some_typ() | 'undefined'}).
The rationale for this was that creation of a "dummy" #rec{} record
should not result in a warning from dialyzer that e.g. the implicit
initialization of the #rec.f1 field violates its type declaration.
Problems
---------
This seemingly innocent action has some unforeseen consequences.
For starters, there is no way for programmers to declare that e.g. only
floats make sense for the f1 field of #rec{} records when there is no
`obvious' default initializer for this field. (This also affects tools
like PropEr that use these declarations produced by the Erlang parser to
generate random instances of records for testing purposes.)
It also means that dialyzer does not warn if e.g. an is_atom/1 test or
something more exotic like an atom_to_list/1 call is performed on the
value of the f1 field.
Similarly, there is no way to extend dialyzer to warn if it finds record
constructions where f1 is not initialized to some float.
Last but not least, it is semantically problematic when the type of the
field is an opaque type: creating a union of an opaque and a structured
type is very problematic for analysis because it fundamentally breaks
the opacity of the term at that point.
Change
-------
To solve these problems the parser will not automatically insert the
'undefined' value anymore; instead the user has the option to choose the
places where this value makes sense (for the field) and where it does
not and insert the | 'undefined' there manually.
Consequences of this change
----------------------------
This change means that dialyzer will issue a warning for all places
where records with uninitialized fields are created and those fields have
a declared type that is incompatible with 'undefined' (e.g. float()).
This warning can be suppressed easily by adding | 'undefined' to the
type of this field. This also adds documentation that the user really
intends to create records where this field is uninitialized.
|
|
In certain cases of matching with very big binaries, the HiPE compiler
generated code that would fail the match, even in cases that the matching
was successful. The problem was more quite noticeable on 32-bit platforms
where certain integer quantities would be represented as bignums.
Brief summary of changes:
* gen_rtl({bs_skip_bits, ...}, ...) could not handle too large constants.
Previously the constants were truncated to word size.
* hipe_rtl_binary_match:make_size/3 erroneously assumed that the output
of first_part/3 would not overflow when multiplied by 8, which is no
longer true. To maintain full performance, the overflow test is only
performed when BitsVar was a bignum. Thus, the fast path is identical
to before.
* hipe_rtl_binary_match:set_high/2 was assuming that only bits below
bit 27 were ever set in arguments to bs_skip_bits, which is not only
false when the arguments are bignums, but also on 64-bit platforms.
The commit includes a test taken from the bs_match_bin_SUITE.
Most of the credit for finding these HiPE compiler errors and for
creating appropriate fixes for them should go to Magnus Lång.
|
|
|
|
=== OTP-18.1 ===
Changed Applications:
- compiler-6.0.1
- crypto-3.6.1
- debugger-4.1.1
- dialyzer-2.8.1
- diameter-1.11
- erts-7.1
- eunit-2.2.11
- hipe-3.13
- inets-6.0.1
- kernel-4.1
- mnesia-4.13.1
- odbc-2.11.1
- public_key-1.0.1
- sasl-2.6
- ssh-4.1
- ssl-7.1
- stdlib-2.6
- tools-2.8.1
- wx-1.5
Unchanged Applications:
- asn1-4.0
- common_test-1.11
- cosEvent-2.2
- cosEventDomain-1.2
- cosFileTransfer-1.2
- cosNotification-1.2
- cosProperty-1.2
- cosTime-1.2
- cosTransactions-1.3
- edoc-0.7.17
- eldap-1.2
- erl_docgen-0.4
- erl_interface-3.8
- et-1.5.1
- gs-1.6
- ic-4.4
- jinterface-1.6
- megaco-3.18
- observer-2.1
- orber-3.8
- os_mon-2.4
- ose-1.1
- otp_mibs-1.1
- parsetools-2.1
- percept-0.8.11
- reltool-0.7
- runtime_tools-1.9.1
- snmp-5.2
- syntax_tools-1.7
- test_server-3.9
- typer-0.9.9
- webtool-0.9
- xmerl-1.3.8
Conflicts:
OTP_VERSION
erts/vsn.mk
|
|
|
|
* maint:
Update application versions
|
|
|
|
* maint:
dialyzer: Correct the handling of parameters of opaque types
|
|
Prior to this commit, the fact that parameters of opaque types are
expanded differently depending on the current values of limits used
during expansion, caused problems later when the types of parameters
are used for determining if opaque types are comparable.
|
|
* maint:
dialyzer: Fix erlang:abs/1
|
|
Fix the range type of erlang:abs/1.
|
|
|
|
* sverk/hipe-fix-literal-crc:
erts,hipe,dialyzer: Fix hipe checkum of target runtime system
erts: Change THE_NON_VALUE to not be hard coded in hipe compiler
OTP-12962
OTP-12963
OTP-12964
|
|
Main problem:
A faulty HIPE_LITERAL_CRC was not detected by the loader.
Strangeness #1:
Dialyzer should ask the hipe compiler about the target checksum,
not an internal bif.
Strangeness #2:
The HIPE_SYSTEM_CRC checksum was based on the HIPE_LITERALS_CRC
checksum.
Solution:
New HIPE_ERTS_CHECKSUM which is an bxor of the two (now independent)
HIPE_LITERALS_CRC and HIPE_SYSTEM_CRC.
HIPE_LITERALS_CRC represents values that are assumed to stay constant
for different VM configurations of the same arch, and are therefor
hard coded into the hipe compiler.
HIPE_SYSTEM_CRC represents values that may differ between VM variants.
By default the hipe compiler asks the running VM for this checksum,
in order to create beam files for the same running VM.
The hipe compiler can be configured (with "make XCOMP=yes ...") to
create beam files for another VM variant, in which case HIPE_SYSTEM_CRC
is also hard coded.
ToDo:
Treat all erts properties the same. Either ask the running VM or hard
coded into hipe (if XCOMP=yes). This will simplify and reduce the risk
of dangerous mismatches. One concern might be the added overhead
from more frequent calls to hipe_bifs:get_rts_param.
|
|
* maint:
dialyzer: Correct the timing of the phase called 'remote'
dialyzer: Optimize expansion of parameters of opaque types
dialyzer: Optimize the expansion of parameterized types somewhat
dialyzer: Improve the handling of recursive parameterized opaque types
dialyzer: Generalize an argument of erl_types:t_from_form()
|
|
Opaque recursive parameters are expanded faster.
|
|
Expand parameters when needed only.
The opaqueness is removed from types expanded to any().
|
|
|
|
Add more information about the caller of t_from_form(). Instead of
just the module, also provide name of the type, spec, or record where
the type form resides.
|
|
Instead ask running VM for the value of THE_NON_VALUE,
which is different between opt and debug VM.
Same hipe compiler can now compile for both opt and debug VM.
|
|
* maint:
hipe/dialyzer: Fix a bug concerning opaque types and keydelete/3
|
|
Thanks to ILYA Khlopotov for pointing the bug out.
|
|
* maint:
dialyzer: Fix a bug concerning parameterized opaque types
|
|
The example is provided by James Fish in
http://erlang.org/pipermail/erlang-questions/2014-December/082204.html.
Note that warnings with text such as "the _ variable breaks
opaqueness" are still possible.
|