aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
AgeCommit message (Collapse)Author
2014-03-05Do not try to optimize non-boolean guardsAnthony Ramine
Expressions such as erlang:'or'(bar, true) can make beam_bool crash if it tries to optimize them, as this code is not quite really written by users, no attempt to rewrite them more efficiently should be done, for simplicity's sake. Reported-by: Ulf Norell
2014-03-05Properly check label use in get_map_elements in beam_jumpAnthony Ramine
Reported-by: Ulf Norell
2014-03-04Support maps in cerl_clauses:match/2Anthony Ramine
Without this, sys_core_fold could crash on non-matching clauses using maps patterns. Reported-by: Ulf Norell
2014-03-04Properly order Kernel code for maps with mixed pairsAnthony Ramine
The Kernel instructions were not properly ordered when compiling maps with complex values mixed in assoc and exact pairs. Reported-by: Ulf Norell
2014-03-04Properly sort map pairs in v3_codegenAnthony Ramine
Literal nil values aren't tagged tuple but the bare atom nil. The function lists:sort/2 expects the passed function to return true if the first element is less than or equal to the second, not strictly less than. The original base clause is changed accordingly. Reported-by: Ulf Norell
2014-03-04Properly lint calls in Core Erlang guardsAnthony Ramine
Not all calls to the erlang module are legal guards in Core Erlang.
2014-03-04Merge branch 'nox/maps-fix-beam_bool-put_map'Björn-Egil Dahlberg
* nox/maps-fix-beam_bool-put_map: Properly collect labels in put_map instructions in beam_bool
2014-03-04Merge branch 'nox/maps-expand-update'Björn-Egil Dahlberg
* nox/maps-expand-update: Fix expansion of map update arguments
2014-03-04Merge branch 'nox/compiler/v3_core-mismatched-apply'Björn Gustavsson
* nox/compiler/v3_core-mismatched-apply: Do not emit blatantly illformed Core Erlang apply expressions
2014-03-04Merge branch 'nox/compiler/sys_core_fold-erlang-is_record-3'Björn Gustavsson
* nox/compiler/sys_core_fold-erlang-is_record-3: Do not mark all calls to erlang:is_record/3 as safe
2014-03-04Introduce compiler option 'nowarn_deprecated_type'Hans Bolinder
The deprecation of the built-in types dict/0 and so on had as side-effect that it was impossible to switch to dict:dict/2 and so on without getting warnings either in the the previous release (R16B) or the current one (17.0). By including the attribute -compile(nowarn_deprecated_type). in an Erlang source file warnings about deprecated types can be avoided in 17.0. The option can also be given as a compiler flag: erlc +nowarn_deprecated_type file.erl
2014-03-04Handle nil as a wait_timeout argument in beam_utils:live_opt/4Anthony Ramine
Reported-by: Ulf Norell
2014-03-04Properly detect nonboolean protected expressions in beam_boolAnthony Ramine
Silly code such as the following could make the compiler crash: f() when erlang:float(self()); true -> ok. Reported-by: Ulf Norell
2014-03-03Properly collect labels in put_map instructions in beam_boolAnthony Ramine
Reported-by: Ulf Norell
2014-03-03Do not mark all calls to erlang:is_function/2 as safeAnthony Ramine
Calls to erlang:is_function/2 where the second is not a literal nonnegative integer can crash at runtime and thus can't be marked as safe.
2014-03-02Do not mark all calls to erlang:is_record/3 as safeAnthony Ramine
Calls to erlang:is_record/3 where the second and third arguments are not respectively a literal atom and a literal integer can't be transformed to guards and thus are not safe. Reported-by: Ulf Norell
2014-03-01Do not emit blatantly illformed Core Erlang apply expressionsAnthony Ramine
(fun f/1)() should be compiled to let X = 'f'/1 in apply X () to let the compiler properly generate code that will fail with badarity at runtime. Reported-by: Ulf Norell
2014-03-01Fix expansion of map update argumentsAnthony Ramine
Reported-by: José Valim
2014-02-28compiler: Fix error message printout on compile errorBjörn-Egil Dahlberg
Use correct stack in printout.
2014-02-24Merge branch 'tuncer/update-deprecation-message/OTP-11751'Henrik Nord
* tuncer/update-deprecation-message/OTP-11751: compiler: update 'asm' deprecation message
2014-02-24Merge branch 'fenollp/otp-edoc-usage-fixes'Henrik Nord
* fenollp/otp-edoc-usage-fixes: Fix edoc usage errors OTP-11702
2014-02-24Merge branch 'egil/maps/fix-cerl-inlining'Björn-Egil Dahlberg
* egil/maps/fix-cerl-inlining: compiler: Update map_SUITE to handle inlining erts: Maps src instructions can't be literals compiler: Fix map inlining compiler: Add variable coverage of map in cerl
2014-02-24Merge branch 'hb/dialyzer/deprecate_types/OTP-10342'Hans Bolinder
* hb/dialyzer/deprecate_types/OTP-10342: Deprecate pre-defined built-in types
2014-02-24Merge branch 'schlagert/fix_basic_appups'Siri Hansen
* schlagert/fix_basic_appups: Dynamically configure typer_SUITE according to environment Disable hipe_SUITE when environment doesn't support it Make hipe non-upgradable by setting appup file empty Fix missing module on hipe app file template Add test suites performing app and appup file checks Introduce appup test utility Fix library application appup files Fix non-library appup files according to issue #240 OTP-11744
2014-02-24Add test suites performing app and appup file checksTobias Schlager
Add the mentioned test suites for *all* library and touched non-library applications.
2014-02-23Deprecate pre-defined built-in typesHans Bolinder
The types array(), dict(), digraph(), gb_set(), gb_tree(), queue(), set(), and tid() have been deprecated. They will be removed in OTP 18.0. Instead the types array:array(), dict:dict(), digraph:graph(), gb_set:set(), gb_tree:tree(), queue:queue(), sets:set(), and ets:tid() can be used. (Note: it has always been necessary to use ets:tid().) It is allowed in OTP 17.0 to locally re-define the types array(), dict(), and so on. New types array:array/1, dict:dict/2, gb_sets:set/1, gb_trees:tree/2, queue:queue/1, and sets:set/1 have been added.
2014-02-21compiler: Update map_SUITE to handle inliningBjörn-Egil Dahlberg
2014-02-21compiler: Fix map inliningBjörn-Egil Dahlberg
Added coverage of operating map variable.
2014-02-21compiler: Add variable coverage of map in cerlBjörn-Egil Dahlberg
2014-02-21Merge branch 'egil/compiler/maps-get_map_elements'Björn-Egil Dahlberg
* 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
2014-02-20compiler: Strengthen Maps compile testsBjörn-Egil Dahlberg
2014-02-20compiler: Remove dead warningBjörn-Egil Dahlberg
2014-02-19compiler: Transform list of Args to exact literal typeBjörn-Egil Dahlberg
2014-02-19compiler: Test Maps aliasingBjörn-Egil Dahlberg
2014-02-19compiler: Use aliasing in map pair patternsBjörn-Egil Dahlberg
2014-02-19compiler: Check literal order in beam_validatorBjörn-Egil Dahlberg
2014-02-19Merge branch 'nox/compiler/v3_core-comprehensions-cleanup'Björn Gustavsson
* nox/compiler/v3_core-comprehensions-cleanup: Simplify comprehension compilation in v3_core OTP-11720
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-17Simplify comprehension compilation in v3_coreAnthony Ramine
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.
2014-02-14compiler: update 'asm' deprecation messageTuncer Ayaz
Adapt 'asm' deprecation message to new version scheme.
2014-02-14Fix edoc usage errorsPierre Fenoll
Errors discovered using `erldocs`: Superfluous @hidden tag would exit edoc application; 'Multiple @spec tag': appended a @clear tag after macro condition; '@spec arity does not match': added missing argument.
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-13compiler: Change map instructions for fetching valuesBjörn-Egil Dahlberg
* Combine multiple get values with one instruction * Combine multiple check keys with one instruction
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