Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
|
|
|
|
Make map update expressions safe, i.e. (foo())#{ k1 := 1 }
|
|
The instruction get_map_element has a faillabel so you may not
use the instruction within a allocate/deallocate block.
|
|
|
|
|
|
|
|
|
|
With the => and := operators for updating maps, this optimization is
no longer valid.
|
|
The syntax is handled upto v3_kernel where it is reduced to
previous behaviour for construction and updates. Meaning,
the ':=' operator is handled exactly as '=>' operator.
|
|
|
|
Update erlang lint and syntax expand for #{ K := V }
|
|
To add a type-testing guard BIF, the following steps are needed:
* The BIF itself is added to bif.tab (note that it should be declared
using "ubif", not "bif"), and its implementation to erl_bif_op.c.
* erl_internal must be modified in 3 places: The type test must be
recognized as guard BIF, as a type test, and it must be auto-imported.
* There must be an instruction that implements the same type test as
the BIF (it will be used in guards). beam_utils:bif_to_test/3 must
be updated to recognize the new guard BIF.
|
|
All pairs in a Map needs to be in strict ascending key order.
|
|
|
|
If a literal key already is present in a Map update the latter should be used.
Warn for previous duplicates in the Map.
|
|
|
|
|
|
Can now handle {list [reg()]} elements in instructions.
|
|
To make it possible to build the entire OTP system, also define
dummys for the instructions in ops.tab.
|
|
|
|
|
|
Code such as:
bar(X) ->
case {X+1} of
1 -> ok
end.
would crash the beam_except pass of the compiler.
The reason for the crash is that the '+' operator would add a line/1
instruction that the beam_except pass was not prepared to handle.
Reported-by: Erik Søe Sørensen
|
|
re needs unicode option
|
|
* bjorn/compiler/optimizations/OTP-11584:
Generalize optimizations of case statements
Ignore warnings when running sys_core_fold after inlining
|
|
* bjorn/fix-line-number-in-bs-exception/OTP-11572:
compiler: Correct line number in exception from binary construction
|
|
Because 26940a8c0c lifted code in the 'after' clause of 'try' to
a new function, Dialyzer could produce false warnings for code such
as:
try
...
after
file:close(F)
end.
Mark the the call to the generated function as 'compiler_generated'
to silence the warning.
|
|
Case expressions such as:
case {Expr1,Expr} of
{V1,V2} -> ...
end
are already optimized to not actually build the tuple. Generalize
the optimization to avoid building any kind of composite term,
such as:
case {ok,[A,B]} of
{ok,[X,Y]} -> ...
end
We don't expect programmers to write such code directly, but
inlining can produce such code.
We need to be careful about the warnings we produce. If the case
expression is a literal, it is expected that no warnings should be
produced for clauses that don't match. We must make sure that we
continue to suppress those warnings.
|
|
Reported-by: Stanislav Seletskiy
|
|
* nox/fix-dbg_ieval-exporting-rules/OTP-11553:
compiler tests: Test exporting rules for andalso/orelse
Fix evaluation of andalso and orelse in the debugger
|
|
|
|
The new inliner (cerl_inline) does not mark inlined code as compiler
generated. Therefore, when sys_core_fold is run after inlining, it
may generate spurious warnings.
The easiest way out (for now, at least) is to discard all warnings
found when running sys_core_fold after inlining.
|
|
Compiling programs with very many uses of the "dot notation"
for extracting a record element could be very slow. The reason
is that each extraction of a record element (R#r.a) would first be
transformed to code like this:
case R of
{r,rec0,_,_} -> rec0;
_ -> error({badrecord,r})
end
In Core Erlang, each '_' would be become a new variable. The
resulting code would be optimized by sys_core_fold, but the
optimization process could be very slow.
Profiling shows that sub_del_var/2 was the worst bottleneck, and the
sub_is_val/2 the second worst bottleneck. In both cases, the culprit
is the linear traversal of a very long list (the list of variable
substitutions). Fortunately, there already is a gb_set (the scope)
which contains all variables that are currently live. If a variable is
not known to be live, it is no point in doing the linear operation on
the list.
|
|
erlc is wired to treat *.core files as core and build them as
compile:file(File, [from_core]), but this is not documented. There's
also an udocumented compile:file/2 option called 'from_core'. This has
been in place and in use for a long time. Therefore, it should be
supported officially.
To fix that, make the following changes:
* document erlc handling of *.core files
* document 'from_core'
|
|
erlc is wired to treat *.S files as assembler and build them as
compile:file(File, [from_asm]), but this is not documented. There's also
a documented compile:file/2 option called 'asm' (mapping to 'from_asm'),
but the wording discourages its use. All of this has been in place and
in use for a long time. Therefore, it should be supported officially.
To fix that, make the following changes:
* document erlc handling of *.core files
* un-document 'asm' and document 'from_asm' instead
* deprecate 'asm'
While at it, fix a minor typo in the test suite.
|
|
|
|
This makes applying the pass a second time a no-op.
|
|
|
|
Any init instruction following an allocate is put in the Inits list of the
corresponding alloc tuple.
|
|
If an allocate_zero instruction is fed to beam_block and the beam_type
pass is not used afterwards (e.g. with erlc +no_topt), the 'no_opt' atom
will be rejected by beam_flatten.
|
|
The compiler shouldn't crash when fed an already-optimised BEAM assembly file.
|
|
|
|
This adds optional names to fun expressions. A named fun expression
is parsed as a tuple `{named_fun,Loc,Name,Clauses}` in erl_parse.
If a fun expression has a name, it must be present and be the same in
every of its clauses. The function name shadows the environment of the
expression shadowing the environment and it is shadowed by the
environment of the clauses' arguments. An unused function name triggers
a warning unless it is prefixed by _, just as every variable.
Variable _ is allowed as a function name.
It is not an error to put a named function in a record field default
value.
When transforming to Core Erlang, the named fun Fun is changed into
the following expression:
letrec 'Fun'/Arity =
fun (Args) ->
let <Fun> = 'Fun'/Arity
in Case
in 'Fun'/Arity
where Args is the list of arguments of 'Fun'/Arity and Case the
Core Erlang expression corresponding to the clauses of Fun.
This transformation allows us to entirely skip any k_var to k_local
transformation in the fun's clauses bodies.
|
|
The R16B03 release
Conflicts:
lib/sasl/vsn.mk
|
|
|
|
* maint:
Rename otp_8949_a/0 which common_test interprets as an info function
|
|
Before running a test case named testcase/1, common_test will call
testcase/0 (the info function). Exceptions and illegal return values
would be silently ignored. In a planned update to common_test, errors
will instead cause the test case to fail.
The test case otp_8949_a/1 has a helper function called otp_8949_a/0.
Rename it to do_otp_8949_a/0.
While at it, also fix a copy and paste bug in the list of test cases.
otp_8949_a was run twice; otp_8949_b was never run.
|