aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2018-09-17beam_ssa_type: Substitute variables that evaluate to a constantBjörn Gustavsson
In beam_ssa_type, do substitutions similar to what ssa_opt_misc does to get rid of variables that evaluate to constant values. That somewhat simplifies the code of beam_ssa_type, and could improve performance of the compiler since instructions and variables are eliminated, reducing the amount of work for later passes.
2018-09-17beam_ssa_type: Infer types for more instructions and BIFsBjörn Gustavsson
2018-09-17beam_ssa_type: Remove clause in arith_op_types/2 that can't matchBjörn Gustavsson
Remove the following clause from the `fun` clauses in arith_op_types/2 because it cannot possibly match: (_, any) -> number; Here is why it cannot match: The second argument is the accumulator for lists:foldl/3. Its initial value is `unknown`. None of the clauses will update the accumulator to `any`, including the clause that matches `any` in the first argument -- it will set the accumulator to `number`. Thus, the accumulator (second argument) can never be `any` and the clause can never match. QED.
2018-09-17beam_ssa_opt: Robustify float optimizationsBjörn Gustavsson
The floating point optimization relies on heavily on the block order in the lineararized representation. A new optimization could easily break the optimization, for example so that no `fcheckerror` instructions were emitted. Rewrite the optimization to avoid dependencies on the linear block order.
2018-09-12beam_ssa_opt: Don't do CSE for tuple_size/1Björn Gustavsson
Not doing CSE for tuple_size/1 seems to generate slightly better code in most cases.
2018-09-12beam_ssa_opt: Slightly optimize compile-time performance of CSEBjörn Gustavsson
2018-09-12beam_ssa_opt: Slightly optimize performance of live optimizationBjörn Gustavsson
Phi nodes with only literals are fairly common, so it's worthwhile to optimize this case.
2018-09-12beam_ssa_opt: Add an optimization of tuple_size/1Björn Gustavsson
This optimization working on the SSA format will replace the similar optimization in beam_dead. See the comment for an explanation of what the new optimization does.
2018-09-12beam_ssa_opt: Add simplification of switch listsBjörn Gustavsson
When the argument for a #b_switch{} comes from a phi node with only literal values, the switch list could be pruned to only contain the possible values. It could also be possible to eliminate the failure label. Also simplify a switch with a single value list or switch that can be replaced with an is_boolean test.
2018-09-12beam_ssa_opt: Add a pass for coalescing phi nodesBjörn Gustavsson
Nested cases can led to code such as this: 10: _1 = phi {literal value1, label 8}, {Var, label 9} br 11 11: _2 = phi {_1, label 10}, {literal false, label 3} The phi nodes can be coalesced like this: 11: _2 = phi {literal value1, label 8}, {Var, label 9}, {literal false, label 3} Coalescing can help other optimizations, and can in some cases reduce register shuffling (if the phi variables for two phi nodes happens to be allocated to different registers).
2018-09-12beam_ssa_opt: Fix liveness optimizationBjörn Gustavsson
Add more instructions to the list of functions that can be safely removed if their values are not used. This is necessary for correctness when doing more aggressive optimizations. Without this change, the 'succeeded' instruction could be optimized away leaving just the instruction followed by an unconditional branch, which the beam_ssa_codegen does not know how to handle. Here is an example: _3 = bs_start_match _1 br label 13 By adding bs_start_match to the list, the bs_start_match instruction will be removed too. (If the result of bs_start_match is actually used, the succeeded instruction would not be removed.) While we are it, rename the misnamed function is_pure/1 to no_side_effect/1 and move it to beam_ssa. is_pure/1 is a bad name because bif:get has no side effect, but is not pure.
2018-09-12beam_peep: Add is_boolean optimization of select_valBjörn Gustavsson
A select_val instruction that test whether a register is a boolean like this: {select_val,Reg,{f,Fail},{list,[{atom,true},Lbl,{atom,false},Lbl]}}. can be replaced with an is_boolean test: {test,is_boolean,{f,Fail},[Reg]}. {jump,{f,Lbl}}. This optimization is currently done in beam_dead. However, if done in the beam_peep, it can catch more opportunities to do the optimization, because after having run beam_jump, labels that were different have been coalesced.
2018-09-12Fix unsafe optimization in beam_deadBjörn Gustavsson
Those optimizations are unsafe if beam_dead has been run before.
2018-09-12Introduce the beam_jump:instr_labels/1 functionBjörn Gustavsson
This functionality will soon be needed.
2018-09-12Move two optimizations from beam_dead to beam_aBjörn Gustavsson
The 'move' instruction can be eliminated in code such as: {test,is_eq_exact,{f,42},[{x,0},{atom,value}]}. {move,{atom,value},{x,0}}. Move that optimization from beam_dead to beam_a. The optimization will be simpler because the 'move' instruction has not yet been moved into a block. Getting rid of 'move' earlier will also save work for later passes. Also move the optimization that eliminates instructions such as from beam_dead to beam_a: {test_is_eq_exact,{f,42},[{x,0},{x,0}]}.
2018-09-12beam_ssa: Optimize linearize/1 and rpo/2Björn Gustavsson
It is faster to use cerl_sets instead of gb_sets to keep track of seen blocks.
2018-09-12beam_ssa: Add trim_unreachable/1Björn Gustavsson
Add trim_unreachable/1 to remove unreachable blocks and adjust phi nodes.
2018-09-12beam_ssa: Extend linearize/1 to also adjust phi nodesBjörn Gustavsson
Since beam_ssa:linearize/1 may remove blocks that are unreachable, adjust phi nodes to make sure that they don't refer to discarded blocks or to blocks that no longer branch to the phi node in question.
2018-09-12Use beam_ssa:normalize/1 in beam_ssa_typeBjörn Gustavsson
2018-09-12Optimize 'and' and 'or' instructionsBjörn Gustavsson
2018-09-12beam_ssa: Add normalize/1Björn Gustavsson
Add normalize/1 to simplify optimizations.
2018-09-12beam_validator: Infer more typesBjörn Gustavsson
When optimizations get more powerful, beam_validator must keep up.
2018-09-12beam_validator: Validate the literals in select_valBjörn Gustavsson
2018-09-12beam_validator: Handle types for unary '-' or '+'Björn Gustavsson
2018-09-12beam_ssa_pre_codegen: Fix bug in receive fixingBjörn Gustavsson
When creating a phi node for the common exit block of a receive, the code failed to take into account that there could be more than one predecessor to the exit block for each remove_message. Rename exit_predessor/3 to exit_predessors/3 and make it return a list of the predecessors.
2018-09-12beam_ssa_type: Remove repeated clauses in meet/2Björn Gustavsson
2018-09-12Merge branch 'maint'Hans Bolinder
* maint: syntax_tools: Correct unfolding of the stacktrace variable
2018-09-12Merge branch 'hasse/syntax_tools/fix_stacktrace_var/OTP-15291/ERL-719' into ↵Hans Bolinder
maint * hasse/syntax_tools/fix_stacktrace_var/OTP-15291/ERL-719: syntax_tools: Correct unfolding of the stacktrace variable
2018-09-12Merge branch 'peterdmv/ssl/property_test_client_hello'Péter Dimitrov
* peterdmv/ssl/property_test_client_hello: ssl: Property test hello extensions Change-Id: I78f5cdef8702141b78e9123efe34e381a5e5d12c
2018-09-12Merge branch 'maint'Ingela Anderton Andin
2018-09-12Merge branch ↵Ingela Anderton Andin
'ingela/ssl/unorded-or-incomplete-cert-chain/OTP-12983/OTP-15060' into maint * ingela/ssl/unorded-or-incomplete-cert-chain/OTP-12983/OTP-15060: ssl: Handle incomplete and unorded chains
2018-09-12ssl: Handle incomplete and unorded chainsIngela Anderton Andin
If the peer sends an incomplete chain that we can reconstruct with our known CA-certs it will be accepted. We will assume that the peer honors the protocol and sends an orded chain, however if validation fails we will try to order the chain in case it was unorded. Will also handle that extraneous cert where present. See Note form RFC 8446 Note: Prior to TLS 1.3, "certificate_list" ordering required each certificate to certify the one immediately preceding it; however, some implementations allowed some flexibility. Servers sometimes send both a current and deprecated intermediate for transitional purposes, and others are simply configured incorrectly, but these cases can nonetheless be validated properly. For maximum compatibility, all implementations SHOULD be prepared to handle potentially extraneous certificates and arbitrary orderings from any TLS version, with the exception of the end-entity certificate which MUST be first.
2018-09-12Merge branch 'maint'Hans Nilsson
* maint: crypto: Fix valgrind error
2018-09-12Merge branch 'hans/crypto/valgrind' into maintHans Nilsson
* hans/crypto/valgrind: crypto: Fix valgrind error
2018-09-12crypto: Fix valgrind errorHans Nilsson
2018-09-12Merge branch 'maint'Anders Svensson
2018-09-12Merge branch 'anders/diameter/21.1/OTP-15202' into maintAnders Svensson
* anders/diameter/21.1/OTP-15202: vsn -> 2.1.6 Update appup for 21.1
2018-09-12Merge branch 'anders/diameter/dpr/OTP-15198' into maintAnders Svensson
* anders/diameter/dpr/OTP-15198: Fix function_clause when sending a request after an outgoing DPA
2018-09-11Merge branch 'sverker/enif-cancel-select/OTP-15095'Sverker Eriksson
* sverker/enif-cancel-select/OTP-15095: erts: Add ERL_NIF_SELECT_CANCEL flag for enif_select
2018-09-11ssl: Property test hello extensionsPéter Dimitrov
Extend test generators with ClientHello extensions: - TLS 1.2: supported_version - TLs 1.3: supported_version and signature_scheme_list Change-Id: I43356a2a921edade124eceb004f20411c7e92619
2018-09-11Merge branch 'peterdmv/ssl/tls13_ciphers'Péter Dimitrov
* peterdmv/ssl/tls13_ciphers: ssl: Fix cipher suite handling ssl: Add TLS 1.3 cipher suites Change-Id: I6b306d29642ba38639157ed1afea8b8df38af30e
2018-09-11Merge branch 'maint'Hans Nilsson
* maint: crypto: Remove 'experimental' comments for ecdh
2018-09-11Merge branch 'hans/crypto/x25519_x448/OTP-15240' into maintHans Nilsson
* hans/crypto/x25519_x448/OTP-15240: crypto: Remove 'experimental' comments for ecdh
2018-09-11Merge branch 'maint'Ingela Anderton Andin
2018-09-11Merge branch 'ingela/ssl/psk-correction/OTP-15285' into maintIngela Anderton Andin
* ingela/ssl/psk-correction/OTP-15285: ssl: Correct handling of all PSK cipher suites
2018-09-11ssl: Correct handling of all PSK cipher suitesIngela Anderton Andin
Before only some PSK suites would be correctly negotiated and most PSK ciphers suites would fail the connection. PSK cipher suites are anonymous in the sense that they do not use certificates except for rsa_psk.
2018-09-10Merge branch 'maint'Dan Gudmundsson
* maint: erlang-mode: fix void variable align-rules-list error
2018-09-10Merge pull request #1942 from velimir0xff/fix-erlang-mode-alignDan Gudmundsson
erlang-mode: fix void variable align-rules-list error
2018-09-10crypto: Remove 'experimental' comments for ecdhHans Nilsson
2018-09-10syntax_tools: Correct unfolding of the stacktrace variableHans Bolinder
The bug was introduced in 9ab233. See also https://bugs.erlang.org/browse/ERL-719.