aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
AgeCommit message (Collapse)Author
2014-02-18Fix library application appup filesTobias Schlager
As discussed in issue #240 *all* OTP library applications use the '.*' wildcard as up and down version. This makes library applications always up- and downgradeable. Using the wildcard version obsoletes all maintenance tasks regarding library applications' appup files. Additionally, it prevents upgrade problems caused by automatically included application dependencies when using reltool to create releases. Missing copyright headers are now consistently present.
2014-02-14Merge branch 'kostis/beam_validator-minor-fix'Björn Gustavsson
* kostis/beam_validator-minor-fix: Change a list comprehension to a foreach/2 call
2014-02-13Change a list comprehension to a foreach/2 callKostis Sagonas
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.
2014-02-13Merge branch 'bjorn/lc-warnings/OTP-11626' (early part)Björn Gustavsson
* 'bjorn/lc-warnings/OTP-11626' (early part): v3_core: Annotate list comprehensions to help out dialyzer
2014-02-13Merge branch 'nox/compiler/v3_core-case-arg-opt'Björn Gustavsson
* nox/compiler/v3_core-case-arg-opt: Optimise case arguments in sys_core_fold Run sys_core_fold twice if any inliner is used
2014-02-12Merge branch 'bjorn/compiler/optimizations/OTP-11584'Björn Gustavsson
* 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
2014-02-11Teach sys_core_fold:eval_case/2 to cope with handwritten Core ErlangBjörn Gustavsson
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
2014-02-11sys_core_fold: Remove a redundant word in a commentBjörn Gustavsson
2014-02-11Optimise case arguments in sys_core_foldAnthony 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
2014-02-10Merge branch 'josevalim/suppress-all-auto-imports'Henrik Nord
* josevalim/suppress-all-auto-imports: Allow all auto imports to be suppressed at once OTP-11682
2014-02-10Merge branch 'egil/compiler/maps-fix-sys_core_fold'Björn-Egil Dahlberg
* egil/compiler/maps-fix-sys_core_fold: compiler: Fix sys_core_fold let optimization compiler: Add debug listing after sys_core_fold
2014-02-10Merge branch 'egil/compiler/maps-fix-codegen'Björn-Egil Dahlberg
* egil/compiler/maps-fix-codegen: compiler: Fix codegen multiple updates for Maps erts,compiler: Correct and amend tests for Maps
2014-02-07compiler: Fix sys_core_fold let optimizationBjörn-Egil Dahlberg
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.
2014-02-07compiler: Add debug listing after sys_core_foldBjörn-Egil Dahlberg
2014-02-07Run sys_core_fold twice if any inliner is usedAnthony Ramine
2014-02-07compiler: Fix codegen multiple updates for MapsBjörn-Egil Dahlberg
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.
2014-02-07erts,compiler: Correct and amend tests for MapsBjörn-Egil Dahlberg
Faulty test for maps update
2014-02-07Merge branch 'hsv/using_lists_droplast'Henrik Nord
* 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
2014-02-07Merge branch 'egil/erts/fix-maps-beam_load'Björn-Egil Dahlberg
* egil/erts/fix-maps-beam_load: compiler: Update map_SUITE with error case test erts: Maps must fail on exact updates of empty Maps erts: Fix Maps for beam_load
2014-02-07compiler: Update map_SUITE with error case testBjörn-Egil Dahlberg
M#{ key := V } should fail when M is not a Map
2014-02-06Merge branch 'bjorn/compiler/applying-binary-crash/OTP-11672'Björn Gustavsson
* 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
2014-02-06Merge branch 'bjorn/compiler/optimizations/OTP-11584'Björn Gustavsson
* 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
2014-02-05beam_bsm: Eliminate emulator crash when a binary is calledBjörn Gustavsson
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
2014-02-05beam_validator: Validate the "fun" argument for a call_fun/1 instructionBjörn Gustavsson
The fun argument for a call_fun/1 instruction was not validated.
2014-02-05Merge branch 'bjorn/eep37/OTP-11537'Björn Gustavsson
* bjorn/eep37/OTP-11537: Issue a warning when a named fun is constructed but not used
2014-02-04sys_core_fold: Prevent case expressions from being evaluated twiceBjörn Gustavsson
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
2014-02-04sys_core_fold_SUITE: For cleanliness, move id/1 to the endBjörn Gustavsson
2014-01-31compiler: Teach beam_disasm has_map_field instructionBjörn-Egil Dahlberg
2014-01-31compiler: Fold binary Map key patterns to literalsBjörn-Egil Dahlberg
2014-01-31v3_core: Annotate list comprehensions to help out dialyzerBjörn Gustavsson
2014-01-31compiler: Strengthen listings testsBjörn-Egil Dahlberg
2014-01-31compiler: Strengthen Maps testsBjörn-Egil Dahlberg
2014-01-30Issue a warning when a named fun is constructed but not usedBjörn Gustavsson
2014-01-29compiler: Add core compile test for mapsBjörn-Egil Dahlberg
2014-01-29compiler: Fix core parse for MapsBjörn-Egil Dahlberg
2014-01-29compiler: Fixup #map_pair{} specBjörn-Egil Dahlberg
2014-01-29compiler: Update inliner testsBjörn-Egil Dahlberg
2014-01-29compiler: Squash #c_map_pair_*{} to #c_map_pair{}Björn-Egil Dahlberg
Simplify compiler internals and parsing of core format.
2014-01-29compiler: Squash #k_map_pair_*{} to #k_map_pair{}Björn-Egil Dahlberg
Simplify compiler internals for kernel passes.
2014-01-29compiler: Fix term order compiler for mapsBjörn-Egil Dahlberg
2014-01-28compiler: Rename map pattern to proper nameBjörn-Egil Dahlberg
2014-01-28compiler: Add Maps types to cerlBjörn-Egil Dahlberg
2014-01-28compiler: Format stacktrace on errorBjörn-Egil Dahlberg
2014-01-28compiler: Teach Maps to beam_disasmBjörn-Egil Dahlberg
2014-01-28compiler: Fix v3_core for map update syntaxBjörn-Egil Dahlberg
Make map update expressions safe, i.e. (foo())#{ k1 := 1 }
2014-01-28compiler: Fix get_map_element bug with allocateBjörn-Egil Dahlberg
The instruction get_map_element has a faillabel so you may not use the instruction within a allocate/deallocate block.
2014-01-28compiler: Test Maps inliningBjörn-Egil Dahlberg
2014-01-28compiler: Teach Maps understanding to inlinerBjörn-Egil Dahlberg
2014-01-28compiler: Implement different instructions for => and :=Björn Gustavsson
2014-01-28Pass the map pair operators through to the v3_codegen passBjörn Gustavsson