aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
AgeCommit message (Collapse)Author
2017-10-10Merge branch 'lars/doc-cleanup/OTP-14475' into maintLars Thorsen
* lars/doc-cleanup/OTP-14475: [edoc] Remove unused module otpsgml_layout.erl Remove unused files from the documentation build
2017-10-05Merge branch 'maint-19' into maintRickard Green
* maint-19: Updated OTP version Update release notes Update version numbers Conflicts: OTP_VERSION erts/doc/src/notes.xml erts/vsn.mk lib/compiler/doc/src/notes.xml lib/compiler/vsn.mk otp_versions.table
2017-10-05Update release notesErlang/OTP
2017-10-05Update version numbersErlang/OTP
2017-10-02Prepare releaseErlang/OTP
2017-09-29Fix incorrect internal consistency failure for binary matching codeBjörn Gustavsson
4c31fd0b9665 made the merging of match contexts stricter; in fact, a little bit too strict. Two match contexts with different number of slots would be downgraded to the 'term' type. The correct way is to keep the match context but set the number of slots to the lowest number of slots of the two match contexts. https://bugs.erlang.org/browse/ERL-490
2017-09-28Remove unused files from the documentation buildLars Thorsen
2017-09-22Update release notesErlang/OTP
2017-09-22Update version numbersErlang/OTP
2017-08-30Make handling of match contexts stricterBjörn Gustavsson
beam_validator could fail issue a diagnostic when a register that was supposed to be a match context was not guaranteed to be a match context. The bug was in merging of types. Merging of a match context with another term would result in a match context. That is wrong. Merging should produce a more general type, not a narrower type. Also, the valid slots in two match contexts should be combined with 'band', not 'bor'.
2017-08-24Merge branch 'maint-20' into maintRaimo Niskanen
* maint-20: Updated OTP version Prepare release Accept non-binary options as socket-options Bump version Fix broken handling of default values in extensions for PER compiler: Fix live regs update on allocate in validator Take fail labels into account when determining liveness in block ops Check for overflow when appending binaries, and error out with system_limit
2017-08-23Prepare releaseErlang/OTP
2017-08-23Merge branch ↵Erlang/OTP
'john/compiler/fail-labels-in-blocks-otp-19/ERIERL-48/OTP-14522' into maint-20 * john/compiler/fail-labels-in-blocks-otp-19/ERIERL-48/OTP-14522: compiler: Fix live regs update on allocate in validator Take fail labels into account when determining liveness in block ops
2017-08-22Merge branch ↵Lukas Larsson
'john/compiler/fail-labels-in-blocks-otp-18/ERIERL-48/OTP-14522' into maint * john/compiler/fail-labels-in-blocks-otp-18/ERIERL-48/OTP-14522: compiler: Fix live regs update on allocate in validator Take fail labels into account when determining liveness in block ops Conflicts: lib/compiler/src/beam_utils.erl
2017-08-16compiler: Fix live regs update on allocate in validatorLukas Larsson
The state without pruned registers was passed on to test_heap causing the validator to belive registers that aren't live actually are live.
2017-08-16compiler: Fix live regs update on allocate in validatorLukas Larsson
The state without pruned registers was passed on to test_heap causing the validator to belive registers that aren't live actually are live.
2017-08-16Take fail labels into account when determining liveness in block opsJohn Högberg
2017-08-07Take fail labels into account when determining liveness in block opsJohn Högberg
2017-08-07sys_core_fold: Fix unsafe optimization of non-variable applyBjörn Gustavsson
The sys_core_fold pass would do an unsafe "optimization" when an apply operation did not have a variable in the function position as in the following example: > cat test1.core module 'test1' ['test1'/2] attributes [] 'i'/1 = fun (_f) -> _f 'test1'/2 = fun (_f, _x) -> apply apply 'i'/1 (_f) (_x) end > erlc test1.core no_file: Warning: invalid function call Reported-by: Mikael Pettersson
2017-06-21Prepare releaseErlang/OTP
2017-06-14Update copyright yearHans Nilsson
2017-06-14Merge branch 'bjorn/compiler/fix-invalid-orddict'Björn Gustavsson
* bjorn/compiler/fix-invalid-orddict: v3_kernel: Keep orddicts sorted sys_core_fold: Ensure that orddict keys are unique
2017-06-14Merge branch 'bjorn/cuddle-with-tests'Björn Gustavsson
* bjorn/cuddle-with-tests: Eliminate warnings for unused variables Remove unused functions in test emulator test suites process_SUITE: Don't leave processes running trace_port_SUITE: Don't leave processes running tracer_SUITE: Don't leave processes running trace_nif_SUITE: Don't leave processes running trace_bif_SUITE: Don't leave processes running trace_SUITE: Don't leave processes running message_queue_data_SUITE: Don't leave processes running Add informational test case z_SUITE:leaked_processes/1 busy_port_SUITE: Ensure that all created procesesses are killed busy_port_SUITE: Eliminate warnings for unused variables busy_port_SUITE: Eliminate 'export_all' after_SUITE: Don't leave a process running beam_type_SUITE: Add a test case for an already fixed bug
2017-06-13v3_kernel: Keep orddicts sortedBjörn Gustavsson
2017-06-13sys_core_fold: Ensure that orddict keys are uniqueBjörn Gustavsson
All keys in an orddict must be unique. sys_core_fold:sub_sub_scope/1 broke that rule. It was probably harmless, but it is better to avoid such rule violations.
2017-06-12Merge branch 'hasse/unicode_atoms/OTP-14285'Hans Bolinder
* hasse/unicode_atoms/OTP-14285: compiler: Handle (bad) Unicode parse transform module names kernel: Improve handling of Unicode filenames stdlib: Handle Unicode atoms in ms_transform stdlib: Improve Unicode handling of the Erlang parser stdlib: Handle unknown compiler options with Unicode stdlib: Handle Unicode macro names stdlib: Correct Unicode handling in escript dialyzer: Improve handling of Unicode parsetools: Improve handling of Unicode atoms stdlib: Handle Unicode atoms when formatting stacktraces stdlib: Add more checks of module names to the linter stdlib: Handle Unicode atoms better in io_lib_format stdlib: Handle Unicode atoms in c.erl
2017-06-12compiler: Handle (bad) Unicode parse transform module namesHans Bolinder
2017-06-12beam_type_SUITE: Add a test case for an already fixed bugBjörn Gustavsson
https://bugs.erlang.org/browse/ERL-433
2017-06-07Fix unsafe bit syntax matching optimizationBjörn Gustavsson
As part of sys_core_fold, variables involved in bit syntax matching would be annotated when it would be safe for a later pass to do the delayed sub-binary creation optimization. An implicit assumption regarding the annotation was that the code must not be further optimized. That assumption was broken in 05130e48555891, which introduced a fixpoint iteration (applying the optimizations until there were no more changes). That means that a variable could be annotated as safe for reusing the match context in one iteration, but a later iteration could rewrite the code in a way that would make the optimization unsafe. One way to fix this would be to clear all reuse_for_context annotations before each iteration. But that would be wasteful. Instead I chose to fix the problem by moving out the annotation code to a separate pass (sys_core_bsm) that is run later after all major optimizations of Core Erlang has been done.
2017-05-31Revert "Prepare release"Hans Nilsson
This reverts commit eaf8ca41dfa4850437ad270d3897399c9358ced0.
2017-05-30Prepare releaseErlang/OTP
2017-05-23Correct handling of module name in compile:forms/1,2Björn Gustavsson
compile:forms/1,2 is documented to return: {ok,ModuleName,BinaryOrCode} However, if one of the options 'from_core', 'from_asm', or 'from_beam' is given, ModuleName will be returned as []. A worse problem is that is that if one those options are combined with the 'native' option, compilation will crash. Correct compile:forms/1,2 to pick up the module name from the forms provided (either Core Erlang, Beam assembly code, or a Beam file). Reported here: https://bugs.erlang.org/browse/ERL-417
2017-05-19genop.tab: Add an OTP 20 commentBjörn Gustavsson
Make it clear that is_tagged_tuple/4 was added in OTP 20 (not R17).
2017-05-19Merge branch 'bjorn/cuddle-with-tests'Björn Gustavsson
* bjorn/cuddle-with-tests: code_SUITE: Remove unused functions Eliminate warning for variable 'Config' being unused compile_SUITE: Don't create a directory called 'core' Don't crash in end_per_testcase/2 in code_SUITE:on_load_embedded/1
2017-05-17compile_SUITE: Don't create a directory called 'core'Björn Gustavsson
A core dump can't be created with the name 'core' if there is a directory named 'core'. Rename the test case from core/1 to core_pp/1 so that the directory name can be the same as the test case name. It also makes sense to use a less generic name for the test case.
2017-05-16Merge pull request #1453 from bjorng/bjorn/catch-warning/OTP-14401Björn Gustavsson
Warn for potentially unsafe use of get_stacktrace/0
2017-05-12Warn for potentially unsafe use of get_stacktrace/0Björn Gustavsson
erlang:get_stacktrace/0 returns the stacktrace for the latest exception. The problem is that the stacktrace is kept until the next exception occurs. If the last exception was a 'function_clause' or a 'badarg', the arguments for the call are also kept forever. The arguments can be terms of any size (potentially huge). In a future release, we would like to only allow erlang:get_stacktrace/0 from within a 'try' expression. That would make it possible to clear the stacktrace when the 'try' expression is exited. The 'catch' expression has no natural end where the stacktrace could be cleared. The stacktrace could be cleared at the end of the function that the 'catch' occurs in, but that would cause problems in the following scenario (from real life, but simplified): try ... catch _:_ -> io:format(...), io:format("~p\n", [erlang:get_stacktrace()]) end. %% In io.erl. format(Fmt, Args) -> Res = case ... of SomePattern -> catch... ...; SomeOtherPattern -> %% Output the formatted string here ... end, clear_stacktrace(), %% Inserted by compiler. Res. The call to io:format() would always clear the stacktrace before it could be retrieved. That problem could be solved by tightning the scope in which the stacktrace is kept, but the rules for how long erlang:get_stacktrace/0 would work would become complicated. Therefore, the solution we suggest for a future major release of OTP is that erlang:get_stacktrace/0 will return [] if it is called outside the 'catch' part of a 'try' expression. To help users prepare, introduce a warning when it is likely that erlang:get_stacktrace/0 will always return an empty list, for example in this code: catch error(foo), Stk = erlang:get_stacktrace() or in this code: try Expr catch _:_ -> ok end, Stk = erlang:get_stacktrace()
2017-05-11Merge branch 'bjorn/compiler/cover'Björn Gustavsson
* bjorn/compiler/cover: compiler.cover: Remove deleted module sys_pre_expand Cover the first clause of v3_core:bin_expand_string/4 compile_SUITE: Test the r16, r17, r18, r19 options erl_bifs: Remove pure BIFs serving no useful purpose erl_bifs: Remove erlang:hash/2 from list of pure functions
2017-05-11Merge pull request #1451 from bjorng/bjorn/compiler/nowarn_obsolete_guardBjörn Gustavsson
Correct description of nowarn_obsolete_guard By default, warnings for obsolete guards are turned on. Correct the description to make that clear.
2017-05-11Update compile.xmlBjörn Gustavsson
2017-05-10compiler.cover: Remove deleted module sys_pre_expandBjörn Gustavsson
2017-05-10Cover the first clause of v3_core:bin_expand_string/4Björn Gustavsson
The uncovered clause was introduced in bee8f839296e.
2017-05-10compile_SUITE: Test the r16, r17, r18, r19 optionsBjörn Gustavsson
Also test other options that turns off certain optimizations or instruction sets.
2017-05-10erl_bifs: Remove pure BIFs serving no useful purposeBjörn Gustavsson
Functions that can are known be pure can be evaluated at compile-time if the arguments are literals and if the result is expressible as a literal. list_to_ref/1 and list_to_port/1 returns terms that cannot be expressed as literals, so the optimization is not possible. The argument for port_to_list/1 is never a literal, so there is no way to evaluate it at compile-time. Therefore, marking those functions as pure serves no useful purpose. Note: list_to_pid/1 *is* marked as pure, but only so that we can test the code in sys_core_fold that rejects pure functions that evaluate to at term that is not possible to express as a literal. It is sufficient to have one pure function of that kind.
2017-05-10erl_bifs: Remove erlang:hash/2 from list of pure functionsBjörn Gustavsson
erlang:hash/2 was removed in c5d9b970fb5b3a71.
2017-05-09Merge pull request #1439 from josevalim/jv-atu8-functionBjörn Gustavsson
Add a test for utf8 function names
2017-05-08Add a test for utf8 function namesJosé Valim
The test found a bug in v3_kernel_pp which was not taking into account utf8 atoms. The bug has also been fixed.
2017-05-08Merge pull request #1442 from bjorng/bjorn/compiler/fix-slimBjörn Gustavsson
Make 'slim' slim again
2017-05-05Merge pull request #1438 from josevalim/patch-10Björn Gustavsson
Remove unused variable warning in compile_SUITE
2017-05-05Revert "Prepare release"Raimo Niskanen
This reverts commit dc57404252c47520f352834ad9be45ad684f96c9.