Age | Commit message (Collapse) | Author |
|
v3_codegen is replaced by three new passes:
* beam_kernel_to_ssa which translates the Kernel Erlang format
to a new SSA-based intermediate format.
* beam_ssa_pre_codegen which prepares the SSA-based format
for code generation, including register allocation. Registers
are allocated using the linear scan algorithm.
* beam_ssa_codegen which generates BEAM assembly code from the
SSA-based format.
It easier and more effective to optimize the SSA-based format before X
and Y registers have been assigned. The current optimization passes
constantly have to make sure no "holes" in the X register assignments
are created (that is, that no X register becomes undefined that an
allocation instruction depends on).
This commit also introduces the following optimizations:
* Replacing of tuple matching of records with the is_tagged_tuple
instruction. (Replacing beam_record.)
* Sinking of get_tuple_element instructions to just before the first
use of the extracted values. As well as potentially avoiding
extracting tuple elements when they are not actually used on all
executions paths, this optimization could also reduce the number
values that will need to be stored in Y registers. (Similar to
beam_reorder, but more effective.)
* Live optimizations, removing the definition of a variable that is
not subsequently used (provided that the operation has no side
effects), as well strength reduction of binary matching by replacing
the extraction of value from a binary with a skip instruction. (Used
to be done by beam_block, beam_utils, and v3_codegen.)
* Removal of redundant bs_restore2 instructions. (Formerly done
by beam_bs.)
* Type-based optimizations across branches. More effective than
the old beam_type pass that only did type-based optimizations in
basic blocks.
* Optimization of floating point instructions. (Formerly done
by beam_type.)
* Optimization of receive statements to introduce recv_mark and
recv_set instructions. More effective with far fewer restrictions
on what instructions are allowed between creating the reference
and entering the receive statement.
* Common subexpression elimination. (Formerly done by beam_block.)
|
|
If one of the destination registers for get_map_elements is
the same as the map source, extract that element last.
|
|
This optimization can be better done in the SSA format before
code generation.
|
|
The removal of redundant bs_restore2 instructions is done easier
on the SSA format. Keep the rest of the optimizations, because
they are easier to do on the BEAM instructions.
|
|
As a preparation for replacing v3_codegen with a new code generator,
remove unsafe optimization passes. Especially the older compiler
passes have implicit assumptions about how the code is generated.
Remove the optimizations in beam_block (keep the code that creates
blocks) because they are unsafe. beam_block also calls
beam_utils:live_opt/1, which is unsafe.
Remove beam_type because it calls beam_utils:live_opt/1, and also
because it recalculates the number of heaps words and number of live
registers in allocation instructions, thus potentially hiding bugs in
other passes.
Remove beam_receive because it is unsafe.
Remove beam_record because it is the only remaining user
of beam_utils:anno_defs/1.
Remove beam_reorder because it makes much more sense to run it
as an early SSA-based optimization pass.
Remove the now unused functions in beam_utils:
anno_def/1
delete_annos/1
is_killed_block/2
live_opt/1
usage/3
Note that the following test cases will fail because of the
removed optimizations:
compile_SUITE:optimized_guards/1
compile_SUITE:bc_options/1
receive_SUITE:ref_opt/1
|
|
|
|
This will enable more optimizations.
|
|
Don't match exact BEAM instructions when trying to recognize
function_clause exceptions that should be replaced with a jump to the
func_info instruction. Instead, do a symbolic evaluation of the list
building code and see if the result is a list of the argument
registers.
While at it, also teach fix_block_1/2 to completely remove a test_heap
instruction before an exception generation instruction.
|
|
Smarter code generation means that beam_validator must
be smarter too. In the following example, beam_validator
must be able to infer that y0 refers to a map:
move x0 y0
test is_map L1 x0
%% Here the type for y0 must be 'map'.
|
|
|
|
The func_info instruction does not expect a stack frame. There will
be an assertion failure in the debug-compiled runtime system.
|
|
|
|
If we transfer state appropriately to labels that can't be reached,
the state could taint other labels.
|
|
Since the compiler will start optimizing more aggressively, beam_validator
must keep up and improve the recognization of tuples and maps.
|
|
The new code generator will more aggressively reuse registers,
so we must be more careful about updating the state for try/catch.
In particular, an "empty" try/catch that can't throw an
exception must not update the try/catch state.
|
|
|
|
Nicer to read and less confusion.
|
|
The new code generator will use Y registers as a destination for
binary construction and matching instructions. v3_codegen would
always first store terms in an X register and it would be the
responsibility of the optimization passes to optimize the extra
moves.
|
|
* maint:
crypto: Fail tests if crypto cannot start
|
|
* hans/crypto/cuddle_tests:
crypto: Fail tests if crypto cannot start
|
|
* maint:
ssh: prolong the timeout in ssh_dbg gen_server calls
|
|
|
|
* upstream/maint:
Require align
Add Erlang alignment regexps
|
|
OTP-15239
|
|
Optimize binary match from 10% up to 70x
|
|
|
|
fix double parenthesis and badly formatter <v> tags
|
|
marianoguerra/fix-emd2exml-encoding-value-gen-maint
fix generated encoding for xml files generated with emd2exml
|
|
(cherry picked from commit 1b36c8ff81e896f9aa172603962f838d980668a0)
|
|
DTRACE.xml and SYSTEMTRAP.xml set encoding to utf8 instead of utf-8
and make xmerl_scan:file/1,2 fail parsing them
(cherry picked from commit faded6e1cdceb049d2d9bc995b6c981d58709315)
|
|
|
|
|
|
* maint:
Fix compiler crash when compiling double receives
erts: Delete fd from poll-set when closing fd_driver port
|
|
bjorng/bjorn/compiler/double-receives/ERL-703/OTP-15235
Fix compiler crash when compiling double receives
|
|
into maint
erts: Delete fd from poll-set when closing fd_driver port
|
|
|
|
* maint-20:
inets: Remove 21 test case
Updated OTP version
Update release notes
Conflicts:
OTP_VERSION
lib/inets/doc/src/notes.xml
lib/inets/test/httpd_SUITE.erl
lib/inets/vsn.mk
otp_versions.table
|
|
A test case unrelated to the patch was accidentally added
when backporting the solution.
|
|
|
|
* lukas/travis/deploy:
travis: Make bundle version select regexp stricter
|
|
|
|
|
|
* ingela/inets/status-501/ERIERL-218/OTP-15215:
inets: Use status code 501 when no mod_* handles the request
|
|
|
|
* lukas/travis/deploy:
travis: Filter out release candidates from bundle tags
|
|
|
|
Add logger:set_application_level/2
|
|
remove_message does not store any pointer to x0
|
|
|
|
|