History log of /php-src/ext/opcache/jit/zend_jit.c (Results 126 – 150 of 327)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
Revision tags: php-8.1.0beta1
# 0ce1cd13 19-Jul-2021 Christoph M. Becker

Merge branch 'PHP-8.0'

* PHP-8.0:
Fix #81206: Multiple PHP processes crash with JIT enabled


# ef77d3c8 17-Jul-2021 Christoph M. Becker

Fix #81206: Multiple PHP processes crash with JIT enabled

We need to avoid resetting the JIT for all SAPIs, but we need to
initialize the JIT handlers even when only reattaching on Windo

Fix #81206: Multiple PHP processes crash with JIT enabled

We need to avoid resetting the JIT for all SAPIs, but we need to
initialize the JIT handlers even when only reattaching on Windows.

Closes GH-7208.

show more ...

Revision tags: php-7.4.22RC1, php-8.0.9RC1, php-8.1.0alpha3, php-7.4.21, php-7.3.29, php-8.0.8, php-8.1.0alpha2, php-7.4.21RC1, php-8.0.8RC1, php-8.1.0alpha1, php-8.0.7, php-7.4.20
# d0b09a7b 20-May-2021 Joe Watkins

Add first-class callables

Support acquiring a Closure to a callable using the syntax
func(...), $obj->method(...), etc. This is essentially a
shortcut for Closure::fromCallable().

Add first-class callables

Support acquiring a Closure to a callable using the syntax
func(...), $obj->method(...), etc. This is essentially a
shortcut for Closure::fromCallable().

RFC: https://wiki.php.net/rfc/first_class_callable_syntax

Closes GH-7019.

Co-Authored-By: Nikita Popov <nikita.ppv@gmail.com>

show more ...

# d550c848 13-Jul-2021 Nikita Popov

Fix unbalanced NEW call_level in JIT

For NEW followed by DO_FCALL, we handle both together and skip
over the DO_FCALL, which means that the call_level for it will
not be decremented.

Fix unbalanced NEW call_level in JIT

For NEW followed by DO_FCALL, we handle both together and skip
over the DO_FCALL, which means that the call_level for it will
not be decremented. Do so explicitly instead.

show more ...

# aff36587 29-Jun-2021 Patrick Allaert

Fixed some spaces used instead of tabs

# 0e932f7c 28-Jun-2021 Nikita Popov

Don't directly include zend_jit_gdb.c

Compile the file separately and only include a header. There doesn't
seem to be a good reason to directly include the C file here, and
this ensu

Don't directly include zend_jit_gdb.c

Compile the file separately and only include a header. There doesn't
seem to be a good reason to directly include the C file here, and
this ensures that there are no symbol clashes (see GH-7197).

show more ...

# 3a782595 16-Jun-2021 Dmitry Stogov

JIT: Avoid too aggressive loop unrolling

This fixes tests/func/010.phpt failure with tracing JIT on ARM64.

# c6582164 03-Jun-2021 Dmitry Stogov

JIT Refactoring:

- Move duplicate system independent functions from zend_jit_x86.dasc and
zend_jit_arm64.dasc into zend_jit.c
* zend_jit_is_constant_cmp_long_long()
* zend_

JIT Refactoring:

- Move duplicate system independent functions from zend_jit_x86.dasc and
zend_jit_arm64.dasc into zend_jit.c
* zend_jit_is_constant_cmp_long_long()
* zend_jit_needs_call_chain()
* skip_valid_arguments()
* zend_ssa_cv_info()
* zend_jit_may_avoid_refcounting()
* zend_get_known_property_info()
* zend_may_be_dynamic_property()
- Move common definitions from zend_jit_x86.dasc and
zend_jit_arm64.dasc into zend_jit.c
* GCC_GLOBAL_REGS
* PROFITABILITY_CHECKS
* BP_JIT_IS
* sp_adj_kind
* sp_adj[]
- Remove unused DynAsm macros
* ADDR_CMP (arm64)
- Inline and remove DynAsm macros used once
* LOAD_BASE_ADDR (arm64 and x86)
* PUSH_BASE_ADDR (x86)
* MEM_OP3_3 (x86)
* SET_Z_PTR (x86)
- Rename DynAsm macros
* MEM_LOAD_OP_STORE -> MEM_UPDATE (arm64)
* MEM_LOAD_OP_STORE_ZTS - > MEM_UPDATE_ZTS (arm64)
* ADDR_OP1 -> PUSH_ADDR (x86)
* ADDR_OP2_2 -> ADDR_STORE and ADDR_CMP (x86)
* MEM_OP2_1_ZTS -> MEM_STORE_ZTS, MEM_CMP_ZTS, MEM_UPDATE_ZTRS (x86)
* MEM_OP2_2 -> MEM_LOAD and MEM_LOAD_OP (x86)
* MEM_OP2_2_ZTS -> MEM_LOAD_ZTS and MEM_LOAD_OP_ZTS (x86)
* SSE_AVX_OP -> DOUBLE_CMP (x86)
* SSE_GET_LONG -> DOUBLE_GET_LONG (x86)
* SSE_GET_ZVAL_LVAL -> DOUBLE_GET_ZVAL_LVAL (x86)
* SSE_GET_ZVAL_LVAL -> DOUBLE_GET_ZVAL_LVAL (x86)
* SSE_GET_ZVAL_DVAL -> DOUBLE_GET_ZVAL_DVAL (x86)
* SSE_SET_ZVAL_DVAL -> DOUBLE_SET_ZVAL_DVAL (x86)

