This document describes the changes made to the Compiler application.
Fixed an incorrect type determination for constructed
binaries, which could cause
Own Id: OTP-15872
The type optimization pass of the compiler could hang
or loop for a long time when analyzing a
Own Id: OTP-15828 Aux Id: ERL-948
Certain complex receive statements would result in an internal compiler failure.
Own Id: OTP-15832 Aux Id: ERL-950
Fixed an unsafe type optimization.
Own Id: OTP-15838
Fixed a crash when optimizing compiler-generated exceptions (like badmatch) whose offending term was a constructed binary.
Own Id: OTP-15839 Aux Id: ERL-954
Fixed a bad optimization related to the
Own Id: OTP-15841
An
Own Id: OTP-15845
A Core Erlang module where the last clause in a
Own Id: OTP-15846 Aux Id: ERL-955
Fixed a bug that could cause the compiler to crash when compiling complex nested case expressions.
Own Id: OTP-15848 Aux Id: ERL-956
Own Id: OTP-15760 Aux Id: ERL-907
The compiler has been rewritten to internally use an intermediate representation based on Static Single Assignment (SSA). The new intermediate representation makes more optimizations possible.
Most noticeable is that the binary matching optimizations are now applicable in many more circumstances than before.
Another noticeable change is that type optimizations are now applied across local function calls, and will remove a lot more redundant type tests than before.
Own Id: OTP-14894 Aux Id: ERL-714
Funs are no longer created when they are only used locally, greatly improving the performance of named funs and "fun-wrapped" macros.
Own Id: OTP-15273 Aux Id: ERL-639
All compiler options that can be given in the source
file can now also be given in the option list or from the
command line for
Specifically, the option
Own Id: OTP-15456
Do not allow function specifications for functions residing in other modules.
*** POTENTIAL INCOMPATIBILITY ***
Own Id: OTP-15563 Aux Id: ERL-845, OTP-15562
Internal documentation has now been added to the Erts and Compiler applications.
The internal documents for Erts describe miscellaneous interesting implementation details. Those details can change at any time.
The internal documentation for Compiler documents the API for the Core Erlang modules. While we will not change those APIs without good reason, we don't give the same guarantees about backward compatibility as for the rest of the APIs in OTP.
Own Id: OTP-15715
There are new compiler options
Own Id: OTP-15749 Aux Id: ERL-904
An expression such as
Own Id: OTP-15518 Aux Id: ERL-829
There could be an incorrect warning when the
Own Id: OTP-15552 Aux Id: ERL-838
Optimize (again) Dialyzer's handling of
left-associative use of
Own Id: OTP-15577 Aux Id: ERL-851, PR-2141, PR-1944
An optimization that avoided allocation of a stack
frame for some
A similar optimization will be included in OTP 22 in a safe way.
Own Id: OTP-15501 Aux Id: ERL-807, ERL-514, OTP-14808
Fixed a rare internal consistency failure caused by a
bug in the
Own Id: OTP-15400 Aux Id: ERL-759
The compiler could fail with an internal consistency
check failure when compiling code that used the
Own Id: OTP-15435 Aux Id: ERL-778
When an external fun was used, warnings for unused variables could be suppressed.
Own Id: OTP-15437 Aux Id: ERL-762
The compiler would crash when compiling an
Own Id: OTP-15481
When specified, the
The
Own Id: OTP-15245 Aux Id: ERL-706
Fixed a bug where incorrect code was generated following a binary match guard.
Own Id: OTP-15353 Aux Id: ERL-753
In rare circumstances, the matched out tail of a binary could be the entire original binary. (There was partial correction to this problem in version 7.2.5 of the compiler application.)
Own Id: OTP-15335 Aux Id: ERL-689, OTP-15219
Fixed a bug that prevented certain variable-sized binary comprehensions from compiling.
Own Id: OTP-15186 Aux Id: ERL-665
When compiling from Core Erlang, funs created in certain expressions that were only used for their side-effects were subtly broken.
Own Id: OTP-15188 Aux Id: ERL-658
There could be an internal consistency failure when a
Own Id: OTP-15218 Aux Id: ERL-684
In rare circumstances, the matched out tail of a binary could be the entire original binary.
Own Id: OTP-15219 Aux Id: ERL-689
When
In rare circumstances, compiling code that uses
Own Id: OTP-15227 Aux Id: ERL-699
The compiler could crash when compiling a function with multiple receives in multiple clauses.
Own Id: OTP-15235 Aux Id: ERL-703
Fix a regression in OTP-15204 that removed
Own Id: OTP-15292
Fixed an issue where files compiled with the
Own Id: OTP-15204 Aux Id: ERL-679
In rare cases involving matching of binary literal strings, the compiler could optimize away code that should be executed.
Own Id: OTP-15156 Aux Id: ERL-655
There could be an internal consistency check failure
when compiling code that called
Own Id: OTP-15157
In rare circumstances, the compiler could crash in
Own Id: OTP-15166 Aux Id: ERL-660
The could could crash when compiling a complicated function that used the binary syntax.
Own Id: OTP-15150 Aux Id: ERL-650
Fixed an error in an optimization pass that caused impossible tuple matching.
Own Id: OTP-14855 Aux Id: ERL-549
The exception thrown when a list comprehension was given a non-list term was not always correct.
Own Id: OTP-14992 Aux Id: ERL-572
The compiler could produce incorrect code in rare
circumstances when the
Own Id: OTP-15115 Aux Id: PR-1831
Changed the default behaviour of
*** POTENTIAL INCOMPATIBILITY ***
Own Id: OTP-14439
Support for "tuple calls" have been removed from the
run-time system. Tuple calls was an undocumented and
unsupported feature which allowed the module argument for
an apply operation to be a tuple:
For legacy code that need to use parameterized modules
or tuple calls for some other reason, there is a new
compiler option called
*** POTENTIAL INCOMPATIBILITY ***
Own Id: OTP-14497
In code such as
Own Id: OTP-14505
The optimization of
Own Id: OTP-14525
Some uses of binary matching has been slightly improved, eliminating unnecessary register shuffling.
Own Id: OTP-14594 Aux Id: ERL-444
There is a new
Own Id: OTP-14615 Aux Id: PR-1558
Loaded BEAM code in a 64-bit system requires less memory because of better packing of operands for instructions.
These memory savings were achieved by major
improvements to the
Own Id: OTP-14626
Size calculations for binary constructions has been somewhat optimized, producing smaller code.
Own Id: OTP-14654
When the value returned from a '
Own Id: OTP-14683
There is a new syntax in '
Own Id: OTP-14692
The following is an internal change in the compiler,
that is not noticeable for normal use of the compiler:
The module
Own Id: OTP-14712
The optimization of binary matching that delays creation of sub binaries (see the Efficiency Guide) could be thwarted by the argument order and could be necessary to change the argument order. The compiler has now become smarter and can handle any argument order.
Own Id: OTP-14774
When the compiler was faced with complex case expressions it would unnecessarily allocate stack elements and shuffle data between x and y registers. Improved code generation to only allocate a stack frame when strictly necessary.
Own Id: OTP-14808 Aux Id: ERL-514
There is a new option '
Own Id: OTP-14830
When compiling modules with huge functions, the compiler would generate a lot of atoms for its internal, sometimes so many that the atom table would overflow. The compiler has been rewritten to generate far less internal atoms to avoid filling the atom table.
Own Id: OTP-14968 Aux Id: ERL-563
External funs with literal values for module, name,
and arity (e.g.
Own Id: OTP-15003
Two new guards BIFs operating on maps have been added:
Own Id: OTP-15037 Aux Id: PR-1784, PR-1802
A call or apply of a literal external fun will be replaced with a direct call.
Own Id: OTP-15044 Aux Id: ERL-614
Part of EEP-44 has been implemented.
There is a new predefined macro called
There are new preprocessor directives
Own Id: OTP-15087 Aux Id: PR-1810
Fix a regression in OTP-15204 that removed
Own Id: OTP-15292
Fixed an issue where files compiled with the
Own Id: OTP-15204 Aux Id: ERL-679
The internal compiler pass (
When compiling from BEAM assembly code, the
Own Id: OTP-14863
Corrected optimizations of integers matched out from binaries and used in bit operations.
Own Id: OTP-14898
The '
Own Id: OTP-14773 Aux Id: ERL-498
The compiler could issue an incorrect internal consistency failure diagnostic for some complicated bit syntax maches.
Own Id: OTP-14640 Aux Id: ERL-490
Fail labels on guard BIFs weren't taken into account during an optimization pass, and a bug in the validation pass sometimes prevented this from being noticed when a fault occurred.
Own Id: OTP-14522 Aux Id: ERIERL-48
When compiling from Core Erlang, an 'apply' with a nested apply in the function position would be treated as an invalid call. Corrected. (Thanks to Mikael Pettersson for reporting this bug.)
Own Id: OTP-14526
Fixed checking of binary matching in the
Own Id: OTP-14591
There could be false warnings for
Own Id: OTP-14600 Aux Id: ERL-478
The Erlang code linter no longer checks that the
functions mentioned in
Own Id: OTP-14378
Fail labels on guard BIFs weren't taken into account during an optimization pass, and a bug in the validation pass sometimes prevented this from being noticed when a fault occurred.
Own Id: OTP-14522 Aux Id: ERIERL-48
For many releases, it has been legal to override a BIF with a local function having the same name. However, calling a local function with the same name as guard BIF as filter in a list comprehension was not allowed.
Own Id: OTP-13690
compile:forms/2 would not return the module name as
documented when one of the options '
Own Id: OTP-14408 Aux Id: ERL-417
Optimized test for tuples with an atom as first element.
Own Id: OTP-12148
Compilation of modules with huge literal binary strings is now much faster.
Own Id: OTP-13794
Replaced usage of deprecated symbolic
Own Id: OTP-13831 Aux Id: OTP-13735
The undocumented and unsupported module
Own Id: OTP-13856
The internal compiler passes now start all generated variables with "@" to avoid any conflicts with variables in languages such as Elixir or LFE.
Own Id: OTP-13924
The function
Own Id: OTP-14000
Code generation for complicated guards have been improved.
Own Id: OTP-14042
The compiler has new warnings for repeated identical map keys.
A map expression such as,
will produce a warning for the repeated key 'a'.
Own Id: OTP-14058
By default, there will now be a warning when
Own Id: OTP-14071
Optimize maps pattern matching by only examining the common keys in each clause first instead of all keys. This will reduce the number of lookups of each key in maps pattern matching.
Own Id: OTP-14072
There is a new '
Own Id: OTP-14087
Analyzing modules with binary construction with huge strings is now much faster. The compiler also compiles such modules slightly faster.
Own Id: OTP-14125 Aux Id: ERL-308
Atoms may now contain arbitrary Unicode characters.
Own Id: OTP-14178
Own Id: OTP-14221
The format of debug information that is stored in BEAM
files (when
All tools included in OTP (dialyzer, debugger, cover,
and so on) will handle both the new format and the
previous format. Tools that retrieve the debug
information using
For more information, see the description of
Own Id: OTP-14369 Aux Id: PR-1367
In a future release,
To help prepare for that change, the compiler will now
by default warn if '
Own Id: OTP-14401
Fail labels on guard BIFs weren't taken into account during an optimization pass, and a bug in the validation pass sometimes prevented this from being noticed when a fault occurred.
Own Id: OTP-14522 Aux Id: ERIERL-48
Minor internal changes. A typo in the documentation was also fixed.
Own Id: OTP-14240
Fixed a compiler crash when maps were matched.
Own Id: OTP-13931 Aux Id: ERL-266
Fixed a compiler crash having to with the delayed sub-creation optimization. (Thanks to Jose Valim for reporting this bug.)
Own Id: OTP-13947 Aux Id: ERL-268
The compiler option
Own Id: OTP-13985
The compiler could sometimes generate spurious warnings when inlining was enabled.
Own Id: OTP-14040 Aux Id: ERL-301
If the compiler fails to write the BEAM file, it will now report the reason of the error for the write operation.
Own Id: OTP-13701
Fixed an internal compiler error. (Thanks to Svilen Ivanov for reporting this bug.)
Own Id: OTP-13780 Aux Id: ERL-202
The compiler could crash when trying to compile a complicated expression with multiple catches all on one line . (Thanks to Thomas Arts for reporting this bug.)
Own Id: OTP-13804 Aux Id: ERL-209
Eliminated a few internal compiler failures.
Own Id: OTP-13863
A literal binary matching regression was introduced in 19.0 where a match could fail to resolve to the right clause. This has now been fixed.
Own Id: OTP-13738
Own Id: OTP-13430 Aux Id: ERL-113
Dialyzer no longer crashes when there is an invalid
function call such as
Own Id: OTP-13552 Aux Id: ERL-138
Optimization of tuple matching has been slightly improved.
Own Id: OTP-12951
Five deprecated and undocumented functions in the
module
Own Id: OTP-12979
The pre-processor can now expand the ?FUNCTION_NAME and ?FUNCTION_ARITY macros.
Own Id: OTP-13059
The function mapfold/4 has been added to the
Own Id: OTP-13280
Bitstring comprehensions have been generalized to allow arbitrary expressions in the construction part.
Own Id: OTP-13289
The compiler will now produce warnings for binary
patterns that will never match (example:
Own Id: OTP-13374 Aux Id: ERL-44
The compiler will no longer put the compilation date and time into BEAM files. That means that two BEAM files compiled on the same computer from the same source code and compilation options will be identical.
Note: If you want to find out whether a BEAM file on
disk is different from the loaded code, compared the MD5
value obtained from
*** POTENTIAL INCOMPATIBILITY ***
Own Id: OTP-13504
The function
Own Id: OTP-13654
Fail labels on guard BIFs weren't taken into account during an optimization pass, and a bug in the validation pass sometimes prevented this from being noticed when a fault occurred.
Own Id: OTP-14522 Aux Id: ERIERL-48
An complicated guard expression in a function call could crash the compiler. (Thanks to Thomas Arts for reporting this bug.)
Own Id: OTP-13208
Constructing a map in a guard in a catch could crash the compiler. (Thanks to Thomas Arts for reporting this bug.)
Own Id: OTP-13223
Updating a fun as if it were a map would cause the compiler to crash. (Thanks to Thomas Arts for reporting this bug.)
Own Id: OTP-13231
Fix pretty printing of Core Maps
Literal maps could cause Dialyzer to crash when pretty printing the results.
Own Id: OTP-13238
A complex combination of bit syntax matching operations would cause an internal consistency check failure during compilation. (Thanks to Jose Valim for reporting this bug.)
Own Id: OTP-13309
Fix cerl_trees:label/2 bug with map K/V swap
Own Id: OTP-13091
Warnings produced when the '
Own Id: OTP-13113
Fix
Instruction
Own Id: OTP-12967
The compiler optimizes away building of terms that are never actually used. As a result, the compiler in OTP 18 may produce more warnings for terms that are built but not used than the compiler in OTP 17.
Own Id: OTP-12453
Using a map could incorrectly suppress warnings for unused variables.
Own Id: OTP-12515
The compiler now properly reports unknown parse
transforms. That is,
Own Id: OTP-12723
Allow for 'creation of sub binary delayed' optimization if maps instructions are in a clause.
Own Id: OTP-12758
The
Own Id: OTP-11978
The deprecated '
*** POTENTIAL INCOMPATIBILITY ***
Own Id: OTP-12100
Support variables as Map keys in expressions and patterns
Erlang will accept any expression as keys in Map expressions and it will accept literals or bound variables as keys in Map patterns.
Own Id: OTP-12218
Infer Map type information in beam_type compiler optimization pass.
Own Id: OTP-12253
Compiler optimizations have been improved.
Own Id: OTP-12393
Five undocumented functions in the module
Own Id: OTP-12497
Change some internal data structures to Maps in order to speed up compilation time. Measured speed up is around 10%-15%.
Own Id: OTP-12774
Fix beam_bool pass for Maps instruction get_map_elements
Before beam_split the get_map_elements instruction is still in blocks and the helper function in beam_jump did not reflect this.
Own Id: OTP-12844 Aux Id: 17
Matching out a map from a record and then updating the record could cause a 'badarg' exception at run-time. (Thanks to Dmitry Aleksandrov for reporting this bug.)
Own Id: OTP-12402
The compiler would crash when compiling some complex, nonsensical guards such as:
...
Own Id: OTP-12410
In rare circumstances, using binary pattern in the value part of a map pattern would cause the compiler to crash.
Own Id: OTP-12414
Case expressions where a map was wrapped in a tuple or list such as:
would be unsafely "optimized" to either cause an exception at run-time or would return an empty map.
Own Id: OTP-12451
When a variable was compared to a literal map using
the '
Own Id: OTP-12456
Named funs with the same name and arity could get mixed up with each other.
Own Id: OTP-12262
Coalesce map keys in dialyzer mode
This fixes a regression introduced in commit 805f9c89fc01220bc1bb0f27e1b68fd4eca688ba The problem occurred with compounded map keys compiled with dialyzer option turned on, '+dialyzer'.
Reported by: Ivan Uemlianin
Own Id: OTP-12347
Corrected a bug with incorrect code generation when inlining was turned on.
Own Id: OTP-12132
A Dialyzer crash involving analysis of Map types has now been fixed.
Own Id: OTP-11947
The compiler would fail to compile a file with a
latin-1 character in the false branch of an
Own Id: OTP-11987
Line numbers would not be correct when a binary
construction such as
'
Own Id: OTP-11572
The compiler now properly annotates the code in value in
the '
Own Id: OTP-11580
Some case statements where no clause would match could cause an internal error in the compiler. (Thanks to Erik Soe Sorensen for reporting this bug.)
Own Id: OTP-11610
With
Own Id: OTP-11626
Matching out a binary and applying the binary as if it were a fun would crash the run-time system. (Thanks to Loïc Hoguin.)
Own Id: OTP-11672
Some local implementations of removing the last element
from a list are replaced by
Own Id: OTP-11678
Allow all auto imports to be suppressed at once. Introducing the no_auto_import attribute: -compile(no_auto_import). Useful for code generation tools that always use the qualified function names and want to avoid the auto imported functions clashing with local ones. (Thanks to José Valim.)
Own Id: OTP-11682
Application upgrade (appup) files are corrected for the following applications:
A new test utility for testing appup files is added to test_server. This is now used by most applications in OTP.
(Thanks to Tobias Schlager)
Own Id: OTP-11744
Adapt 'asm' deprecation message to new version scheme. (Thanks to Tuncer Ayaz)
Own Id: OTP-11751
A number of compiler errors where unusual or nonsensical code would crash the compiler have been reported by Ulf Norell and corrected by Anthony Ramine.
Own Id: OTP-11770
Compilation times for modules with a huge number for record accesses using the dot operator has been improved.
Own Id: OTP-10652
The compiler can generate somewhat better code by moving let expressions into sequences. (Thanks to Anthony Ramine.)
Own Id: OTP-11056
Forbid unsized fields in patterns of binary generators and simplified v3_core's translation of bit string generators. (Thanks to Anthony Ramine.)
Own Id: OTP-11186
Funs can now be a given a name. Thanks to to Richard O'Keefe for the idea (EEP37) and to Anthony Ramine for the implementation.
Own Id: OTP-11537
Using the
Own Id: OTP-11544
The
Own Id: OTP-11547
Optimization of case expressions that build tuples or lists have been improved.
Own Id: OTP-11584
EEP43: New data type - Maps
With Maps you may for instance:
For information on how to use Maps please see Map Expressions in the
The current implementation is without the following features:
Note that Maps is experimental during OTP 17.0.
Own Id: OTP-11616
Some function specs are corrected or moved and some edoc comments are corrected in order to allow use of edoc. (Thanks to Pierre Fenoll)
Own Id: OTP-11702
Thanks to Anthony Ramine for several improvements to the optimizations in the BEAM compiler and for cleaning up the code the code that transforms list and binary comprehensions to Core Erlang.
Own Id: OTP-11720
The default encoding for Erlang source files is now UTF-8. As a temporary measure to ease the transition from the old default of latin-1, if the compiler encounters byte sequences that are not valid UTF-8 sequences, the compiler will re-try the compilation in latin-1 mode. This workaround will be removed in a future release.
Own Id: OTP-11791
Typo fix ambigous -> ambiguous. Thanks to Leo Correa.
Own Id: OTP-11455
Lift 'after' blocks to zeroary functions. Thanks to Anthony Ramine.
Own Id: OTP-11267
Expressions such as
Own Id: OTP-11240
Own Id: OTP-11304 Aux Id: seq12412
Fix matching of floating point middle-endian machines. Thanks to Johannes Weissl.
Own Id: OTP-11201
Restrict inlining of local fun references. Thanks to Anthony Ramine.
Own Id: OTP-11211
Silence a misleading warning with some comprehensions. Thanks to Anthony Ramine.
Own Id: OTP-11212
Forbid returning a match context in beam_validator. Thanks to Anthony Ramine.
Own Id: OTP-11247
Compiling functions with complex boolean operations in guards could be very slow. (Thanks to Magnus Muller for reporting this issue.)
Own Id: OTP-10939
Certain guard expressions used in a receive statement could cause the compiler to crash.
Own Id: OTP-11119 Aux Id: seq12342
Fix optimization of some binary comprehensions. Thanks to Anthony Ramine.
Own Id: OTP-11005
Use a set to store ref registers in beam_receive. Thanks to Anthony Ramine.
Own Id: OTP-11069
Fix renaming of bs_put_string instructions. Thanks to Anthony Ramine.
Own Id: OTP-11129
The compiler would crash attempting to compile expressions such as "element(2, not_tuple)".
Own Id: OTP-10794
Forbid multiple values in Core Erlang sequence arguments. Thanks to José Valim and Anthony Ramine.
Own Id: OTP-10818
An unsafe optimization would cause the compiler to crash with an internal error for certain complex code sequences.
Own Id: OTP-10825 Aux Id: seq12247
Integers in expression that will give a floating point
result (such as "
Identical floating points constans in a module will now be coalesced to one entry in the constant pool.
Own Id: OTP-10788
The compiler optimizations have been polished, so that the code quality will be slightly better in some cases.
Own Id: OTP-10193
Support for Unicode has been implemented.
Own Id: OTP-10302
Where necessary a comment stating encoding has been added to Erlang files. The comment is meant to be removed in Erlang/OTP R17B when UTF-8 becomes the default encoding.
Own Id: OTP-10630
Fix some wrong warnings triggered by the option inline_list_funcs. Thanks to Anthony Ramine.
Own Id: OTP-10690
Forbid local fun variables in Core Erlang guards. Thanks to Anthony Ramine.
Own Id: OTP-10706
Binary syntax matches could cause an internal consistency error in in the compiler. (Thanks to Viktor Sovietov for reporting this bug.)
Own Id: OTP-10724
Modules with very many functions would compile very slowly.
Own Id: OTP-10123
Own Id: OTP-10150
A process which had enabled trap_exit would receive EXIT messages after calling the compiler. (Thanks to Jeremy Heater.)
Own Id: OTP-10171
Fix messages ordering with column numbers
Own Id: OTP-10183
sys_pre_expand: Fix BASE never being set
Commit a612e99fb5aaa934fe5a8591db0f083d7fa0b20a turned module attributes from 2-tuples to 3-tuples but forgot to update get_base/1, breaking BASE for parametric modules.
Own Id: OTP-10184
The compiler will now issue a warning if literal tuple funs are used. For example, {erlang,is_tuple}(X) will now generate a warning.
Own Id: OTP-10185
The compiler will now warn for illegal sizes for segments in binary construction. For example, <<X:(2.5)>> will now cause the compiler to issue a warning.
Own Id: OTP-10197
Fix the erlc -MP flag
Because of a copy-and-paste error in erlc.c, the -MP flag had the same effect as -MG. As a workaround, you had to pass +makedep_phony to enable the MP option. This patch makes -MP work as intended.
Own Id: OTP-10211
In rare circumstance, the compiler could crash when compiling a case statement. (Thanks to Hakan Mattsson.)
Own Id: OTP-9842
Calling a guard test (such as is_list/1) from the top-level in a guard, would cause a compiler crash if there was a local definition with the same name. Corrected to reject the program with an error message.
Own Id: OTP-9866
Using
Own Id: OTP-9867
An unexported on_load function would not get run if the
module was compiled with the
Own Id: OTP-9910
Fixed a discrepancy in compile_info
The BEAM disassembler used the atom 'none' to signify the absence of a compile_info chunk in a .beam file. This clashed with the type declaration of the compile_info field of a #beam_file{} record as containing a list. Now [] signifies the absence of this chunk. This simplifies the code and avoids a dialyzer warning.
Own Id: OTP-9917
Fix typo in `compile' doc: unmatched parenthesis (Thanks to Ricardo Catalinas Jiménez)
Own Id: OTP-9919
In a
Own Id: OTP-9982
Add '-callback' attributes in stdlib's behaviours
Replace the behaviour_info(callbacks) export in stdlib's behaviours with -callback' attributes for all the callbacks. Update the documentation with information on the callback attribute Automatically generate 'behaviour_info' function from '-callback' attributes
'behaviour_info(callbacks)' is a special function that is defined in a module which describes a behaviour and returns a list of its callbacks.
This function is now automatically generated using the '-callback' specs. An error is returned by lint if user defines both '-callback' attributes and the behaviour_info/1 function. If no type info is needed for a callback use a generic spec for it. Add '-callback' attribute to language syntax
Behaviours may define specs for their callbacks using the familiar spec syntax, replacing the '-spec' keyword with '-callback'. Simple lint checks are performed to ensure that no callbacks are defined twice and all types referred are declared.
These attributes can be then used by tools to provide documentation to the behaviour or find discrepancies in the callback definitions in the callback module.
Add callback specs into 'application' module in kernel Add callback specs to tftp module following internet documentation Add callback specs to inets_service module following possibly deprecated comments
Own Id: OTP-9621
The calculation of the 'uniq' value for a fun (see
Own Id: OTP-9667
Variables are now now allowed in '
The representation of '
*** POTENTIAL INCOMPATIBILITY ***
Own Id: OTP-9643
Own Id: OTP-9752
Inlining binary matching could cause an internal compiler error. (Thanks to Rene Kijewski for reporting this bug.)
Own Id: OTP-9770
Compiler options given in the source code using a
Own Id: OTP-9534
beam_disasm: Handle stripped BEAM files
beam_disasm:file/1 would crash if asked to disassemble a stripped BEAM file without an "Attr" chunk. (Thanks to Haitao Li)
Own Id: OTP-9571
If a variable is matched out in binary matching and used as the size for a binary element, it would seem to be unbound if used in a subsequent match operation. (Thanks to Bernard Duggan.)
Own Id: OTP-9134
Eliminate incorrect warning in
Own Id: OTP-9152
The
Own Id: OTP-8998
The maximum number of allowed arguments for an Erlang function has been lowered from 256 to 255, so that the number of arguments can now fit in a byte.
Own Id: OTP-9049
Dependency generation for Makefiles has been added to the
compiler and erlc. See the manual pages for
Own Id: OTP-9065
Two compiler bugs (that would cause the compiler to terminate) reported by Christopher Williams have been fixed.
Own Id: OTP-8949
The compiler would translate binary comprehensions containing tail segments in a way that would would confuse Dialyzer. For instance:
would produce a Dialyzer warning.
Own Id: OTP-8864
Code such as
Own Id: OTP-8865
The compiler could fail with an internal error when variables were exported from a receive block but the return value of the receive block were not used. (Thanks to Jim Engquist for reporting this error.)
Own Id: OTP-8888
Eliminated warnings for auto-imported BIF clashes.
Own Id: OTP-8840
Several problems in the inliner have been fixed.
Own Id: OTP-8552
The module binary from EEP31 (and EEP9) is implemented.
Own Id: OTP-8217
Local and imported functions now override the auto-imported BIFs when the names clash. The pre R14 behaviour was that auto-imported BIFs would override local functions. To avoid that old programs change behaviour, the following will generate an error:
Doing a call without explicit module name to a local function having a name clashing with the name of an auto-imported BIF that was present (and auto-imported) before OTP R14A
Explicitly importing a function having a name clashing with the name of an autoimported BIF that was present (and autoimported) before OTP R14A
Using any form of the old compiler directive
If the BIF was added or auto-imported in OTP R14A or later, overriding it with an import or a local function will only result in a warning,
To resolve clashes, you
can either use the explicit module name
The
change makes it possible to add auto-imported BIFs
without breaking or silently changing old code in the
future. However some current code ingeniously utilizing
the old behaviour or the
*** POTENTIAL INCOMPATIBILITY ***
Own Id: OTP-8579
The undocumented, unsupport, and deprecated function
Own Id: OTP-8584
Nested records can now be accessed without parenthesis. See the Reference Manual for examples. (Thanks to YAMASHINA Hio and Tuncer Ayaz.)
Own Id: OTP-8597
It is now possible to suppress the warning in code
such as "
Own Id: OTP-8602
Own Id: OTP-8623
The compiler optimizes record operations better.
Own Id: OTP-8668
Using complex boolean expressions in ifs could cause the compiler to either crash or teminate with an internal error. (Thanks to Simon Cornish.)
Own Id: OTP-8338
Bit string comprehensions can now be used in parameterized modules. (Thanks to Jebu Ittiachen.)
Own Id: OTP-8447
The expected return value for an on_load function has been changed. (See the section about code loading in the Reference manual.)
*** POTENTIAL INCOMPATIBILITY ***
Own Id: OTP-8339
In rare circumstances when using garbaging collecting guard BIFs, the validation pass (beam_validator) would signal that the code was unsafe, when it in fact was correct. (Thanks to Kiran Khaladkar.)
Own Id: OTP-8378
The
Own Id: OTP-8382
Macros overloading has been implemented. (Thanks to Christopher Faulet.)
Own Id: OTP-8388
The compiler's 'E' option now works with modules with types and specifications.
Own Id: OTP-8238 Aux Id: OTP-8150
Certain uses of binary matching in a
Own Id: OTP-8271
The documentation is now built with open source tools (xsltproc and fop) that exists on most platforms. One visible change is that the frames are removed.
Own Id: OTP-8201
The compiler could crash if invalid calls to is_record/2 was used in (for example) a list comprehension. (Thanks to Tobias Lindahl.)
Own Id: OTP-8269
The -on_load() directive can be used to run a function when a module is loaded. It is documented in the section about code loading in the Reference Manual.
Own Id: OTP-8295
Corrected liveness optimization to eliminate a compiler crash that could occur when compiling bit syntax construction code. (Thanks to Mikage Sawatari.)
Calling BIFs such as
Using filter expressions containing
Own Id: OTP-8054
A guard with nested 'not' operators could cause the compiler to crash. (Thanks to Tuncer Ayaz.)
Own Id: OTP-8131
The compiler would crash while compiling certain complex
function bodies containing
Own Id: OTP-7980
Miscellaneous minor bugs fixed.
Own Id: OTP-7937
There will be more efficient code if there is a clause that matches the empty binary and no other clauses that matches non-empty binaries.
Own Id: OTP-7924
There is new option to allow a module to have a module name other than the filename. Do not use it unless you know what you are doing.
Own Id: OTP-7927
Using
Som large and complex functions could require extremely long compilation times (hours or days).
Own Id: OTP-7905
For some complex guards which used
Own Id: OTP-7679
Code that (incorrectly) used the the value of nested
applications of
Own Id: OTP-7690
Modules containing huge integers (consisting of several hundreds of thousands of digits or more) could be slow to compile. This problem has been corrected.
Own Id: OTP-7707 Aux Id: seq11129
If the generator in a list comprehension is given a
non-list term, there will now be
Own Id: OTP-7844
The compiler could crash if the size for a binary segment in matching was a complex literal such as binary or tuple.
Own Id: OTP-7650
The compiler generates more compact and faster code for matching of complex constants (such as constant lists and tuples).
Own Id: OTP-7655
The undocumented, unsupported, and deprecated guard BIF
*** INCOMPATIBILITY with R12B ***
Own Id: OTP-7673
The compiler generates better code for many guard
expressions, and especially for guards that use
(In technical terms,
Own Id: OTP-7718
The default size for the resulting binary created by a binary comprehension was 64Kb in R12B (it would grow if needed). This was often far too much. In this release, the default is changed to 256 bytes. Furthermore, for most binary comprehensions without filters, the exact size of the resulting binary can be calculated beforehand and the compiler now generates code that does that calculation.
Own Id: OTP-7737
The short-circuit operators
*** POTENTIAL INCOMPATIBILITY ***
Own Id: OTP-7748
The compiler will refuse to a compile file where the module name in the file differs from the output file name.
When compiling using
*** POTENTIAL INCOMPATIBILITY ***
Own Id: OTP-7793
There will no longer be any warnings for list comprehensions without generators, as such list comprehension have turned out to be useful.
Own Id: OTP-7846
Warnings for obsolete guard tests are now turned on.
(That is, writing
The warnings can be turned off using the
Own Id: OTP-7850
The copyright notices have been updated.
Own Id: OTP-7851
If a module contains an exported function with the
same name as an auto-imported BIF (such as
(The reason for the change is to avoid breaking code in a future major release, R14 or R15, in which we plan to make calls without a module prefix always call the local function in the same module even if there is an auto-imported BIF with the same name.)
*** POTENTIAL INCOMPATIBILITY ***
Own Id: OTP-7873
Matching on a zero-width segment in the bit syntax would crash the compiler. (Thanks to Will.)
Own Id: OTP-7591
In bit syntax expressions which started with a binary segment, and was followed by at least two segments of variable size, too little space could be allocated for the binary, leading to memory corruption.
Own Id: OTP-7556
In user-defined attributes,
The
Own Id: OTP-7586
Certain complex bit syntax matching operations matching out binaries and having several clauses could give incorrect results (the matched out binaries were too short). (Thanks to Christian von Roques for bug report and correction.)
Own Id: OTP-7498
New option
Own Id: OTP-7392
In rare circumstances, the length/1 BIF (and a few other guard BIFs) would seem to return an incorrect value (of any type).
Own Id: OTP-7345 Aux Id: seq10962
A bug in the old inliner has been fixed. Some undocumented functionality has been removed.
Own Id: OTP-7223
Matching several binary patterns in parallel using the '=' operator is not allowed (an implementation limitation), but the compiler did not reject all such attempts (depending on the patterns, the generated code might or might not work correctly). Now the compiler rejects all binary patterns joined by '='.
Own Id: OTP-7227
Complex combinations of record operations and binary matching could cause the compiler to crash. (Thanks to Vladimir Klebansky.)
Own Id: OTP-7233
In rare circumstances, mixing binary matching clauses with clauses matching other data types, the compiler could crash.
Own Id: OTP-7240 Aux Id: seq10916
Corrected a compiler bug that could cause a complex binary matching operation to fail when it shouldn't. (Thanks to Tomas Stejskal.)
Own Id: OTP-7188
In unusual circumstances, the environment for a fun could bind wrong values.
Own Id: OTP-7202 Aux Id: seq10887
Long sequences of list comprehensions without
generators joined by the '++' operator would cause a code
expansion explosion, which could cause the compiler to
run out of memory. To resolve this problem, in
'
Note about evaluation order: The Reference manual says
that subexpressions are evaluated in any order
before the expression itself. Therefore, in an expression
such as '
Own Id: OTP-7206
A match expression inside a function call could cause a false "a term is constructed but never used" warning.
Own Id: OTP-7018 Aux Id: seq10824
The compiler could crash if a binary tail was matched out, and then used in a binary append operation. (Thanks to Oleg Avdeev.)
Similarly, the compiler could crash if a binary tail was matched out, and then used (incorrectly) in binary construction in an integer field. (Thanks to Fredrik Svahn.) Or was incorrectly used in a float field. Or was used in a binary field with a given length. (Thanks to Chih - Wei Yu.)
Own Id: OTP-7022
Matching an empty binary in a record and then using the same record again could cause a compiler crash. (Thanks to Fredrik Thulin.)
Own Id: OTP-7029
In rare circumstances, constants containing floating points and integers could be confused. Example:
Both
Own Id: OTP-7073
Some bit syntax code such as
could crash the compiler. (Thanks to Simon Cornish.)
Own Id: OTP-7094
In unusual circumstances, a call to a fun could fail due to an unsafe optimization. (Thanks to Simon Cornish.)
Own Id: OTP-7102
Bit syntax matching with a guard containing two or more uses of andalso/orelse could cause the compiler to crash. (Thanks to Mateusz Berezecki.)
Own Id: OTP-7113
This was only a problem if you generated or wrote your
own Core Erlang code: The Core Erlang optimizer code
could move nested calls such as
Own Id: OTP-7117
The compiler could generate suboptimal code for record updates if the record update code consisted of multiple source code lines.
Own Id: OTP-7101
The compiler used to allow that a binary field without
size could be used in other positions than at the end in
bit syntax pattern. For instance,
Also, it is now longer permitted to give a literal
string in a binary pattern a type or a size; for
instance,
Own Id: OTP-6885
Bitstrings (bit-level) binaries and binary comprehensions are now part of the language. See the Reference Manual.
Own Id: OTP-6558
The '
Own Id: OTP-6801
If the value of a list comprehension is not used, such
as in '
If the value of an expression is not used, and the
expression has no side effects except for possibly
throwing an exception, a warning will be generated.
Examples: '
Own Id: OTP-6824
Three new functions have been added to the
Own Id: OTP-6829
Many bit syntax operations, both construction and matching, are faster. For further information, see the Efficiency Guide.
Own Id: OTP-6838
Literal lists, tuples, and binaries are no longer constructed at run-time as they used to be, but are stored in a per-module constant pool. Literals that are used more than once are stored only once.
This is not a change to the language, only in the details of its implementation. Therefore, the implications of this change is described in the Efficiency Guide.
Example 1: In the expression
Example 2: Literal strings, such as
Own Id: OTP-6850
Recursive calls now usually consume less stack than in R11B. See the Efficiency Guide.
Own Id: OTP-6862 Aux Id: seq10746
Two new guard BIFs have been introduced as a
recommended replacement for
There is also a new
Own Id: OTP-6902
The two internal functions
Own Id: OTP-6966
The compiler would crash if you tried to combine to
non-list literals with '
Own Id: OTP-6630 Aux Id: seq10635
Minor Makefile changes.
Own Id: OTP-6689
Incorrect code could be generated for bit syntax matching if the old inliner was used with aggressive settings.
Own Id: OTP-6461
The R10B compiler could generate unsafe
Own Id: OTP-6386
Directives for parse transforms that have been run are now removed from the abstract code stored when the debug_info option is given, to prevent the parse transforms to be run again.
Own Id: OTP-5344
Minor improvements in code generation for some guards expression involving boolean expressions.
Own Id: OTP-6347
The compiler could generate incorrect code for bit syntax matching consisting of several clauses.
Own Id: OTP-6392 Aux Id: seq10539
Defining a fun itself containing a fun in an
Shorter compilation times for modules containing with an extreme number of functions (10000 functions or more).
(The compiled could generate deprecated instructions for certain bit syntax matching operations.)
Own Id: OTP-6212 Aux Id: seq10446
Fixed several bugs that would cause warnings to be shown without file name and line number.
Own Id: OTP-6260 Aux Id: seq10461
The
If necessary, the record tests can be turned off by
giving the
The
*** POTENTIAL INCOMPATIBILITY ***
Own Id: OTP-6294
The compiler used to crash if a module contained code
similar to '
The compiler would spend really long time compiling
bit syntax expressions such as
'
The compiler would compile list comprehensions with many generators really, really slow. (Thanks to Thomas Raes.)
Module attributes would be stored in reverse order
compared to the order in the source code. (Thus,
Defining a fun in an
The combination of binary pattern and a guard with andalso/orelse could cause the compiler to crash.
Own Id: OTP-6121 Aux Id: seq10400
When a
Own Id: OTP-5944
The
Own Id: OTP-5894 Aux Id: OTP-5149
When given the new option
The Erlang shell always applies strict record tests.
Own Id: OTP-5915 Aux Id: OTP-5714
The BIF
Own Id: OTP-5916
The compiler options
*** POTENTIAL INCOMPATIBILITY ***
Own Id: OTP-6058
The following code would crash the compiler:
The compiler could crash if binaries were constructed in certain guards involving boolean operators (including semicolon). (Thanks to Torbjorn Tornkvist.)
Own Id: OTP-5872
The compiler will now warn that the
Own Id: OTP-5976
The compiler would assume that some patterns with aliases ('=') would not match if they were split into several lines. (Thanks to Peter Nagy/Mats Cronqvist.)
Minor cleanups to eliminate Dialyzer warnings.
Own Id: OTP-5791 Aux Id: seq10141
When given the new option
The beam validator pass of the compiler could crash given in rare circumstances when given certain combinations of catches and record operations. (Thanks to Mats Cronqvist.)
Attributes containing binaries (such as -a(<<1,2,3>>)) would crash the compiler. (Thanks to Roger Price.)
Multiple behaviours in the same module will no longer
generate a warning, unless one or more callbacks for the
behaviours overlap. For instance, using both the
Own Id: OTP-5714 Aux Id: seq10073
The pre-processor used to complain that the macro
definition
Own Id: OTP-5777
Updating at least two fields of a record with a literal
string could cause the compiler to generate dangerous
code that could cause a crash at run-time (e.g.
Unecessary tests (such as a 'case' with two case branches that were identical) could cause the compiler to crash. (Thanks to Fredrik Thulin.)
The validation pass of the compiler could generate an error for correct code when floating point operations were used in try/catch statements.
In bit syntax construction, any field following a binary field would always be marked as "aligned" (which may or may not be correct). That would cause the hipe native compiler to generate incorrect code if the field was in fact unaligned. (Thanks to Per Gustafsson.)
Some complex guard expressions (such as
Compilation speed has been increased for modules with many functions and/or atoms (such as modules generated by the Asn1 application or other code generators).
Own Id: OTP-5632 Aux Id: seq10057
In some circumstances, having two try/catch constructs following each in a function body, would cause an internal error to be generated (when in fact the generated code was correct). (Thanks to Fredrik Thulin.)
Incorrect calls such as
Own Id: OTP-5553
The new
The new type test
Own Id: OTP-5584
Further improvements of encrypted debug info: New option
Own Id: OTP-5541 Aux Id: seq9837
Fixed a bug in the validator of the generated code (beam_validator) which caused an internal compiler error even though the generated code was indeed correct.
Own Id: OTP-5481 Aux Id: seq9798
It is now possible to encrypt the debug information in
Beam files, to help keep the source code secret. See the
documentation for
The
Own Id: OTP-5460 Aux Id: seq9787
Complex functions could cause the internal validator in the compiler to generate an internal error even though the generated code was correct.
Own Id: OTP-5436 Aux Id: seq9781
In rare circumstances, incorrect code for record or tuple access could be generated. The incorrect code would either trigger an internal error in the compiler or cause an exception at run time. (Thanks to Martin Bjorklund.)
Corrected a bug in in bit syntax matching where clauses could match in the wrong order. (Thanks to Ulf Wiger.)
Own Id: OTP-5404 Aux Id: seq9767
Given bit syntax construction in certain complex contexts involving a catch, the compiler would either crash or terminate due to failure in an internal consistency check. (Thanks to Fredrik Thulin.)
Matches such as
Shadowing of variables in bit syntax matches in fun heads
such as in
A bug in the validation pass has been corrected. It
sometimes occurred when the compiler optimized by reusing
code for causing an exception when the reused code was
called from within catch or try-catch statements. Then the
validator refused to approve the code and complained about
A bug in the unknown_catch_try_state.
Corrected a bug in the optimizer that would cause the compiler to crash. (Thanks to Peter-Henry Mander.)
There are now warnings generated if a bit syntax
construction will fail at run-time because of a type
mismatch (e.g.
Own Id: OTP-5342 Aux Id: OTP-5118, OTP-5270, OTP-5323
Binary pattern matching such as
Own Id: OTP-5371
In rare cases, the code compiler code generate code for a tuple match that could crash the emulator if passed a term that was not a tuple.
If a bit syntax construction failed within a catch, previously assigned variables could get the wrong value.
The compiler now runs a validation pass on the generated code and aborts before writing a Beam file if any suspect code is found. In particular, the validation pass checks for incorrect code that may cause emulator crashes or other strange symptoms in the emulator.
Some corrections to the unsupported feature parameterized modules by Richard Carlsson (HiPE).
Own Id: OTP-5247 Aux Id: OTP-5235
Corrected the release note regarding
A few minor issues code generation issues were corrected. Although the generated code was correct, it was slightly slower and larger than it needed to be.
A debug printout (that could be seen in rare circumstances) has been removed.
New options
The
Corrected some bugs in the undocumented feature "parameterized modules".
Own Id: OTP-5198
When the undocumented feature "parameterized modules" was
used, the
Own Id: OTP-5224