Age | Commit message (Collapse) | Author |
|
Sequences of three move instructionst that effectively swap the
contents of two registers are fairly common. We can replace them
with a swap_temp/3 instruction. The third operand is the temporary
register to be used for swapping, since the temporary register
may actually be used.
If swap_temp/3 instruction is followed by a call, the temporary
register will often (but not always) be killed by the call. If
it is killed, we can replace the swap_temp/3 instruction with a
slightly cheaper swap/2 instruction.
|
|
Currently, move2/2 does the two moves sequentially to ensure
that the instruction will always work correctly.
We can do better than that. If the two move instructions have
any registers in common, we can introduce simpler and slightly
more efficient instructions to handle those cases:
move_shift/3
move_dup/3
For the remaining cases when the the move instructions
have no common registers, the move2/4 instruction can perform
the moves in parallel which is probably slightly more efficient.
For clarity's sake, we will remain the instruction to move2_par/4.
|
|
|
|
The 'cmd' variable that were shared by several hipe_mode_switch
instructions would cause clang to produce sub-optimal code,
probably because it considered the instructions as part of of
loop that needed to be optimized.
What would was that 'cmd' would be assigned to the ESI register
(lower 32 bits of the RSI register). It would use ESI for other
purposes in instructions, but at the end of every instruction
it would set ESI to 1 just in case the next instruction happened
to be hipe_trap_return. This can be seen clearly if this commit
is omitted and the define HIPE_MODE_SWITCH_CMD_RETURN in
hipe/hipe_mode_switch.h is changed from 1 to some other number
such as 42. You will see that 42 is assigned to ESI at the end
of every instruction.
Eliminate this problem by elimininating the shared 'cmd' variable.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The i_fetch instruction fetches two operands and places them
in the tmp_arg1 and tmp_arg2 variables. The next instruction
(such as i_plus) does not have to handle different types of
operands, but can get get them simply from the tmp_arg*
variables. Thus, i_fetch was introduced as a way to temper
a potentail combinatorial explosion.
Unfortunately, clang will generate terrible code because of
the tmp_arg1 and tmp_arg2 variables being live across multiple
instructions. Note that Clang has no way to predict the control
flow from one instruction to another. Clang must assume that
any instruction can jump to any other instruction. Somehow GCC
manages to cope with this situation much better.
Therefore, to improve the quality of the code generated by clang, we
must eliminate all uses of the tmp_arg1 and tmp_arg2 variables. This
commit eliminates the use of i_fetch in combination with the
arithmetic and logical instructions.
While we are touching the code for the bsr and bsl instructions,
also move the tmp_big[] array from top scope of process main into
the block that encloses the bsr and bsl instructions.
|
|
The 'r' type is now mandatory. That means in order to handle
both of the following instructions:
move x(0) y(7)
move x(1) y(7)
we would need to define two specific operations in ops.tab:
move r y
move x y
We want to make 'r' operands optional. That is, if we have
only this specific instruction:
move x y
it will match both of the following instructions:
move x(0) y(7)
move x(1) y(7)
Make 'r' optional allows us to save code space when we don't
want to make handling of x(0) a special case, but we can still
use 'r' to optimize commonly used instructions.
|
|
Consider the try_case_end instruction:
try_case_end s
The 's' operand type means that the operand can either be a
literal of one of the types atom, integer, or empty list, or
a register. That worked well before R12. In R12 additional
types of literals where introduced. Because of way the
overloading was done, an 's' operand cannot handle the
new types of literals. Therefore, code such as the following
is necessary in ops.tab to avoid giving an 's' operand a
literal:
try_case_end Literal=q => move Literal x | try_case_end x
While this work, it is error-prone in that it is easy to
forget to add that kind of rule. It would also be complicated
in case we wanted to introduce a new kind of addition operator
such as:
i_plus jssd
Since there are two 's' operands, two scratch registers and
two 'move' instructions would be needed.
Therefore, we'll need to find a smarter way to find tag
register operands. We will overload the pid and port tags
for X and Y register, respectively. That works because pids
and port are immediate values (fit in one word), and there
are no literals for pids and ports.
|
|
|
|
As part of improving code generation for clang, we want to
eliminate the special variable that stores the content of X
register zero most of the time. In a future, that will allow us
to eliminate the special case of handling r(0) for most
instructions, thus reducing the code size and allow other
simplifcations.
Therefore, in this commit, eliminate the variable that is used
to store r(0) and make r(0) as synonym for x(0). I have chosen
to keep the r(0) define to keep the size of the diff managable.
|
|
The purpose of this series of commits is to improve code generation
for the Clang compiler.
As a first step we want to change the meaning of 'x' in a
transformation such as:
operation Literal=q => move Literal x | operation x
Currently, a plain 'x' means reg[0] or x(0), which is the first
element in the X register array. That element is distinct from
r(0) which is a variable in process_main(). Therefore, since r(0)
and x(0) are currently distinct it is fine to use x(0) as a
scratch register.
However, in the next commit we will eliminate the separate variable
for storing the contents of X register zero (thus, x(0) and r(0)
will point to the same location in the X register array). Therefore,
we must use another scratch register in transformation. Redefine
a plain 'x' in a transformation to mean x(1023). Also define
SCRATCH_X_REG so that we can refer to the register by name from
C code.
|
|
|
|
* maint:
Add a smoke test of erts_debug:df/1
Correct disassembly of the i_get_map_elements instruction
|
|
The emulator would crash.
|
|
|
|
* egil/remove-halfword/OTP-12883: (21 commits)
erts: Remove halfword etp-commands
erts: Remove halfword MemKind mseg
erts: Remove halfword bases in ETS
erts: Remove halfword CHECK_POINTER_MASK
erts: Remove halfword relative printf
erts: Remove halfword valgrind suppress file
erts: Remove halfword specific tests
erts: Remove halfword specific allocator types
erts: Remove halfword BINARY RELs
erts: Remove halfword is_same bases macro
erts: Reinstate copy_object over-allocation optimization
erts: Remove halfword copy_object_rel
erts: Remove halfword object manipulation
erts: Remove halfword heap relative comparisions
erts: Remove halfword pointer compression
erts: Remove halfword basic relative heap operations
erts: Remove halfword from configure
erts: Remove halfword in lib_src
erts: Remove halfword in erl_nif.h
erts: Remove halfword in erl_driver.h
...
|
|
causing the delete marked object to be left in the table
after safe_fixtable(_,false) has returned.
This is not super serious as the delete marked object
is quite benign and will be deleted at the next unfix operation.
|
|
|
|
|
|
|
|
|
|
* ERTS_GET_BINARY_BYTES_REL
* ERTS_GET_REAL_BIN_REL
|
|
Keep is_same macro for readability but remove base pointers.
|
|
|
|
Near duplication of copy_object but with base ptr that is no longer used.
|
|
* Remove macros size_object_rel, copy_struct_rel and copy_shallow_rel
|
|
* Removed cmp_rel, cmp_rel_term and eq_rel
|
|
* Removed COMPRESS_POINTER and EXPAND_POINTER
|
|
|
|
|
|
|
|
|
|
|
|
OTP-12845
* bruce/change-license:
fix errors caused by changed line numbers
Change license text to APLv2
|
|
Init esdp->timer_wheel as NULL to please setup_aux_work_timer().
|
|
|
|
* egil/fix-erts_debug-disasm-select_tuple_arity:
erts: Fix erts_debug:df/1 in debug
|
|
* egil/license-compliance/OTP-12848:
Revert "lcnt: Let runq locks reflect actual call location"
Revert "Demote rare debug slogan of message discarding to debug build"
Revert "Add missing error string to syslog logging in epmd"
Revert "Add run queue index to process dump info"
Revert "Add thread index to allocator enomem dump slogan"
Revert "Add number of entries to mnesia copy debug message"
|
|
* rickard/io-bytes/OTP-12842:
Save IO bytes in scheduler specific data
|
|
* egil/lcnt-refactor/OTP-12846:
erts: Refactor LCNT
|
|
Sentinels in select_tuple_arity instructions are not proper
tuple arities and thus cannot be checked in debug.
Print them as small integers instead.
|
|
|
|
This reverts commit efefd4bfda3156c6c19a61d7aa3d2f50a026d0e5.
Conflicts:
erts/emulator/beam/erl_process.h
|
|
This reverts commit 38bd20f4f58e8025bd3ffc718cb7e40a4bde6396.
|
|
This reverts commit 345af4a0c8d68b9369c3556fa6d911854c123d3f.
|