Age | Commit message (Collapse) | Author |
|
|
|
* 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
|
|
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.
|
|
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.)
|
|
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.
|
|
The clause cannot possibly match, because there will always be
a {bif,...} clause that will match before reaching the fclearerror
instruction.
|
|
30cc5c90 changed the internal representation of catch and
try...catch, but beam_type was not updated in one place.
|
|
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.
|
|
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.
|
|
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.
|
|
Knowing that a BIF returns an integer makes it possible to
replace '==' with the cheaper '=:=' test.
|
|
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.
|
|
* maint:
typer: Fix a bug
|
|
* hb/typer/fix_bug/OTP-13010:
typer: Fix a bug
|
|
Instead of outputting a formatted message showing errors found, a core
was (often) created.
|
|
* maint:
ssh: remove unused filed #ssh.kb_data
ssh: new states for keyboard-interactive
ssh: new state - service_request
|
|
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
|
|
|
|
|
|
* ia/ssl/econnreset-test-cuddle:
ssl: Retry ssl connections on econnreset errors
|
|
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.
|
|
|
|
|
|
=== 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
|
|
* hb/fix_otp_SUITE:
Adjust test case for missing applications
|
|
|
|
|
|
|
|
|
|
* anders/diameter/18.1/OTP-12978:
Remove 1.11 release notes
|
|
|
|
* ia/ssl/cuddle:
ssl: listen socket should be set to active false
|
|
|
|
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.
|
|
* maint:
Update sasl vsn to 2.6
|
|
* siri/sasl-vsn-OTP-18.1:
Update sasl vsn to 2.6
|
|
|
|
* bjorn/compiler/remove-deprecated/OTP-12979:
core_lib: Remove previously deprecated functions
|
|
* maint:
Update application versions
|
|
* hb/app_vsn:
Update application versions
|
|
|
|
* ia/ssl/soft-upgrade:
ssl: Correct soft upgrade test
|
|
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.
|
|
|
|
|
|
* ia/inets/next/version:
inets: Prepare for release
|
|
* ia/ssl/cuddle_tests:
ssl: Timeout tuning
|
|
* maint:
stdlib: Fix leaking files after error_logger:logfile(close)
|
|
* dgud/stdlib/fix-file-error_log-leak:
stdlib: Fix leaking files after error_logger:logfile(close)
|
|
|