Age | Commit message (Collapse) | Author |
|
Added coverage of operating map variable.
|
|
|
|
* egil/compiler/maps-get_map_elements:
compiler: Strengthen Maps compile tests
compiler: Remove dead warning
erts: Fix erts_debug:disassemble/1
compiler: Transform list of Args to exact literal type
compiler: Test Maps aliasing
compiler: Use aliasing in map pair patterns
compiler: Check literal order in beam_validator
erts: Introduce new instructions for combined key fetches
compiler: Change map instructions for fetching values
|
|
|
|
|
|
|
|
|
|
* nox/compiler/v3_core-comprehensions-cleanup:
Simplify comprehension compilation in v3_core
OTP-11720
|
|
Given that map comprehensions and generators and maybe && generators will be added
to the language in the future, v3_core:lc_tq and v3_core:bc_tq could use a rewrite
to avoid a complexity explosion, where there are as many related clauses as the
product of the number of types of generators and the number of types of
comprehensions.
The new code abstract over all generators at the same time, there is only one clause
for generators per type of comprehension, and all the filter code has been put
in a common function filter_tq.
It should also be noted that generator inputs are now compiled before the rest
of the qualifiers, reversing names of nested comprehensions.
|
|
* kostis/beam_validator-minor-fix:
Change a list comprehension to a foreach/2 call
|
|
* Combine multiple get values with one instruction
* Combine multiple check keys with one instruction
|
|
Partly to avoid unmatched return warnings from dialyzer and in order
to preserve the style of other similar-looking code in that file.
While at it, fix the wording in one comment.
|
|
* 'bjorn/lc-warnings/OTP-11626' (early part):
v3_core: Annotate list comprehensions to help out dialyzer
|
|
* nox/compiler/v3_core-case-arg-opt:
Optimise case arguments in sys_core_fold
Run sys_core_fold twice if any inliner is used
|
|
* bjorn/compiler/optimizations/OTP-11584:
Teach sys_core_fold:eval_case/2 to cope with handwritten Core Erlang
sys_core_fold: Remove a redundant word in a comment
|
|
Starting in e12b7d5331c58b41db06cadfa4af75b78b62a2b1,
sys_core_fold:eval_case/2 will crash on handwritten but legal
Core Erlang programs such as:
case let <Var> = Arg in {'x',Var} of
{x,X} -> X
end
The problem is that the only clause *is* guaranteed to match, but
cerl_clauses:match_list/2 does not understand that; all it can say is
that the clause *may* match. In those circumstances, we will need to
keep the case.
Also make sure that we keep the case if the guard is something else
than 'true'. That is not strictly necessary, because in a legal Core
Erlang program the guard in the last clause in a case must always
evaluate to 'true', so removing the guard test would still leave the
program correct. Keeping the guard, however, will make it somewhat
easier to debug an incorrect Core Erlang program. (The unsafe_case
test case has guard test in the only clause in a case, so we don't
need to write a new test case to test that.)
Reported-by: Anthony Ramine
|
|
|
|
If the argument of a case expression is a let, a seq or a case with two clauses
where the second one is a failing clause; it can be moved outside the case and
further optimisations can be performed.
module 'foo' ['t'/4]
attributes []
't'/4 =
fun (_cor14,Sub0,_cor15,_cor16) ->
let Ssa = call 'erlang':'get' ('foo') in
case let Ssa = {'ssa',_cor14,Sub0,_cor15,_cor16} in
let _rec11 = call 'erlang':'+' (_cor14, 1) in
let _cor4 = call 'erlang':'setelement' (2, Ssa, _rec11) in
{{'tmp',_cor14},_cor4} of
{NewReg,Foo} when 'true' ->
{NewReg,Foo,Ssa}
_cor20 when 'true' ->
primop 'match_failure' ({'case_clause',_cor20})
end
end
==>
module 'foo' ['t'/4]
attributes []
't'/4 =
fun (_cor14,Sub0,_cor15,_cor16) ->
let Ssa = call 'erlang':'get' ('foo') in
let _fol0 = {'ssa',_cor14,Sub0,_cor15,_cor16} in
let _rec11 = call 'erlang':'+' (_cor14, 1) in
let _cor4 = call 'erlang':'setelement' (2, _fol0, _rec11) in
let NewReg = {'tmp',_cor14} in
{NewReg,_cor4,Ssa}
end
|
|
* egil/compiler/maps-fix-sys_core_fold:
compiler: Fix sys_core_fold let optimization
compiler: Add debug listing after sys_core_fold
|
|
* egil/compiler/maps-fix-codegen:
compiler: Fix codegen multiple updates for Maps
erts,compiler: Correct and amend tests for Maps
|
|
Map variable was not covered and faulty optimization could occur.
Ex.
t() ->
M0 = id(#{ "a" => 1 }),
#{ "a" := _ } = M0,
M0#{ "a" := b }.
M0 was lost in let expression optimization.
|
|
|
|
|
|
This fixes an error on multiple updates optimization for map pairs.
The error was introduced with moving to term order in Maps.
This also fixes an error where register life time was lost for values
and could result in erroneuos values being emitted in for map pairs.
Simplified v3_codegen by moving multiple update optimizations to v3_kernel.
|
|
* hsv/using_lists_droplast:
lib/mnesia/test/ - Replace reverse(tl(reverse(L))) with lists:droplast/1
lib/ssh - Replace reverse(tl(reverse(L))) with lists:droplast/1
lib/wx - Replace reverse(tl(reverse(L))) with lists:droplast/1
Use lists:droplast/1 in orber/orber_interceptors.erl
Import and use lists:droplast/1 in v3_core/v3_kernel
OTP-11678
OTP-11677
|
|
* bjorn/compiler/applying-binary-crash/OTP-11672:
beam_bsm: Eliminate emulator crash when a binary is called
beam_validator: Validate the "fun" argument for a call_fun/1 instruction
|
|
* bjorn/compiler/optimizations/OTP-11584:
sys_core_fold: Prevent case expressions from being evaluated twice
sys_core_fold_SUITE: For cleanliness, move id/1 to the end
|
|
We must not do the delayed binary creation optimization if the
code attempts to call the matched out binary. Calling a matchstate
will crash the run-time system.
Reported-by: Loïc Hoguin
|
|
The fun argument for a call_fun/1 instruction was not validated.
|
|
* bjorn/eep37/OTP-11537:
Issue a warning when a named fun is constructed but not used
|
|
In e12b7d5331c58b41db06cadfa4af75b78b62a2b1, a bug was introduced
that would cause case expressions to be evaluated more than once
if there were aliases in the pattern. Example:
X = Y = io:put_chars("some chars"),
{X,Y}
That would be rewritten to code similar to (but in Core Erlang):
X = io:put_chars("some chars"),
X = io:put_chars("some chars"),
{X,Y}
Make sure that we only evalute the expression once by doing a
transformation similar to (but in Core Erlang):
NewVar = io:put_chars("some chars"),
X = NewVar,
Y = NewVar,
{X,Y}
Reported-by: José Valim
Reported-by: Anthony Ramine
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Simplify compiler internals and parsing of core format.
|
|
Simplify compiler internals for kernel passes.
|
|
|
|
|
|
|
|
|
|
|
|
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.
|