aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
AgeCommit message (Collapse)Author
2019-06-18Merge branch 'john/compiler/fun-environment-types/OTP-15896'John Högberg
* john/compiler/fun-environment-types/OTP-15896: compiler: Propagate types of free variables
2019-06-18Merge branch 'john/compiler/cuddle-type-representation'John Högberg
* john/compiler/cuddle-type-representation: compiler: Add common method for literal -> type conversion
2019-06-17compiler: Propagate types of free variablesJohn Högberg
2019-06-17Create a shared wrapper function for all occurrences of 'fun F/A'Björn Gustavsson
If the `fun F/A` syntax is used multiple times with the same `F/A`, (for examle, `fun foo/2`), there would a wrapper function and fun entry generated for each occurrence. Using the new support in the OTP 23 runtime system, generate a single wrapper function and fun entry for each `F/A`. Since there is only one wrapper function, it can be named based on the name of the function it calls to faciliate debugging, not based on the function that defines the fun. For example, the wrapper function for `fun foo/0` will now be named `-fun.foo/0-'.
2019-06-14compiler: Add common method for literal -> type conversionJohn Högberg
2019-06-13genop.tab: Insert an "OTP 23" comment for clarityBjörn Gustavsson
2019-06-13Merge branch 'john/compiler/common-type-representation/OTP-15792'John Högberg
* john/compiler/common-type-representation/OTP-15792: beam_validator: Replace old type representation with beam_types beam_validator: Subtract types when inferring type test BIFs beam_call_types: Improve type handling of lists:zip/2 and friends compiler: Move "known functions" to beam_types compiler: Break out SSA/beam type definitions into a separate module beam_ssa_type: Fix meet/join inconsistency beam_ssa_type: Fix 'band' type determination beam_validator: Reduce literals to their types beam_validator: Refactor local call validation beam_validator: Simplify the match context type beam_validator: Use integers as tuple element keys
2019-06-13Merge branch 'maint'John Högberg
* maint: Updated OTP version Prepare release # Conflicts: # OTP_VERSION
2019-06-13Merge branch 'maint-22' into maintJohn Högberg
* maint-22: Updated OTP version Prepare release # Conflicts: # make/otp_version_tickets
2019-06-12beam_validator: Replace old type representation with beam_typesJohn Högberg
2019-06-12Merge pull request #2274 from kostis/cerl-fix-ctypeBjörn Gustavsson
cerl: Fix spelling error in a case of ctype()
2019-06-12beam_validator: Subtract types when inferring type test BIFsJohn Högberg
This is a temporary solution for basic type tests. We'll need to handle more-or-less arbitrary values once we introduce union types, as we need to be able to subtract on tuple_arity tests as well. Without this, nearly all "no_opt" test suites will fail to compile after the validator is migrated to 'beam_types' as a result of atom subtraction producing 'none' when all alternatives have been exhausted.
2019-06-12beam_call_types: Improve type handling of lists:zip/2 and friendsJohn Högberg
2019-06-12compiler: Move "known functions" to beam_typesJohn Högberg
2019-06-12compiler: Break out SSA/beam type definitions into a separate moduleJohn Högberg
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-11beam_ssa_type: Fix meet/join inconsistencyJohn Högberg
meet/2 and join/2 were not entirely consistent with each other, and it was possible to meet integers that didn't overlap, producing a nonsense result. None of these can cause issues in the OTP 22 track as far as we can tell, so a patch doesn't feel necessary at this time.
2019-06-11beam_ssa_type: Fix 'band' type determinationJohn Högberg
The use of meet/2 was incorrect as we weren't guaranteed to provide a more specific type. This is unlikely to cause errors in OTP 22 as our ranges were *always* '0 .. X' or 'X .. X', and a meet/2 of two integers would take the least specific minimum value and most specific maximum value, making things work by accident. This is covered by beam_type_SUITE:integers/1, and was made visible when beam_types:meet/2 was fixed to reject integers that didn't overlap fully.
2019-06-11beam_validator: Reduce literals to their typesJohn Högberg
We didn't gain anything by tracking literals exactly, and it greatly complicates sharing types between passes.
2019-06-11beam_validator: Refactor local call validationJohn Högberg
2019-06-11beam_validator: Simplify the match context typeJohn Högberg
There's no need to have an id as part of the type, as the value reference (through which the type is reached) uniquely identifies the match context.
2019-06-11beam_validator: Use integers as tuple element keysJohn Högberg
This simplifies a later migration to a unified type format, as the literal representation may differ between passes, so passing container types keyed by literals will fail.
2019-06-11Merge branch 'maint'John Högberg
* maint: erts: Fix bad loader optimization of get_tuple_element 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-07cerl: Fix spelling error in a case of ctype()Kostis Sagonas
2019-06-03Merge branch 'maint'Hans Bolinder
* maint: Updated OTP version Prepare release # Conflicts: # OTP_VERSION # make/otp_version_tickets_in_merge
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 branch 'maint'Björn Gustavsson
* maint: Eliminate crash in the beam_ssa_dead compiler pass
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 'maint'John Högberg
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 'maint'Björn Gustavsson
* maint: Fix loading of Core Erlang code for extracting a map element Fix unsafe optimizations where guard tests could be removed
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 'john/misc-fixes-and-additions'John Högberg
* john/misc-fixes-and-additions: beam_validator: Fail when trying to set the type of a dead value beam_validator: Fix bad comment formatting/wording erts: Assert that GC should not be disabled twice
2019-05-27Merge branch 'maint'Björn Gustavsson
* maint: Fix compiler crash in beam_except