aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
AgeCommit message (Collapse)Author
2019-07-30Fix compiler crash when compiling with +no_type_optBjörn Gustavsson
If the `no_type_opt` option was given, the compiler would crash when attempting to compile containing with a `try`...`after` construct, such as this code: foo() -> try make_ref() after ok end. To avoid having this bug re-appear, test the `no_type_opt` option in the test suites. https://bugs.erlang.org/browse/ERL-997
2019-07-11Merge branch 'maint-22' into maintJohn Högberg
* maint-22: Updated OTP version Prepare release # Conflicts: # make/otp_version_tickets
2019-07-11Merge branch 'john/compiler/fix-bad-try_catch-recv-fix/OTP-15953/ERL-999' ↵John Högberg
into maint * john/compiler/fix-bad-try_catch-recv-fix/OTP-15953/ERL-999: compiler: Fix compiler crash introduced by OTP-15952
2019-07-10Prepare releaseErlang/OTP
2019-07-10compiler: Fix compiler crash introduced by OTP-15952John Högberg
An assertion in code generation would fail when the common exit block was ?BADARG_BLOCK, as some operations expect to always "fail" directly to that block (= throw an exception) and we had inserted a dummy block in between. Other operations could also get funny fail labels, jumping to blocks that immediately jumped to {f,0}, but these were all cleaned up by beam_jump, sweeping the bug under the rug.
2019-07-10Merge branch 'maint-22' into maintJohn Högberg
* maint-22: Updated OTP version Prepare release # Conflicts: # make/otp_version_tickets
2019-07-09Prepare releaseErlang/OTP
2019-07-09Merge branch 'john/compiler/fix-fail-path-exceptions-bsm/OTP-15946' into ↵Erlang/OTP
maint-22 * john/compiler/fix-fail-path-exceptions-bsm/OTP-15946: beam_ssa_bsm: Leave ?BADARG_BLOCK alone when cloning fail path
2019-07-09Merge branch 'john/compiler/fix-unsafe-tuple_size-opt/OTP-15945' into maint-22Erlang/OTP
* john/compiler/fix-unsafe-tuple_size-opt/OTP-15945: beam_ssa_opt: Do not apply tuple_size optimization outside guards
2019-07-09Merge branch 'john/compiler/fix-try_catch-receives/OTP-15952' into maintJohn Högberg
* john/compiler/fix-try_catch-receives/OTP-15952: compiler: Fix broken 'receive' in try/catch blocks
2019-07-09compiler: Fix broken 'receive' in try/catch blocksJohn Högberg
This fix is rather ugly and tacked-on, but I'm not comfortable refactoring the pass in an emergency patch.
2019-07-04Merge branch 'john/compiler/fix-fail-path-exceptions-bsm/OTP-15946' into maintJohn Högberg
* john/compiler/fix-fail-path-exceptions-bsm/OTP-15946: beam_ssa_bsm: Leave ?BADARG_BLOCK alone when cloning fail path
2019-07-04Merge branch 'john/compiler/fix-unsafe-tuple_size-opt/OTP-15945' into maintJohn Högberg
* john/compiler/fix-unsafe-tuple_size-opt/OTP-15945: beam_ssa_opt: Do not apply tuple_size optimization outside guards
2019-07-03beam_ssa_bsm: Leave ?BADARG_BLOCK alone when cloning fail pathJohn Högberg
2019-07-03beam_ssa_opt: Do not apply tuple_size optimization outside guardsJohn Högberg
Rewriting `tuple_size` to `is_tuple` + `tuple_size` will cause it not to throw an exception, either crashing the compiler or the emulator when the code runs.
2019-06-26Fix slow compilation of huge functionsBjörn Gustavsson
Some huge functions would compile very slowly because of a bottleneck in `beam_ssa:def_used/2`. One example is the `cuter_binlib` module in https://github.com/cuter-testing/cuter. On my computer, this commit reduces the compilatation time for `cuter_binlib` to 45 seconds down from more than 4 minutes. Noticed-by: Kostis Sagonas
2019-06-24Eliminate dialyzer warningsBjörn Gustavsson
Eliminate the Dialyzer warnings shown when the limits in lib/cerl/erl_types.erl were raised as follows: -define(TUPLE_TAG_LIMIT, 10). -define(TUPLE_ARITY_LIMIT, 10). -define(SET_LIMIT, 64).
2019-06-13Merge branch 'maint-22' into maintJohn Högberg
* maint-22: Updated OTP version Prepare release # Conflicts: # make/otp_version_tickets
2019-06-12Prepare releaseErlang/OTP
2019-06-12Merge branch 'john/compiler/fix-bad-bitstring-type-opt/OTP-15872' into maint-22Erlang/OTP
* john/compiler/fix-bad-bitstring-type-opt/OTP-15872: beam_ssa_type: Fix incorrect bitstring unit determination
2019-06-11Merge branch 'john/erts/fix-bad-get_tuple_element-opt/OTP-15871/ERIERL-374' ↵John Högberg
into maint * john/erts/fix-bad-get_tuple_element-opt/OTP-15871/ERIERL-374: erts: Fix bad loader optimization of get_tuple_element
2019-06-11Merge branch 'john/compiler/fix-bad-bitstring-type-opt/OTP-15872' into maintJohn Högberg
* john/compiler/fix-bad-bitstring-type-opt/OTP-15872: beam_ssa_type: Fix incorrect bitstring unit determination
2019-06-10erts: Fix bad loader optimization of get_tuple_elementJohn Högberg
The following sequence would be wrongly optimized into a i_get_tuple_element2 instruction, reading an element from the wrong tuple: {get_tuple_element,{x,0},1,{x,0}}. {get_tuple_element,{x,0},2,{x,1}}.
2019-06-10beam_ssa_type: Fix incorrect bitstring unit determinationJohn Högberg
The compiler would treat the "Unit" of bs_init instructions as the unit of the result instead of the required unit of the input, causing is_binary checks to be wrongly optimized away.
2019-06-03Merge branch 'maint-22' into maintHans Bolinder
* maint-22: Updated OTP version Prepare release # Conflicts: # make/otp_version_tickets
2019-05-29Prepare releaseErlang/OTP
2019-05-29Merge branch 'bjorn/compiler/fix-beam_ssa_dead-patch/OTP-15845' into maint-22Erlang/OTP
* bjorn/compiler/fix-beam_ssa_dead-patch/OTP-15845: Fix unsafe optimizations where guard tests could be removed
2019-05-29Merge branch ↵Erlang/OTP
'bjorng_ghub/bjorn/compiler/fix-beam_ssa_dead-crash/ERL-956/OTP-15848' into maint-22 * bjorng_ghub/bjorn/compiler/fix-beam_ssa_dead-crash/ERL-956/OTP-15848: Eliminate crash in the beam_ssa_dead compiler pass
2019-05-29Merge branch 'bjorn/compiler/fix-unloadable-code-patch/ERL-955/OTP-15846' ↵Erlang/OTP
into maint-22 * bjorn/compiler/fix-unloadable-code-patch/ERL-955/OTP-15846: Fix loading of Core Erlang code for extracting a map element
2019-05-29Merge branch 'bjorn/compiler/fix-beam_except/ERL-954/OTP-15839' into maint-22Erlang/OTP
* bjorn/compiler/fix-beam_except/ERL-954/OTP-15839: Fix compiler crash in beam_except
2019-05-29Merge branch 'bjorn/compiler/fix-unsafe-type-inference/OTP-15838' into maint-22Erlang/OTP
* bjorn/compiler/fix-unsafe-type-inference/OTP-15838: Fix unsafe negative type inference # Conflicts: # lib/compiler/src/beam_ssa_type.erl
2019-05-29Merge branch 'john/compiler/list_append_type/OTP-15841' into maint-22Erlang/OTP
* john/compiler/list_append_type/OTP-15841: compiler: Fix broken type for erlang:'++'/2
2019-05-29Merge branch 'bjorn/compiler/fix-receive-patch/ERL-950/OTP-15832' into maint-22Erlang/OTP
* bjorn/compiler/fix-receive-patch/ERL-950/OTP-15832: Eliminate compiler crash when compiling complex receive statements
2019-05-29Merge pull request #2263 from ↵Björn Gustavsson
bjorng/bjorn/compiler/fix-beam_ssa_dead-crash/ERL-956/OTP-15848 Eliminate crash in the beam_ssa_dead compiler pass
2019-05-28Merge branch 'john/compiler/list_append_type/OTP-15841' into maintJohn Högberg
2019-05-28Fix unsafe optimizations where guard tests could be removedBjörn Gustavsson
A repeated test could be optimized away. Example: bar(A) -> if is_bitstring(A) -> if is_binary(A) -> binary; true -> bitstring end; true -> other end. In the example, the `is_binary/1` test would be optimized away, basically turning the example into: bar(A) -> if is_bitstring(A) -> bitstring; true -> other end. Thanks user Marcus Kruse in the Elixir forum for noticing this bug.
2019-05-28Eliminate crash in the beam_ssa_dead compiler passBjörn Gustavsson
The compiler could crash in the beam_ssa_dead pass while compiling complex nested `case` expressions. See the added test case for an example and explanation. https://bugs.erlang.org/browse/ERL-956
2019-05-27Merge branch 'bjorn/compiler/fix-unloadable-code-patch/ERL-955/OTP-15846' ↵Björn Gustavsson
into maint * bjorn/compiler/fix-unloadable-code-patch/ERL-955/OTP-15846: Fix loading of Core Erlang code for extracting a map element
2019-05-27Merge branch 'bjorn/compiler/fix-beam_ssa_dead-patch/OTP-15845' into maintBjörn Gustavsson
* bjorn/compiler/fix-beam_ssa_dead-patch/OTP-15845: Fix unsafe optimizations where guard tests could be removed
2019-05-27Merge branch 'bjorn/compiler/fix-beam_except/ERL-954/OTP-15839' into maintBjörn Gustavsson
* bjorn/compiler/fix-beam_except/ERL-954/OTP-15839: Fix compiler crash in beam_except
2019-05-27Fix compiler crash in beam_exceptBjörn Gustavsson
The compiler would crash in `beam_except` while compiling this function: bar(Req) -> ok = case Req of "POST" -> {error, <<"BAD METHOD ", Req/binary>>, Req}; _ -> ok end. https://bugs.erlang.org/browse/ERL-954
2019-05-27Merge branch 'bjorn/compiler/fix-unsafe-type-inference/OTP-15838' into maintBjörn Gustavsson
* bjorn/compiler/fix-unsafe-type-inference/OTP-15838: Fix unsafe negative type inference
2019-05-27compiler: Fix broken type for erlang:'++'/2John Högberg
2019-05-27Fix loading of Core Erlang code for extracting a map elementBjörn Gustavsson
The following Core Erlang code could not be loaded: 'f'/1 = fun (_1) -> case <_1> of <~{'foo':='foo'}~> when 'true' -> _1 end Loading would fail with the following message: beam/beam_load.c(2314): Error loading function example:f/1: op i_get_map_element_hash p x a u x: no specific operation found https://bugs.erlang.org/browse/ERL-955
2019-05-25Fix unsafe optimizations where guard tests could be removedBjörn Gustavsson
A repeated test could be optimized away. Example: bar(A) -> if is_bitstring(A) -> if is_binary(A) -> binary; true -> bitstring end; true -> other end. In the example, the `is_binary/1` test would be optimized away, basically turning the example into: bar(A) -> if is_bitstring(A) -> bitstring; true -> other end. Thanks user Marcus Kruse in the Elixir forum for noticing this bug.
2019-05-24Fix unsafe negative type inferenceBjörn Gustavsson
The type optimizer pass (`beam_ssa_type`) could make unsafe negative inferences. That is, incorrectly infer that a variable could *not* have a particular type. This bug was found when adding another optimization. It is not clear how write a failing test case without that added optimization.
2019-05-23Merge branch 'bjorn/compiler/fix-receive-patch/ERL-950/OTP-15832' into maintBjörn Gustavsson
* bjorn/compiler/fix-receive-patch/ERL-950/OTP-15832: Eliminate compiler crash when compiling complex receive statements
2019-05-22Merge branch 'bjorn/compiler/fix-freeze/ERL-948/OTP-15828' into maintBjörn Gustavsson
* bjorn/compiler/fix-freeze/ERL-948/OTP-15828: Fix non-terminating compilation
2019-05-21Eliminate compiler crash when compiling complex receive statementsBjörn Gustavsson
Certain complex receive statements would result in an internal compiler failure. That would happen when the compiler would fail to find the common exit block following a receive. See the added test case for an example. https://bugs.erlang.org/browse/ERL-950
2019-05-20Fix non-terminating compilationBjörn Gustavsson
The compiler would not terminate while compiling the following code: foo(<<N:32>>, Tuple, NewValue) -> _ = element(N, Tuple), setelement(N, Tuple, NewValue). The type analysis pass would attempt to construct a huge list when attempting analyse the type of `Tuple` after the call to `setelement/3`. https://bugs.erlang.org/browse/ERL-948