aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
AgeCommit message (Collapse)Author
2014-10-03Merge branch 'egil/maps/variable-keys/OTP-12218'Björn-Egil Dahlberg
* egil/maps/variable-keys/OTP-12218: (22 commits) compiler: Update test for Maps aliasing compiler: Properly support Map aliasing compiler: Refactor Map pairs aliasing compiler: Fix harmless need_heap error for Maps stdlib: Update Map tests stdlib: Use environment bindings for Maps keys in erl_eval matching debugger: Update Map tests compiler: Update Map tests compiler: Fix v3_core Maps pair chains compiler: Use expressions in core patterns compiler: Use variables in Map cerl inliner compiler: Reintroduce binary limit for Map keys compiler: Shameless v3_core hack for variables compiler: Use variables in Map beam assmebler compiler: Use variables in Map kernel pass compiler: Use variables in Map core pass compiler: Normalize unary ops on Maps key literals stdlib: Update Map tests stdlib: erl_lint Map key variables compiler: Maps are always patterns never values in matching ...
2014-10-02compiler: Properly support Map aliasingBjörn-Egil Dahlberg
Matching of type: #{K := V1} = #{K := V2} = M, Will alias (coalesce) to #{K := V1 = V2} = M.
2014-10-01compiler: Refactor Map pairs aliasingBjörn-Egil Dahlberg
2014-10-01compiler: Fix harmless need_heap error for MapsBjörn-Egil Dahlberg
Need heap for maps is zero and fall through is also zero.
2014-09-01Update primary bootstrapBjörn Gustavsson
2014-09-01sys_core_fold: Eliminate name capture bugBjörn Gustavsson
The scope is supposed to contain all variables that are currently live. We need this information for certain optimizations to avoid capturing a name (a name that is in the scope must be renamed; for an example, see move_let_into_expr/2 or any function that calls sub_subst_scope/1). We also use the scope to optimize sub_del_var/2 and sub_is_val/2. When optimizing case expressions, the scope could be reset to an empty list (because sub_new/0 was called instead of sub_new/1). That could cause name capture if inlining was turned on. As simple way to force this bug is to uncomment the "-define(DEBUG, 1)." near the beginning of the file. Without this correction, most files in the test suite fail to compile.
2014-08-26compiler: Fix v3_core Maps pair chainsBjörn-Egil Dahlberg
Check for literals instead of variables when constructing chains.
2014-08-26compiler: Use expressions in core patternsBjörn-Egil Dahlberg
Two patterns, binary_segment size and map_pair key, are expressions even in matching. If only bound variables are used we are fine but some expressions which appears as literals needs to be lifted. Currently only Map key binaries will use this.
2014-08-26compiler: Use variables in Map cerl inlinerBjörn-Egil Dahlberg
2014-08-26compiler: Reintroduce binary limit for Map keysBjörn-Egil Dahlberg
2014-08-26compiler: Shameless v3_core hack for variablesBjörn-Egil Dahlberg
2014-08-26compiler: Use variables in Map beam assmeblerBjörn-Egil Dahlberg
2014-08-22compiler: Use variables in Map kernel passBjörn-Egil Dahlberg
2014-08-22compiler: Use variables in Map core passBjörn-Egil Dahlberg
2014-08-22compiler: Normalize unary ops on Maps key literalsBjörn-Egil Dahlberg
Unary ops are normalized before core transformation, i.e. handle negative integers as map keys. Strictly speaking, map keys are expressions but by handling them as patterns we can normalize negative integers.
2014-08-14Merge branch 'nox/compiler/improve-core-lint'Björn Gustavsson
* nox/compiler/improve-core-lint: Remove obsolete comment in core_lint Handle return mismatches for calls and primops Check for more return mismatches Use +clint0 in compiler's test suites
2014-08-07Remove obsolete comment in core_lintAnthony Ramine
2014-08-07Handle return mismatches for calls and primopsAnthony Ramine
Only exit BIFs and the match_fail primop are allowed to run where more than one value is expected.
2014-08-07Check for more return mismatchesAnthony Ramine
All expressions but calls and primops are now checked for return mismatches.
2014-07-03compiler: Maps are always patterns never values in matchingBjörn-Egil Dahlberg
Removed dead code.
2014-06-24compiler: Fix v3_kernel Maps pretty printingBjörn-Egil Dahlberg
2014-06-24compiler: Fix v3_core Maps pretty printingBjörn-Egil Dahlberg
Key and value were interchanged.
2014-06-17Merge branch 'maint'Hans Bolinder
* maint: [dialyzer] Correct a doc bug introduced in 0b041238 [dialyzer] Use the option 'dialyzer' to control the compiler [dialyzer] Fix handling of literal records
2014-06-17[dialyzer] Use the option 'dialyzer' to control the compilerHans Bolinder
2014-06-17[dialyzer] Fix handling of literal recordsHans Bolinder
This ticket is about records in Erlang code, and when to check the fields against the (optional) types given when defining records. Dialyzer operates on the Erlang Core format, where there are no trace of records. The fix implemented is a Real Hack: Given the new option 'dialyzer' erl_expand_records marks the line number of records in a way that is undone by v3_core, which in turn inserts annotations that can be recognized by Dialyzer.
2014-05-26Merge branch 'maint'Björn-Egil Dahlberg
2014-05-26Merge branch 'egil/fix-maps-pretty-layout/OTP-11947' into maintBjörn-Egil Dahlberg
* egil/fix-maps-pretty-layout/OTP-11947: dialyzer: Add Maps type mismatch test hipe,compiler: Fix Map literals pretty printing
2014-05-26Merge branch 'maint'Björn-Egil Dahlberg
2014-05-04Support maps in cerl:ann_make_tree/3Anthony Ramine
2014-04-28hipe,compiler: Fix Map literals pretty printingBjörn-Egil Dahlberg
2014-04-28Introduce the attribute -optional_callbacks in the context of behavioursHans Bolinder
2014-04-03compiler: Fix compiling map keys in patterns from coreBjörn-Egil Dahlberg
2014-04-03compiler,stdlib: Fix Map literals as keys for Maps in patternsBjörn-Egil Dahlberg
2014-03-28Take out no_native compiler attributeKostis Sagonas
2014-03-28Support the translation of the is_map BEAM instruction to IcodeKostis Sagonas
2014-03-26Merge branch 'egil/maps-compiler-coverage'Björn-Egil Dahlberg
* egil/maps-compiler-coverage: compiler: Do not evaluate map expressions with bad keys compiler: Throw 'nomatch' on matching with bad binary keys compiler: Variable keys are not allowed in Maps compiler: Strengthen Maps warnings tests compiler: map_pair cannot be a type clause in v3_life compiler: Remove redudant code in v3_codegen compiler: Test deep map structure compiler: Remove redundant clause in v3_codegen compiler: Cover #{ [] => Var } in testcase
2014-03-25compiler: Do not evaluate map expressions with bad keysBjörn-Egil Dahlberg
Map keys with large (non literal) binary keys must fail.
2014-03-25compiler: Throw 'nomatch' on matching with bad binary keysBjörn-Egil Dahlberg
Even if a binary key is written as a literal the compiler may choose to make an expression. Emit a warning in those cases and saying the case will not match. This is a limitation in current implementation.
2014-03-25compiler: Variable keys are not allowed in MapsBjörn-Egil Dahlberg
No need to check for variables in Map keys.
2014-03-25compiler: map_pair cannot be a type clause in v3_lifeBjörn-Egil Dahlberg
Map pairs are encapsulated in a map.
2014-03-25Correctly handle non-matching patterns against literal valuesAnthony Ramine
The pass sys_core_fold did not correctly handle non-matching patterns in code such as: 0 = case <<>> of <<>> -> 0; a -> 1 end. Function case_opt_lit/3 is rewritten in two passes to first remove any non-matching clause and only then potentially remove the related patterns in each clause. Reported-by: Ulf Norell
2014-03-24compiler: Remove redudant code in v3_codegenBjörn-Egil Dahlberg
2014-03-24compiler: Remove redundant clause in v3_codegenBjörn-Egil Dahlberg
Multiple 'nil' cannot happen on instruction level. Map keys are always unique with literals.
2014-03-20Introduce runtime_dependencies in .app filesRickard Green
Most dependencies introduced are exactly the dependencies to other applications found by xref. That is, there might be real dependencies missing. There might also be pure debug dependencies listed that probably should be removed. Each application has to be manually inspected in order to ensure that all real dependencies are listed. All dependencies introduced are to application versions used in OTP 17.0. This since the previously used version scheme wasn't designed for this, and in order to minimize the work of introducing the dependencies.
2014-03-20Merge branch 'ks/cerl-type-fixes'Björn-Egil Dahlberg
* ks/cerl-type-fixes: Restore the alphabetical order of Core Erlang records Clean up the types of cerl
2014-03-19Merge branch 'nox/maps-v3_core-lit_vars'Björn-Egil Dahlberg
* nox/maps-v3_core-lit_vars: Properly collect variables in map expressions in v3_core
2014-03-19Merge branch 'bjorn/compiler/utf8-warning/OTP-11791'Björn Gustavsson
* bjorn/compiler/utf8-warning/OTP-11791: Don't fail compilation for modules that contain invalid UTF-8 epp: Make it possible to specify a default encoding
2014-03-19Restore the alphabetical order of Core Erlang recordsKostis Sagonas
The introduction of c_map{} and c_map_pair{} unnecessarily broke the alphabetical order of Core Erlang records. They were probably placed at the end of the file so as to use other records as types. There is really no need for this since 'cerl' contains appropriate definitions of types that can be used for this purpose. While at it, a type declaration to the c_binary{} definition was added.
2014-03-19Clean up the types of cerlKostis Sagonas
The introduction of c_map and c_map_pair was not done properly. In particular, the definition of ctype() and an important Edoc comment were not up-to-date. While at it, - some more types were cleaned up and exported so as to be used in core_parse.hrl and - some obviously dead code was removed (the type/1 function does not return 'nil', which in turn simplified a clause in the code of meta_1/2).
2014-03-18Don't fail compilation for modules that contain invalid UTF-8Björn Gustavsson
The default encoding for Erlang modules is now UTF-8, and the compilation would fail if a module contained byte sequences that are not valid UTF-8 sequences. In a large project with say many hundreds of Erlang modules with names of developers such as "Björn" or "Håkan" encoded in latin-1, that could mean that many hundreds of files would need to be modified just to get started testing OTP 17. As a temporary measure to ease the transition, automatically fall back to the latin-1 encoding with a warning for any module that contains invalid byte sequences and for which no encoding has been specified. The intention is to remove this workaround in OTP 18 or 19.