show more ...

# 5de50e28 02-Jun-2021 Dmitry Stogov

Separate common code

# 7c2a3a94 31-May-2021 Hao Sun

JIT/AArch64: [macos][ZTS] Support fast path for tlv_get_addr (#7042)

* JIT/AArch64: [macos][ZTS] Support fast path for tlv_get_addr

Access to TLV(thread local variable) in macOS is

JIT/AArch64: [macos][ZTS] Support fast path for tlv_get_addr (#7042)

* JIT/AArch64: [macos][ZTS] Support fast path for tlv_get_addr

Access to TLV(thread local variable) in macOS is in "dynamic" form and
function tlv_get_addr() is invoked to resolve the address. See the
example in [1].

Note there is one struct TLVDescriptor [2] for each TLV. The first
member holds the address of function tlv_get_addr(), and the other two
members, "key" and "offset", would be used inside tlv_get_addr().

The disassembly code for function tlv_get_addr() is shown in [3]. With
the value from system register, i.e. tpidrro_el0, together with "key"
and "offset", the TLV address can be obtained.

Note that the value from tpidrro_el0 varies for different threads, and
unique address for TLV is resolved.

It's worth noting that slow path would be executed, i.e. function
tlv_allocate_and_initialize_for_key(), for the first time of TLV access.

In this patch:
1. "_tsrm_ls_cache" is guaranteed to be accessed before any VM/JIT code
during the request startup, e.g. in init_executor(), therefore, slow
path can be avoided.

2. As TLVDecriptor is immutable and zend_jit_setup() executes once, we
get this structure in tsrm_get_ls_cache_tcb_offset(). Note the 'ldr'
instruction would be patched to 'add' by the linker.

3. Only fast path for tlv_get_addr() is implemented in macro
LOAD_TSRM_CACHE.

With this patch, all ~4k test cases can pass for ZTS+CALL in macOS on
Apple silicon.

[1] https://gist.github.com/shqking/4aab67e0105f7c1f2c549d57d5799f94
[2]
https://opensource.apple.com/source/dyld/dyld-195.6/src/threadLocalVariables.c.auto.html
[3] https://gist.github.com/shqking/329d7712c26bad49786ab0a544a4af43

Change-Id: I613e9c37e3ff2ecc3fab0f53f1e48a0246e12ee3

show more ...

# 77ce2537 21-May-2021 Dmitry Stogov

Merge branch 'PHP-8.0'

* PHP-8.0:
Disable ASSIGN + SEND_VAL fusion for cases when destroying of old value may throw an exception.


# 11a7310b 21-May-2021 Dmitry Stogov

Disable ASSIGN + SEND_VAL fusion for cases when destroying of old value may throw an exception.

# e5d26810 19-May-2021 Dmitry Stogov

JIT/AArch64: Link traces through exit tables.

1. Generate exit table at the end of each trace (list of unconditional branches for all side exit)
2. Jump to this table if conditional bran

JIT/AArch64: Link traces through exit tables.

1. Generate exit table at the end of each trace (list of unconditional branches for all side exit)
2. Jump to this table if conditional branch to side exit can't be performed because of limited jump distance (+/-1MB) (avoid extra veneers for side exits).
3. During trace linking, update targets of conditional branches to this exit table, if target trace can't be reachd because of limited jump distance (+/-1MB)

show more ...

# 7358457a 19-May-2021 Dmitry Stogov

JIT: Don't include zend_jit_trace_info.jmp_table_size into zend_jit_trace_info.code_size

# 45325bd4 19-May-2021 Dmitry Stogov

JIT/AArch64: Fixed code alignment

Revision tags: php-8.0.7RC1
# a6bb79f1 19-May-2021 Dmitry Stogov

Correct DWARF frame description.

Now GDB correctly shows backtraces that involves JIT-ed code for
functional/tracing JIT, HYBRID/CALL VM, x86/AArch64 CPU.
(opcache.jit_debug=0x100 sh

Correct DWARF frame description.

Now GDB correctly shows backtraces that involves JIT-ed code for
functional/tracing JIT, HYBRID/CALL VM, x86/AArch64 CPU.
(opcache.jit_debug=0x100 should be set).

show more ...


# 767a4af2 18-May-2021 Dmitry Stogov

Introduce and use ZEND_JIT_TARGET_X86 and ZEND_JIT_TARGET_ARM64 macros.
Remove x86 specific code from ext/opcache/jit/zend_jit_arm64.dasc.
Fixed ARM64 build without libcapstone.

# 5fe20625 18-May-2021 Dmitry Stogov

Correct DWARF frame description.

Now GDB correctly shows backtraces that involves JIT-ed code for
functional/tracing JIT, HYBRID/CALL VM, x86/AArch64 CPU.
(opcache.jit_debug=0x100 sh

Correct DWARF frame description.

Now GDB correctly shows backtraces that involves JIT-ed code for
functional/tracing JIT, HYBRID/CALL VM, x86/AArch64 CPU.
(opcache.jit_debug=0x100 should be set).

show more ...

Revision tags: php-7.4.20RC1
# fc3157ea 13-May-2021 Dmitry Stogov

Generate veneers to perform long jumps.

This makes symfony_demo app working with -d opcacge.jit=1205.
(21 MB of JIT-ed code).

# 5dd539b8 12-May-2021 Dmitry Stogov

Fixed JIT memory usage debug info (opcache.jit_debug=0x200)

# 94ce76a3 12-May-2021 Dmitry Stogov

Implemented AArch64 support for GDB/JIT interface.

Stack frame description is not accurate, so backtraces that involved
JIT-ed code may be brocken. Disassemble and breakpoints on JIT-ed

Implemented AArch64 support for GDB/JIT interface.

Stack frame description is not accurate, so backtraces that involved
JIT-ed code may be brocken. Disassemble and breakpoints on JIT-ed code
work fine.

show more ...

Revision tags: php-8.0.6, php-7.4.19
# 412c172a 28-Apr-2021 Dmitry Stogov

Attempt to fix Windows build

Revision tags: php-7.4.18, php-7.3.28, php-8.0.5
# 2c90fe1d 27-Apr-2021 Dmitry Stogov

Fixed some compilation warnings

# 06b9eb50 25-Apr-2021 Hao Sun

Support failed test case: switch_jumptable.phpt

Opcodes ZEND_SWITCH_LONG, ZEND_SWITCH_STRING and ZEND_MATCH are
supported in this patch.

Change-Id: I71ae3d40e65ec1b29d3d9115ac41

Support failed test case: switch_jumptable.phpt

Opcodes ZEND_SWITCH_LONG, ZEND_SWITCH_STRING and ZEND_MATCH are
supported in this patch.

Change-Id: I71ae3d40e65ec1b29d3d9115ac41caef17cf6ae5

show more ...

# 42bec86a 22-Apr-2021 Hao Sun

Optimizing LONG MUL to SHIFT: refine the trigger condition and add overflow detection

LONG MUL can be optimzied into left shift if either operand is a power
of two. Conditions "IS_SIGNED

Optimizing LONG MUL to SHIFT: refine the trigger condition and add overflow detection

LONG MUL can be optimzied into left shift if either operand is a power
of two. Conditions "IS_SIGNED_32BIT()" and "is_power_of_two()" are used
to filter out invalid candidates. However, there exists one exception,
i.e. -2147483648(that is 0xffff,ffff,8000,0000). See the stand-alone
case[1].

Assume "a = 3; b = -2147483648;". The expected result of "a * b" is one
negative value. However, it would be optimized to "a << 31", which is
positive.

This trigger condition is refined.
1) For x86 implementation, another check for positive numbers is added.
Note that LONG type, i.e. zend_long, is defined as int32_t for x86 arch
and int64_t for x64 arch. This optimization only accepts values which
can be represented by int32_t type as default. See IS_SIGNED_32BIlT(),
2) For AArch64, we employ helper function zend_long_is_power_of_two()
since values of int64_t type are used.

Overflow detection for left shifting is added in this patch as well.

Note 1: bit helper functions are arch-independent and we move them into
zend_jit_internals.h.

Note 2: two test cases are added. Test case mul_003.phpt is used to
check the trigger condition and mul_004.phpt is designed to check
overflow detection.

Note 3: overflow detection for x86 is not implemented yet as I think
anotehr temporay register besides R0 is needed. Hence mul_004.phpt would
fail on x86 machine.
If we can use R1 as tmp_reg, the code can be updated as below.

```
| GET_ZVAL_LVAL result_reg, op1_addr
if (may_overflow) {
use_ovf_flag = 0;
/* Compare 'op' and '((op << n) >> n)' for overflow.
* Flag: jne -> overflow. je -> no overflow.
*/
tmp_reg = ZREG_R1
| mov Ra(tmp_reg), Ra(result_reg)
| shl Ra(tmp_reg), floor_log2(Z_LVAL_P(Z_ZV(op2_addr)))
| sar Ra(tmp_reg), floor_log2(Z_LVAL_P(Z_ZV(op2_addr)))
| cmp Ra(tmp_reg), Ra(result_reg)
}
| shl Ra(result_reg), floor_log2(Z_LVAL_P(Z_ZV(op2_addr)))
```

[1]. https://godbolt.org/z/1vKbfv8oG

Change-Id: Ie90e1d4e7c8b94a0c8f61386dfe650fa2c6879a1

show more ...

12345678910>>...14