aboutsummaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)Author
2015-09-28Merge branch 'bjorn/compiler/misc'Björn Gustavsson
* bjorn/compiler/misc: Move select_val optimization from beam_clean to beam_peep beam_type: Improve optimizations by keeping track of booleans beam_type: Improve optimization by keeping track of integers beam_type: Remove unused clause beam_type: Fix forgotten change of internal representation beam_dead: Improve optimization of literal binary matching beam_dead: Optimize select_val instructions Move out bit syntax optimizations from beam_block sys_core_fold: Extend the list of BIFs that return integers v3_codegen: Optimize matching of the final size-less binary segment Regain full coverage of beam_block
2015-09-28Move select_val optimization from beam_clean to beam_peepBjörn Gustavsson
There is an optimization in beam_clean that will remove values having the same label as the failure label in a select_val instruction. Conceptually, this optimization is in the wrong module since ideally beam_clean is a mandatory pass that should not do optimizations. Furthermore, this part of beam_clean is called three times (from beam_dead, beam_peep, and as a compiler pass from the 'compile' module), but it only does useful one of the times it is called. Therefore, move this optimization to the beam_peep pass. The same optimization is done in beam_dead, but unfortunately it misses some opportunities for optimization because the code sharing optimization in beam_jump (share/1) runs after beam_dead. It would be more satisfactory to have this optimization only in beam_dead, but it turned out not to be trivial. If we try to run beam_jump:share/1 before beam_dead, some optimizations will no longer work in beam_dead because fallthroughs have been eliminated. For the moment, the possible solutions to this problem seems to involve more work and more complicated code than the gain from eliminating the duplicated optimization would gain.
2015-09-28beam_type: Improve optimizations by keeping track of booleansBjörn Gustavsson
There is an optimization in beam_block to simplify a select_val on a known boolean value. We can implement this optimization in a cleaner way in beam_type and it will also be applicable in more situations. (When I added the optimization to beam_type without removing the optimization from beam_block, the optimization was applied 66 times.)
2015-09-28beam_type: Improve optimization by keeping track of integersBjörn Gustavsson
The ASN.1 compiler often generates code similar to: f(<<0:1,...>>) -> ...; f(<<1:1,...>>) -> .... Internally that will be rewritten to (conceptually): f(<<B:1,Tail/binary>>) -> case B of 0 -> case Tail of ... end; 1 -> case Tail of ... end; _ -> error(case_clause) end. Since B comes from a bit field of one bit, we know that the only possible values are 0 and 1. Therefore the error clause can be eliminated like this: f(<<B:1,Tail/binary>>) -> case B of 0 -> case Tail of ... end; _ -> case Tail of ... end end. Similarly, we can also a deduce the range for an integer from a 'band' operation with a literal integer. While we are at it, also add a test case to improve the coverage.
2015-09-28beam_type: Remove unused clauseBjörn Gustavsson
The clause cannot possibly match, because there will always be a {bif,...} clause that will match before reaching the fclearerror instruction.
2015-09-28beam_type: Fix forgotten change of internal representationBjörn Gustavsson
30cc5c90 changed the internal representation of catch and try...catch, but beam_type was not updated in one place.
2015-09-28beam_dead: Improve optimization of literal binary matchingBjörn Gustavsson
When the bit syntax is used to match a single binary literal, the bit syntax instructions will be replaced with a comparison to a binary literal. The only problem is that the bs_context_to_binary instruction will not be eliminated. Example: f(<<"string">>) -> ok. This function would be translated to: {function, f, 1, 2}. {label,1}. {line,...}. {func_info,...}. {label,2}. {test,is_eq_exact,{f,3},[{x,0},{literal,<<"string">>}]}. {move,{atom,ok},{x,0}}. return. {label,3}. {bs_context_to_binary,{x,0}}. {jump,{f,1}}. The bs_context_to_binary instruction serves no useful purpose, since {x,0} can never be a match context. Eliminating the instruction, the resulting code will be: {function, f, 1, 2}. {label,1}. {line,...}. {func_info,...}. {label,2}. {test,is_eq_exact,{f,1},[{x,0},{literal,<<"string">>}]}. {move,{atom,ok},{x,0}}. return.
2015-09-28beam_dead: Optimize select_val instructionsBjörn Gustavsson
In a select_val instruction, values associated with a label which is the same as the failure label can be removed. We already do this optimization in beam_clean, but it is better do this sort of optimization before the beam_jump pass. Also rewrite a select_val instruction with a single value to is_eq_exact instruction followed by a jump instruction.
2015-09-28Move out bit syntax optimizations from beam_blockBjörn Gustavsson
In the future we might want to add more bit syntax optimizations, but beam_block is already sufficiently complicated. Therefore, move the bit syntax optimizations out of beam_block into a separate compiler pass called beam_bs.
2015-09-28sys_core_fold: Extend the list of BIFs that return integersBjörn Gustavsson
Knowing that a BIF returns an integer makes it possible to replace '==' with the cheaper '=:=' test.
2015-09-28v3_codegen: Optimize matching of the final size-less binary segmentBjörn Gustavsson
Consider the following function: f(Bin, Bool) -> case Bin of <<Val:16/binary,_/binary>> when Bool -> Val end. Simplified, the generated code looks like: bs_start_match2 Fail Live Bin => Bin bs_get_integer2 Fail Live Bin size=Sz unit=1 => Val bs_skip_bits2 Fail Bin size=all unit=8 is_eq_exact Fail Bool true The code generator will replace the bs_skip_bits2 instruction with a bs_test_unit instruction if it can be clearly seen that the context register will not be used again. In this case, it is not obvious without looking at the code at the Fail label. However, it turns out that bs_test_unit instruction is always safe beacuse of the way v3_kernel compiles pattern matching. It doesn't matter whether the match context will be used again. If it will be used again, the position in it will *not* be used. Instead, a bs_restore2 instruction will restore one of the saved instructions.
2015-09-28Merge branch 'maint'Hans Bolinder
* maint: typer: Fix a bug
2015-09-28typer: Fix a bugHans Bolinder
Instead of outputting a formatted message showing errors found, a core was (often) created.
2015-09-25Merge branch 'maint'Hans Nilsson
* maint: ssh: remove unused filed #ssh.kb_data ssh: new states for keyboard-interactive ssh: new state - service_request
2015-09-25Merge branch 'hans/ssh/auth_review/OTP-12787' into maintHans Nilsson
Before this merge the ssh application was stateless after the key-exchange phase. To prevent the application to act on messages received in the wrong state more states are introduced. They take care of service requests and later authorization. * hans/ssh/auth_review/OTP-12787: ssh: remove unused filed #ssh.kb_data ssh: new states for keyboard-interactive ssh: new state - service_request
2015-09-24ssh: remove unused filed #ssh.kb_dataHans Nilsson
2015-09-23Merge branch 'maint'Ingela Anderton Andin
2015-09-23ssl: Retry ssl connections on econnreset errorsIngela Anderton Andin
To avoid test case failure due to test case setup timing issues. Suspected problem is that the listen queue builds up to quickly in client_unique_session test when running on slow computers.
2015-09-23ssh: new states for keyboard-interactiveHans Nilsson
2015-09-23ssh: new state - service_requestHans Nilsson
2015-09-23Merge tag 'OTP-18.1'Henrik Nord
=== OTP-18.1 === Changed Applications: - compiler-6.0.1 - crypto-3.6.1 - debugger-4.1.1 - dialyzer-2.8.1 - diameter-1.11 - erts-7.1 - eunit-2.2.11 - hipe-3.13 - inets-6.0.1 - kernel-4.1 - mnesia-4.13.1 - odbc-2.11.1 - public_key-1.0.1 - sasl-2.6 - ssh-4.1 - ssl-7.1 - stdlib-2.6 - tools-2.8.1 - wx-1.5 Unchanged Applications: - asn1-4.0 - common_test-1.11 - cosEvent-2.2 - cosEventDomain-1.2 - cosFileTransfer-1.2 - cosNotification-1.2 - cosProperty-1.2 - cosTime-1.2 - cosTransactions-1.3 - edoc-0.7.17 - eldap-1.2 - erl_docgen-0.4 - erl_interface-3.8 - et-1.5.1 - gs-1.6 - ic-4.4 - jinterface-1.6 - megaco-3.18 - observer-2.1 - orber-3.8 - os_mon-2.4 - ose-1.1 - otp_mibs-1.1 - parsetools-2.1 - percept-0.8.11 - reltool-0.7 - runtime_tools-1.9.1 - snmp-5.2 - syntax_tools-1.7 - test_server-3.9 - typer-0.9.9 - webtool-0.9 - xmerl-1.3.8 Conflicts: OTP_VERSION erts/vsn.mk
2015-09-21Prepare releaseErlang/OTP
2015-09-21Merge branch 'maint'Anders Svensson
2015-09-21Merge branch 'anders/diameter/18.1/OTP-12978' into maintAnders Svensson
* anders/diameter/18.1/OTP-12978: Remove 1.11 release notes
2015-09-21Merge branch 'maint'Anders Svensson
2015-09-21Merge branch 'ia/ssl/cuddle' into maintIngela Anderton Andin
* ia/ssl/cuddle: ssl: listen socket should be set to active false
2015-09-21ssl: listen socket should be set to active falseIngela Anderton Andin
2015-09-21Regain full coverage of beam_blockBjörn Gustavsson
d0784035ab fixed a problem with register corruption. Because of that, opt_moves/2 will never be asked to optimize instructions with more than two destination registers. Therefore, to regain full coverage of beam_block, remove the final clause in opt_moves/2.
2015-09-21Merge branch 'maint'Björn Gustavsson
* maint: Update sasl vsn to 2.6
2015-09-21Merge branch 'siri/sasl-vsn-OTP-18.1' into maintBjörn Gustavsson
* siri/sasl-vsn-OTP-18.1: Update sasl vsn to 2.6
2015-09-21Merge branch 'bjorn/compiler/remove-deprecated/OTP-12979'Björn Gustavsson
* bjorn/compiler/remove-deprecated/OTP-12979: core_lib: Remove previously deprecated functions
2015-09-21Merge branch 'maint'Hans Bolinder
* maint: Update application versions
2015-09-21Merge branch 'hb/app_vsn' into maintHans Bolinder
* hb/app_vsn: Update application versions
2015-09-20Merge branch 'maint'Ingela Anderton Andin
2015-09-18ssl: Correct soft upgrade testIngela Anderton Andin
Soft upgrade test did not work as expected due to that the upgrade frame work keeps the control of the test case process to itself, so we need a proxy process to receive messages from ssl test framework.
2015-09-18Update application versionsHans Bolinder
2015-09-18Merge branch 'maint'Ingela Anderton Andin
2015-09-18Merge branch 'ia/inets/next/version' into maintIngela Anderton Andin
* ia/inets/next/version: inets: Prepare for release
2015-09-18Merge branch 'ia/ssl/cuddle_tests' into maintIngela Anderton Andin
* ia/ssl/cuddle_tests: ssl: Timeout tuning
2015-09-18Merge branch 'maint'Dan Gudmundsson
* maint: stdlib: Fix leaking files after error_logger:logfile(close)
2015-09-18Merge branch 'dgud/stdlib/fix-file-error_log-leak' into maintDan Gudmundsson
* dgud/stdlib/fix-file-error_log-leak: stdlib: Fix leaking files after error_logger:logfile(close)
2015-09-17ssl: Timeout tuningIngela Anderton Andin
2015-09-17Remove 1.11 release notesAnders Svensson
These were added manually in merge commit 8c5d719a, but that was wrong: the notes will be generated. Note that OTP-12791 in the comment for commit 5a339bcb is wrong: it's OTP-12891.
2015-09-17Merge branch 'maint'Henrik Nord
2015-09-17Update sasl vsn to 2.6Siri Hansen
2015-09-17inets: Prepare for releaseIngela Anderton Andin
2015-09-17stdlib: Fix leaking files after error_logger:logfile(close)Dan Gudmundsson
Introduced when changing state from tuple to record.
2015-09-17Merge branch 'leoliu/export-catch_exception' into maintHenrik Nord
* leoliu/export-catch_exception: Export shell:catch_exception/1 as documented
2015-09-17Merge branch 'maint'Hans Bolinder
* maint: stdlib: Update application version
2015-09-17stdlib: Update application versionHans Bolinder