aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
AgeCommit message (Collapse)Author
2014-01-29compiler: Fix core parse for MapsBjörn-Egil Dahlberg
2014-01-29compiler: Fixup #map_pair{} specBjö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: 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
2014-01-28sys_core_fold: Remove optimization that has become invalidBjörn Gustavsson
With the => and := operators for updating maps, this optimization is no longer valid.
2014-01-28compiler: Implement support for exact Op in MapsBjörn-Egil Dahlberg
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.
2014-01-28Extend representation for maps in Core ErlangBjörn-Egil Dahlberg
2014-01-28Update erl_lint, erl_expand_records, sys_pre_expand for MapsBjörn-Egil Dahlberg
Update erlang lint and syntax expand for #{ K := V }
2014-01-28erts: Add the type-testing guard BIF is_map/1Björn-Egil Dahlberg
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.
2014-01-28compiler: Fix sorted keys in put_map instructionBjörn-Egil Dahlberg
All pairs in a Map needs to be in strict ascending key order.
2014-01-28compiler: Fix multiple same keysBjörn-Egil Dahlberg
2014-01-28compiler: Check for duplicate key literals in MapBjörn-Egil Dahlberg
If a literal key already is present in a Map update the latter should be used. Warn for previous duplicates in the Map.
2014-01-28compiler: Handle literals, not just atoms, as keys in mapsBjörn-Egil Dahlberg
2014-01-28compiler: Fix no basic blocks for mapsBjörn-Egil Dahlberg
2014-01-28compiler: Fix stack register reorderingBjörn-Egil Dahlberg
Can now handle {list [reg()]} elements in instructions.
2014-01-28Implement support for maps in the compilerBjörn Gustavsson
To make it possible to build the entire OTP system, also define dummys for the instructions in ops.tab.
2014-01-28Introduce a representation for maps in Core ErlangBjörn Gustavsson
2014-01-28Update erl_lint, erl_expand_records, sys_pre_expand for mapsBjörn Gustavsson
2014-01-24beam_except: Eliminate compiler crashBjörn Gustavsson
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
2014-01-20Merge branch 'bjorn/compiler/optimizations/OTP-11584'Björn Gustavsson
* bjorn/compiler/optimizations/OTP-11584: Generalize optimizations of case statements Ignore warnings when running sys_core_fold after inlining
2014-01-20Merge branch 'bjorn/fix-line-number-in-bs-exception/OTP-11572'Björn Gustavsson
* bjorn/fix-line-number-in-bs-exception/OTP-11572: compiler: Correct line number in exception from binary construction
2014-01-17compiler: Silence false warning for unmatched return in 'after' clauseBjörn Gustavsson
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.
2014-01-16Generalize optimizations of case statementsBjörn Gustavsson
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.
2014-01-16compiler: Correct line number in exception from binary constructionBjörn Gustavsson
Reported-by: Stanislav Seletskiy
2014-01-08Ignore warnings when running sys_core_fold after inliningBjörn Gustavsson
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.
2013-12-19Eliminate bottlenecks in sys_core_foldBjörn Gustavsson
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.
2013-12-18Officially support building assembler filesTuncer Ayaz
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.
2013-12-13Keep exit blocks in order when moving them in beam_jumpAnthony Ramine
This makes applying the pass a second time a no-op.
2013-12-13Add missing recv_set, recv_mark and '%' to BEAM live annotationAnthony Ramine
2013-12-13Collect all optimised allocate instructions in beam_blockAnthony Ramine
Any init instruction following an allocate is put in the Inits list of the corresponding alloc tuple.
2013-12-13Properly collect allocate_zero instructions in beam_blockAnthony Ramine
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.
2013-12-13Properly let floating-point instructions through in the BEAM compilerAnthony Ramine
The compiler shouldn't crash when fed an already-optimised BEAM assembly file.
2013-12-12EEP 37: Funs with namesAnthony Ramine
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.
2013-11-04Merge branch 'maint'Fredrik Gustafsson
2013-11-01Typo fix ambigous -> ambiguousLeo Correa
2013-10-14Merge branch 'maint'Fredrik Gustafsson
2013-09-25Merge branch 'nox/lift-after/OTP-11267'Fredrik Gustafsson
* nox/lift-after/OTP-11267: Lift 'after' blocks to zeroary functions
2013-09-12Remove ^L characters hidden randomly in the code. Not those used in text ↵Pierre Fenoll
files as delimiters. While working on a tool that processes Erlang code and testing it against this repo, I found out about those little sneaky 0xff. I thought it may be of help to other people build such tools to remove non-conforming-to-standard characters.
2013-09-09Merge branch 'maint'Björn Gustavsson
* maint: core_lint: Correct the type error() to conform to the code
2013-09-09core_lint: Correct the type error() to conform to the codeBjörn Gustavsson
Commit 60984ade updated the code, but not the type spec. Noticed-by: Kostis Sagonas