Age | Commit message (Collapse) | Author |
|
|
|
Do a simpler translation of internal BIFs.
While we are it, also remove the dummy values of Index and Uniq
from the make_fun internal operation.
|
|
Remove the special handling #k_try{} in guards in v3_life. If we
introduce a new #k_protected{} record in v3_kernel, v3_life no longer
needs to know whether it is processing guards or bodies.
|
|
When beam_utils was first written, it did not have the functions
for testing whether a register was not used. Those were added
later, in sort of a hacky way.
Also, is_killed*() and is_not_used*() for Y registers would
return the same answer. Fix that to make the API more consistent
(an Y register can only be killed by a deallocate/1 instruction).
We will need to change beam_trim to call beam_utils:is_not_used/3
instead of beam_utils:is_killed/3.
|
|
During development, a bug in beam_utils caused a compiler failure
in xmerl. If the bug reappears, make sure that we catch it when
compiling the compiler test suite.
|
|
|
|
There is no need to list every obscure safe BIF in erl_bifs:is_safe/3.
The purpose of erl_bifs:is_safe/3 is merely to warn when the
return value of one of the safe BIFs is ignored.
|
|
The error would be:
{multiple_match_contexts,[{x,0},2]}
instead of:
{multiple_match_contexts,[{x,0},{y,2}]}
|
|
Since the beam_a pass has always been run and have removed any
unused label, there can never be a label as the very last
instruction in a function.
|
|
eliminate_fallthroughs/2 has special code to handle two labels next to
each other, but that does not seem to ever happen and there was one
line uncovered in is_label/1. Since inserting an extra jump between
two labels would not cause any real problems, remove the extra
handling of two consecutive labels.
|
|
The compiler stopped using sys_pre_expand in ae3e177c514c354831.
|
|
=== OTP-19.1 ===
Changed Applications:
- asn1-4.0.4
- common_test-1.12.3
- compiler-7.0.2
- crypto-3.7.1
- debugger-4.2.1
- dialyzer-3.0.2
- diameter-1.12.1
- edoc-0.8
- erl_docgen-0.6
- erl_interface-3.9.1
- erts-8.1
- eunit-2.3.1
- gs-1.6.2
- hipe-3.15.2
- ic-4.4.2
- inets-6.3.3
- jinterface-1.7.1
- kernel-5.1
- mnesia-4.14.1
- observer-2.2.2
- odbc-2.11.3
- parsetools-2.1.3
- reltool-0.7.2
- runtime_tools-1.10.1
- sasl-3.0.1
- snmp-5.2.4
- ssh-4.3.2
- ssl-8.0.2
- stdlib-3.1
- syntax_tools-2.1
- tools-2.8.6
- wx-1.7.1
- xmerl-1.3.12
Unchanged Applications:
- cosEvent-2.2.1
- cosEventDomain-1.2.1
- cosFileTransfer-1.2.1
- cosNotification-1.2.2
- cosProperty-1.2.1
- cosTime-1.2.2
- cosTransactions-1.3.2
- eldap-1.2.2
- et-1.6
- megaco-3.18.1
- orber-3.8.2
- os_mon-2.4.1
- otp_mibs-1.1.1
- percept-0.9
- public_key-1.2
- typer-0.9.11
Conflicts:
OTP_VERSION
lib/gs/doc/src/notes.xml
lib/gs/vsn.mk
|
|
|
|
* maint:
beam_validator: Handle unreachable instructions
Turn off parallel make for start scripts Makefile
|
|
ab03678e introduced an optimization in the beam_z pass that could
introduce unreachable code in BEAM files (a 'jump' instruction is
removed after a 'raise' instruction, but the code following the
target of the 'jump' is not removed).
Since this situation happens very rarely, there is no point in adding
another pass that can remove unreachable code after beam_z. Instead we
will make sure that beam_validator can skip the unreachable code.
Skipping unreachable code is already done in valfun_1/2 (for
historical reasons), but we will also need to do it in val_dsetel/2.
|
|
* maint:
[snmp] Correct bug when path to mib contains UTF-8 characters
[ic] Fix but when UTF-8 character in path to idl spec
sys_core_fold: Don't move a fun into a guard
|
|
Moving a fun into a guard may cause code that is not accepted
by beam_validator.
|
|
* bjorn/floor-ceiling/OTP-13692:
Add math:floor/1 and math:ceil/1
Implement the new ceil/1 and floor/1 guard BIFs
|
|
Add math:floor/1 and math:ceil/1 to avoid unnecessary conversions
in floating point expressions. That is, instead of having to write
float(floor(X)) as part of a floating point expressions, we can
write simply math:floor(X).
|
|
Implement as ceil/1 and floor/1 as new guard BIFs (essentially part of
Erlang language). They are guard BIFs because trunc/1 is a guard
BIF. It would be strange to have trunc/1 as a part of the language, but
not ceil/1 and floor/1.
|
|
The filters in a list comprehension can be guard expressions or
an ordinary expressions.
If a guard expression is used as a filter, an exception will basically
mean the same as 'false':
t() ->
L = [{some_tag,42},an_atom],
[X || X <- L, element(1, X) =:= some_tag]
%% Returns [{some_tag,42}]
On the other hand, if an ordinary expression is used as a filter, there
will be an exception:
my_element(N, T) -> element(N, T).
t() ->
L = [{some_tag,42},an_atom],
[X || X <- L, my_element(1, X) =:= some_tag]
%% Causes a 'badarg' exception when element(1, an_atom) is evaluated
It has been allowed for several releases to override a BIF with
a local function. Thus, if we define a function called element/2,
it will be called instead of the BIF element/2 within the module.
We must use the "erlang:" prefix to call the BIF.
Therefore, the following code is expected to work the same way as in
our second example above:
-compile({no_auto_import,[element/2]}).
element(N, T) ->
erlang:element(N, T).
t() ->
L = [{some_tag,42},an_atom],
[X || X <- L, element(1, X) =:= some_tag].
%% Causes a 'badarg' exception when element(1, an_atom) is evaluated
But the compiler refuses to compile the code with the following
diagnostic:
call to local/imported function element/2 is illegal in guard
|
|
* bjorn/eliminate-sys_pre_expand/OTP-13856:
Remove sys_pre_expand
xref: Eliminate use of sys_pre_expand
debugger: Eliminate use of sys_pre_expand
compiler: Eliminate use of sys_pre_expand
shell_SUITE: Eliminate references to sys_pre_expand in comments
qlc_pt: Simplify code because of updated erl_expand_records
Teach erl_expand_records to translate module-less calls
erl_internal: Add add_predefined_functions/1
cover: Remove always stale comment
|
|
* maint:
doc: Correct errors introduced by Editorial changes
|
|
The previous commits have made sys_pre_expand superfluous. Since
sys_pre_expand is undocumented and unsupported it can be removed in
a major release without prior deprecation.
Also remove code in erl_parse that handles abstract code that has
passed through sys_pre_expand.
We considered deprecating sys_pre_expand just in case, but decided
against it for the following reasons:
- Anyone brave and knowledgeable enough to use sys_pre_expand should
be able to cope with sys_pre_expand being removed.
- If we kept it, but didn't test it anywhere in OTP, it could
potentially stop working. So we would probably have to add some test
cases.
|
|
sys_pre_expand previously did a lot more work, for example,
translating records and funs, but now is merely a grab bag
of small transformations. Move those transformations to
v3_core.
|
|
Fix some older errors as well.
|
|
105c5b0071 was reverted in dd1162846e because clauses that were
supposed to match would not match. (See 8b83bc0b.)
Reintroduce the optimization, but make sure that we only shortcut
bs_context_to_binary instructions and not bs_start_match2 instructions.
|
|
Don't only test the case that failed; test it exhaustively.
|
|
* maint:
asn1_test_lib: Compile ASN.1 modules in parallel
Support 'make -j' when compiling ASN.1 modules
[ERL-209] Fix ambiguous_catch_try_state inconsistency error
|
|
It is not safe to share code between 'catch' blocks.
|
|
* josevalim/large-binary-strings/PR-1131/OTP-13794:
Move expansion of strings in binaries to v3_core
|
|
* maint:
Update primary bootstrap
beam_block: Fix potentially unsafe optimization in move_allocates/1
|
|
beam_block has an optimization that only is safe when it is applied
immediately after code generation. That is pointed out in a comment:
NOTE: Moving allocation instructions is only safe because it is done
immediately after code generation so that we KNOW that if {x,X} is
initialized, all x registers with lower numbers are also initialized.
That assumption may not be true after other optimizations, such as
the beam_utils:live_opt/1 optimization.
The new beam_reorder pass added in OTP 19 runs before beam_block.
Therefore, the optimization is potentially unsafe. The optimization
is also unsafe if compilation is started from assembly code in a
.S file.
Rewrite the optimization to make it safe. See the newly added comment
for details.
ERL-202
|
|
This speeds up the compilation of binary literals
with string values in them. For example, compiling
a file with a ~340kB binary would yield the following
times by the compiler:
Compiling "foo"
parse_module : 0.130 s 5327.6 kB
transform_module : 0.000 s 5327.6 kB
lint_module : 0.011 s 5327.8 kB
expand_module : 0.508 s 71881.2 kB
v3_core : 0.463 s 11.5 kB
Notice the increase in memory and processing time
in expand_module and v3_core. This happened because
expand_module would expand the string in binaries
into chars. For example, the binary <<"foo">>, which
is represented as
{bin, 1, [
{bin_element, 1, {string, 1, "foo"}, default, default}
]}
would be converted to
{bin, 1, [
{bin_element, 1, {char, 1, $f}, default, default},
{bin_element, 1, {char, 1, $o}, default, default},
{bin_element, 1, {char, 1, $o}, default, default}
]}
However, v3_core would then traverse all of those
characters and convert it into an actual binary, as it
is a literal value.
This patch addresses this issue by moving the expansion
of string into chars to v3_core and only if a literal
value cannot not be built. This reduces the compilation
time of the file mentioned above to the values below:
Compiling "bar"
parse_module : 0.134 s 5327.6 kB
transform_module : 0.000 s 5327.6 kB
lint_module : 0.005 s 5327.8 kB
expand_module : 0.000 s 5328.7 kB
v3_core : 0.013 s 11.2 kB
|
|
Conflicts:
OTP_VERSION
|
|
|
|
|
|
This reverts commit 105c5b0071056dc062797e58772e098d2a3a4627.
|
|
The following regression was introduced in 19.0:
foo(bar, <<"x">>) -> 1;
foo(_, <<"x">>) -> 2;
foo(_, <<"y">>) -> 3;
foo(_, _) -> fail.
The call foo(bar,<<"y">>) would errorneous return 'fail' instead of 3.
A testcase in match_SUITE has been added to verify this.
|
|
* maint:
Fix spec of compile:(noenv_)forms/2
|
|
* aronisstav/compiler/fix-compile-forms-spec/PR-1109:
Fix spec of compile:(noenv_)forms/2
|
|
* bjorn/gc-bifs:
compiler: Eliminate num_bif_SUITE
erl_internal: Eliminate duplication of guard tests
beam_debug: Improve the disassembly of gc_bif instructions
Simplify creation of new GC BIFs
make_tables: Remove broken automatic BIF aliasing
|
|
num_bif_SUITE.erl was originally copied from the emulator test
suite. It does not test much of the compiler.
Therefore, remove num_bif_SUITE. Add a new test to bif_SUITE
to test trunc/1 and round/1 in contexts that could be tricky
for the compiler to handle correctly. Note that there is no
need to test abs/1 in bif_SUITE, since it is tested in many
other places (e.g. in guard_SUITE).
|
|
Any exceptions at this point would be of class error, not exit.
|
|
When the compiler fails to write an output file, it used to just print
"error writing file". With this change, it also prints the error
reason:
$ echo "-module(foo)." > foo.erl
$ chmod -w .
$ erlc foo.erl
/tmp/bar/foo.bea#: error writing file: permission denied
|
|
|
|
The input for a call to compile:(noenv_)forms/2 can also be a cerl
module (useful e.g. to resume with 'from_core' after a 'to_core'
compilation).
Internal representations used for 'from_asm' and 'from_beam'
compilation can also be valid, but have no relevant types defined.
|
|
|
|
retrieve the value of the environment variable ERL_COMPILER_OPTIONS
in the same manner as used by file/2, forms/2 and output_generated/2
|
|
* bjorn/compiler/misc:
misc_SUITE: Cover the remaining lines in beam_peep
Avoid the dreaded "no_file" in warnings
Eliminate crash for map updates in guards
beam_block: Eliminate crash in beam_utils
|