aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
AgeCommit message (Collapse)Author
2013-09-17Merge tag 'OTP_R16B02'Magnus Lidén
The R16B02 release Conflicts: lib/sasl/vsn.mk
2013-09-16Prepare releaseOTP_R16B02Erlang/OTP
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
2013-09-09Merge branch 'bjorn/xml-encoding-fix/OTP-11310' into maintBjörn Gustavsson
* bjorn/xml-encoding-fix/OTP-11310: Change encoding of troublesome notes.xml files to utf-8 Convert some notes.xml files from latin-1 to utf-8
2013-09-09Merge branch 'maint'Björn Gustavsson
* maint: compiler: Conform returned errors to the documented format
2013-09-06Change encoding of troublesome notes.xml files to utf-8Björn Gustavsson
Most notes.xml files will be updated in every release and cause the kind of the problems described in the previous commit.
2013-09-05compiler: Conform returned errors to the documented formatBjörn Gustavsson
ErrorInfo is documented to be: {ErrorLine,Module,ErrorDescriptor} but for some errors with line numbers it would look like: {Module,ErrorDescriptor} Ensure that all ErrorInfo tuples have three elements. Use 'none' instead of a line number: {none,Module,ErrorDescriptor} There already are errors that return 'none' when no line number is available, but that convention was not documented. Mention it in the documentation. Also make sure that the compiler will not print 'none' as a line number in error messages (if the 'report_errors' option is given) as that looks stupid. That is, when attempting to compile a non-existing module, the error message should be: non-existing.erl: no such file or directory and not: non-existing.erl:none: no such file or directory
2013-09-04Merge branch 'maint'Björn Gustavsson
* maint: (26 commits) genop.tab: Add documentation for many BEAM instructions asn1ct_constucted_per: Directly call asn1ct_gen_per Clean up handling of .asn1db files PER, UPER: Fix encoding/decoding of open types greater than 16K PER, UPER: Optimize table constraints PER, UPER: Optimize encoding using an intermediate format Refactor decoding of components of SEQUENCE OF / SET OF PER,UPER: Get rid of unused 'telltype' argument in decoding functions Optimize the generated encode/2 function UPER: Optimize complete/1 Clean up checking of objects Improve tests of deep table constraints BER: Handle multiple optional SEQUENCE fields with table constraints Test OPTIONAL and DEFAULT for open types PER/UPER: Fix encoding of an object set with multiple inlined constructs Remove broken support for multiple UNIQUE Extend the test for parameterized information objects asn1_SUITE: Remove off-topic (and slow) smp/1 test case SeqOf: Add more tricky SEQUENCE OF tests Clean up handling of extension addition groups ...
2013-09-04genop.tab: Add documentation for many BEAM instructionsBjörn Gustavsson
By Erik Stenman (happi) with corrections by me.
2013-08-26Merge branch 'maint'Fredrik Gustafsson
2013-08-26Merge branch 'nox/match-context-return/OTP-11247' into maintFredrik Gustafsson
* nox/match-context-return/OTP-11247: Added primary bootstrap Forbid returning a match context in beam_validator
2013-08-19Merge branch 'maint'Björn Gustavsson
* maint: Fix compiler crash for 'B and B' guard
2013-08-15Fix compiler crash for 'B and B' guardBjörn Gustavsson
2013-08-01Forbid returning a match context in beam_validatorAnthony Ramine
If a match context is returned from a function without being converted back to a plain old binary, the whole VM will crash.
2013-07-29Merge branch 'maint'Fredrik Gustafsson
Conflicts: bootstrap/lib/compiler/ebin/v3_core.beam
2013-07-29Merge branch 'nox/fix-comp-warnings/OTP-11212' into maintFredrik Gustafsson
* nox/fix-comp-warnings/OTP-11212: Bootstrap Silence a misleading warning with some comprehensions
2013-07-29Merge branch 'maint'Fredrik Gustafsson
Conflicts: bootstrap/lib/compiler/ebin/cerl_inline.beam
2013-07-29Merge branch 'nox/fix-fname-inlining/OTP-11211' into maintFredrik Gustafsson
* nox/fix-fname-inlining/OTP-11211: Added primary bootstrap Restrict inlining of local fun references
2013-07-11Merge branch 'maint'Fredrik Gustafsson
2013-07-11Merge branch 'jw/fix-float-middle-endian/OTP-11201' into maintFredrik Gustafsson
* jw/fix-float-middle-endian/OTP-11201: Fix binary construction on floating point middle-endian machines Fix binary matching on floating point middle-endian machines Fix erlang:phash2() on floating point middle-endian machines Fix external term format BIFs on floating point middle-endian machines
2013-07-03Restrict inlining of local fun referencesAnthony Ramine
Local fun references look like plain old variables in the Core Erlang AST but should not be treated as such. Inlining of such expressions is now restricted to application contexts as a local fun reference should never occur in a guard. This is not perfect as it forbids inlining in some safe situations, but that is still better than a compiler crash.
2013-06-26Merge branch 'nox/illegal-bitstring-gen-pattern/OTP-11186'Fredrik Gustafsson
* nox/illegal-bitstring-gen-pattern/OTP-11186: Bootstrap added Simplify v3_core's translation of bit string generators Forbid unsized fields in patterns of binary generators
2013-06-18Merge tag 'OTP_R16B01'Björn-Egil Dahlberg
The R16B01 release Conflicts: lib/sasl/vsn.mk
2013-06-17Prepare releaseOTP_R16B01Erlang/OTP
2013-06-14Fix binary construction on floating point middle-endian machinesJohannes Weißl
This complements 933e701 (OTP-10209). Without this patch the test cases "in_guard/1" and "coerce_to_float/1" in bs_construct_SUITE fail. The added lines in bs_construct_SUITE cover all branches that were not covered before (small and big numbers if BIT_OFFSET(erts_bin_offset) != 0).
2013-06-12Merge branch 'maint'Björn-Egil Dahlberg
2013-06-12Update copyright yearsBjörn-Egil Dahlberg
2013-06-07Silence a misleading warning with some comprehensionsAnthony Ramine
When compiling comprehensions with generators which are foldable to 'true', a misleading warning is emitted by sys_core_fold because a clause resulting from the compilation of the comprehension to Core Erlang is not marked as generated by the compiler. An example of such a comprehension is [ true || true ].
2013-06-05Simplify v3_core's translation of bit string generatorsAnthony Ramine
Now that unsized binary segments are forbidden in patterns of bit string generators, v3_core:append_tail_segment/2 does not need to check for an existing unsized tail segment and can thus be changed to a simple '++'/2 call.
2013-06-05Forbid unsized fields in patterns of binary generatorsAnthony Ramine
It makes no sense to be able to do `<<...,Rest/binary>> <= ...` in a comprehension. The related Dialyzer test is removed.
2013-06-03Merge branch 'maint'Björn Gustavsson
* maint: compiler: Correct liveness optimization for wait/1
2013-06-03Merge branch 'bjorn/compiler/fix-compiler-crash/OTP-11119' into maintBjörn Gustavsson
* bjorn/compiler/fix-compiler-crash/OTP-11119: compiler: Correct liveness optimization for wait/1
2013-05-31Merge branch 'maint'Fredrik Gustafsson
2013-05-29compiler: Correct liveness optimization for wait/1Björn Gustavsson
The live optimization in beam_utils:live_opt/4 did not take into account that the wait/1 instruction *never* falls through to the next instruction (it has the same effect on the control flow as the jump/1 instruction).
2013-05-28Merge remote-tracking branch 'upstream/maint'Ingela Anderton Andin
Conflicts: bootstrap/lib/stdlib/ebin/beam_lib.beam lib/public_key/test/erl_make_certs.erl
2013-05-28Fix renaming of bs_put_string instructionsAnthony Ramine
The clause was formerly commented-out because at this point in the code, no bs_put_string instruction has been generated yet when compiling from Erlang. If an Erlang module is compiled to BEAM assembly and the result contains a bs_put_string instruction, the output can't be compiled to binary anymore and the compiler crashes with the following error: $ erlc prs.S Function: compress/1 prs.S:none: internal error in beam_block; crash reason: {{case_clause, {'EXIT', {function_clause, [{beam_utils,live_opt, [[{bs_put_string,1,{string,[0]}}, {bs_init, {f,0}, {bs_append,0,8,{field_flags,[]}}, 0, [{integer,8},{x,0}], {x,1}}, {label,2}], 2, {1,{1,1,nil,nil}}, [{block, [{'%live',2}, {set,[{x,0}],[{x,1}],move}, {'%live',1}]}, return]], [{file,"beam_utils.erl"},{line,639}]}, {beam_utils,live_opt,1, [{file,"beam_utils.erl"},{line,205}]}, {beam_block,function,2, [{file,"beam_block.erl"},{line,38}]}, {lists,mapfoldl,3, [{file,"lists.erl"},{line,1329}]}, {beam_block,module,2, [{file,"beam_block.erl"},{line,29}]}, {compile,'-select_passes/2-anonymous-2-',2, [{file,"compile.erl"},{line,476}]}, {compile,'-internal_comp/4-anonymous-1-',2, [{file,"compile.erl"},{line,276}]}, {compile,fold_comp,3, [{file,"compile.erl"},{line,294}]}]}}}, [{compile,'-select_passes/2-anonymous-2-',2, [{file,"compile.erl"},{line,476}]}, {compile,'-internal_comp/4-anonymous-1-',2, [{file,"compile.erl"},{line,276}]}, {compile,fold_comp,3,[{file,"compile.erl"},{line,294}]}, {compile,internal_comp,4,[{file,"compile.erl"},{line,278}]}, {compile,'-do_compile/2-anonymous-0-',2, [{file,"compile.erl"},{line,152}]}]}
2013-05-20beam_lib, compile: Replace use of deprecated crypto functionsBjörn Gustavsson
Since both the STDLIB and compiler applications turn warnings into errors, we must stop using the old deprecated crypto functions. While we are at it, generalize the format of the key tuple returned by beam_lib:make_crypto_key/2 to facilitate introducing new crypto methods in the future. Change the format to: {Type,Key,IV,BlockSize} where Type, Key, and IV are the first three arguments for either crypto:block_encrypt4/ or crypto:block_decrypt/4, and BlockSize is the block size for the crypto algorithm (it is needed to properly pad the plaintext blocks before encryption).
2013-04-29Merge branch 'maint'Fredrik Gustafsson
2013-04-22Merge branch 'hb/unicode/OTP-10907'Björn Gustavsson
* hb/unicode/OTP-10907: otp_SUITE: Add test cases to ensure that OTP conventions are obeyed Convert XML files to UTF-8 Convert XML files to UTF-8, where needed Remove the "coding: utf-8" comment from all Erlang source files Update primary bootstrap Change the default encoding of Erlang files to UTF-8
2013-04-19Convert XML files to UTF-8Hans Bolinder
2013-04-19Convert XML files to UTF-8, where neededHans Bolinder
2013-04-19Remove the "coding: utf-8" comment from all Erlang source filesHans Bolinder
2013-04-19Merge branch 'nox/move-let-into-seq/OTP-11056'Fredrik Gustafsson
* nox/move-let-into-seq/OTP-11056: Move let expressions into sequences
2013-04-19Use a set to store ref registers in beam_receiveAnthony Ramine
In some circumstances, as when inlining code, when some optimization passes are disabled or with hand-written but semantically correct Core Erlang or BEAM assembly, a fresh reference may be live in more than one register: ... {allocate_zero,2,2}. ... {call_ext,0,{extfunc,erlang,make_ref,0}}. % Ref in [x0] ... {move,{x,0},{y,0}}. % Ref in [x0,y0] {move,{y,1},{x,0}}. % Ref in [y0] ... {move,{y,0},{x,0}}. % Ref in [x0,y0] {move,{x,0},{y,1}}. % Ref in [x0,y0,y1] {label,5}. {loop_rec,{f,6},{x,0}}. % Ref in [y0,y1] ... {loop_rec_end,{f,5}}. {label,6}. {wait,{f,5}}. ... Pass beam_receive expects a single live register for the ref when it encounters the loop_rec instruction and crashes with the following reason: $ erlc t.S ... crash reason: {{case_clause, {'EXIT', {{case_clause,[{y,1},{y,0}]}, [{beam_receive,opt_recv,5, [{file,"beam_receive.erl"},{line,154}]}, ...]}}}, ...} This commit teaches beam_receive how to use a set of registers instead of a single one when tracking fresh references, thus avoiding the crash.
2013-04-09Move let expressions into sequencesAnthony Ramine
The Core Erlang compiler simplifies let expressions by moving them into their argument when it is another let or a case expression. It can then perform other optimizations such as removing the let expressions altogether, sometimes saving BEAM registers later in the process. This commit teaches sys_core_fold how to move let expressions into sequence arguments.
2013-04-05Use erlang:demonitor(Ref, [flush]) where applicableLoïc Hoguin
2013-04-03Merge branch 'nox/fix-bc-optim/OTP-11005' into maintFredrik Gustafsson
* nox/fix-bc-optim/OTP-11005: Add a new option +clint0 to the compiler Fix optimization of some binary comprehensions
2013-03-28Add a new option +clint0 to the compilerAnthony Ramine
This option makes the compiler run the Core Erlang linting pass before any optimization pass, which can crash if the given code has unbound variables, something that is detected by core_lint.
2013-03-28Fix optimization of some binary comprehensionsAnthony Ramine
If a variable bound in a generator is used as the size of a segment in the comprehension body, v3_core uses this variable in the code generated to compute the initial size given to the `bs_init_writable` primop before the variable is actually bound, as in: << <<0:S>> || S <- Slist >> Reported-By: Peer Stritzinger