Age | Commit message (Collapse) | Author |
|
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.
|
|
=== 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.
|
|
The OSE port is no longer supported and this commit removed it
and any changes related to it. The things that were general
improvements have been left in the code.
|
|
|
|
OTP-12845
* bruce/change-license:
fix errors caused by changed line numbers
Change license text to APLv2
|
|
* kostis/hipe-no-dial-warnings:
Eliminate a dialyzer warning
Simplify handling of o2 and o3 option expansion
|
|
|
|
The test t_is_none() does not check for opaque types (and this is most
likely how it should be), why t_opaque() should never be called with
none().
|
|
Comparing two operands for (in)equality is allowed if both operands
are of the same unknown opaque type. Since OTP 17, there is a warning
if the types of the operands have nothing in common (this cannot
happen before OTP 17). However, the warning says there is a test
between opaque types, which is wrong. The warning now states that the
comparison cannot evaluate to 'true', which is more consistent.
|
|
In OTP 17 it is possible to mix types such as dict:dict() and
dict:dict(_, _) outside of the dict module (and similarly for some
other opaque types in STDLIB), but the results are unfortunately
possibly invalid warnings in users' code. In OTP 18 parameterized
opaque types with the same name but with different number of
parameters are no longer compatible when seen from outside of the
module where the types are declared.
The types in STDLIB have been updated accordingly; for instance
-opaque dict() :: dict(_, _).
has been replaced by
-type dict() :: dict(_, _).
|
|
The check that a modified type of a field is a subtype of the declared
type has been moved outside of the expansion of forms to avoid loops.
|
|
For quite some time now, this module generated a (quite harmless)
dialyzer warning. Comment out a clause which was actually unreachable.
While at it, do some small code refactorings here and there.
|
|
A recent rewrite of some code in this file (commit 355f4b5)
exposed some dialyzer warnings of some code which is unreachable.
Indeed, checking whether one executes on an unsupported architecture
when expanding the 'o2' and 'o3' hipe compiler options is unnecessary
because that check is performed in the expansion of the 'o1' option
anyway. While at it, simplified the code a bit not to have a very
long case clause.
|
|
* richcarl/avoid-try-native-load:
Update list of funcalls in kernel code_SUITE
Move architecture knowledge out of hipe loader
Avoid repeated calls to system_info in hipe loader
Avoid exception overhead if HiPE is disabled
HiPE help shouldn't modify the calling process
OTP-12816
|
|
|
|
* kostis/llvm-now:
Replace call to erlang:now() with appropriate call to 18.0 BIF
|
|
* kostis/cerl_pmatch:
Allow use of complete interface of cerl_pmatch module
OTP-12794
|
|
* legoscia/dialyzer/cache-hipe-binaries/OTP-12779:
Dialyzer to cache results of HiPE compilation
Change hipe_bifs:system_crc/1 to hipe_bifs:system_crc/0
|
|
The macro HIPE_SYSTEM_CRC used to contain a hidden cookie from the VM
that generated hipe_literals.hrl. This means that BEAM files containing
that macro would be tied to a particular version of the VM.
Change hipe_bifs:system_crc such that it doesn't require a hidden cookie
to return the desired value.
|
|
|
|
|
|
Applications that use the new erl_anno module are depending on STDLIB 2.5.
Note that CosNotification, Megaco, SNMP, Xmerl, and Parsetools use the
erl_anno module via the Yecc parsers only (the header file in
lib/parsetools/include/yeccpre.hrl calls the erl_anno module).
HiPE does not call the erl_anno module, but uses an exported type.
We have chosen to make HiPE dependent on the erl_anno module.
|
|
This reverts commit e09dd66dc4d89c62ddfd8c19791f9678d5d787c6.
|
|
|
|
The cerl_pmatch module performs pattern matching compilation at the
level of Core Erlang. Functions that were not needed by the HiPE
compiler were ifdef-ed out. However, these functions may come handy
to other users; in particular a new testing tool currently under
development needs access to these functions.
While at it, added specs for these exported functions and also
strengthened the spec of another one.
|
|
|
|
* sverk/hipe_match_wbin/OTP-12667:
erts: Add debug assertions for match state sanity
hipe: Add test for matching of writable binary
erts,hipe: Optimize away calls to emasculate_binary
erts,hipe: Fix bug in binary matching of writable binary
Conflicts:
erts/emulator/hipe/hipe_bif0.c
|
|
|
|
|