'tbnz/tbz' instruction can be used to check whether a given W or X
register value is negative or positive.
For example,
```
tst x0, x0
blt >1
```
can be optimized as `tbnz x0, #63, >1`
It's important to note that the jump range of 'tbnz/tbz' is limited, and
it's better NOT to use 'tbnz/tbz' if the target of 'b.cond' is a label
in section .cold_code or a global label, such as the instruction
sequence `tst RETVALw, RETVALw; blt ->trace_halt` at function
zend_jit_trace_exit_stub(), and the instruction sequence `tst REG0,
REG0; blt >7` at function zend_jit_incdec_obj().
Minor updates:
Use macros BW_OP_32_WITH_CONST and GC_ADDREF at function
zend_jit_push_call_frame().
Change-Id: I1597609bdabf55ea2f9d24528e7a037bc3e5c3a1
Opcache JIT
This is the implementation of Opcache's JIT (Just-In-Time compiler), This converts the PHP Virtual Machine's opcodes into x64/x86 assembly, on POSIX platforms and Windows.
It generates native code directly from PHP byte-code and information collected by the SSA static analysis framework (a part of the opcache optimizer). Code is usually generated separately for each PHP byte-code instruction. Only a few combinations are considered together (e.g. compare + conditional jump).
See the JIT RFC for more details.
DynAsm
This uses DynAsm (developed for LuaJIT project) for the generation of native code. It's a very lightweight and advanced tool, but does assume good, and very low-level development knowledge of target assembler languages. In the past we tried LLVM, but its code generation speed was almost 100 times slower, making it prohibitively expensive to use.
The unofficial DynASM Documentation has a tutorial, reference, and instruction listing.
zend_jit_x86.dasc gets automatically converted to zend_jit_x86.c by the bundled
dynasm during make.