1
0
mirror of https://github.com/php/php-src.git synced 2026-04-27 18:23:26 +02:00
Commit Graph

4199 Commits

Author SHA1 Message Date
Dmitry Stogov 77ce2537f7 Merge branch 'PHP-8.0'
* PHP-8.0:
  Disable ASSIGN + SEND_VAL fusion for cases when destroying of old value may throw an exception.
2021-05-21 13:38:50 +03:00
Dmitry Stogov 11a7310b49 Disable ASSIGN + SEND_VAL fusion for cases when destroying of old value may throw an exception. 2021-05-21 13:36:58 +03:00
Hao Sun 3ce26d80b7 JIT/AArch64: [macos] Fix arguments to variadic function (#7023)
zend_throw_error() and zend_error() are variadic functions. In Linux,
arguments are passed in registers, whereas they must be put on stack in
Macos [1][2].

In this patch:
1. preprocessor macro "__APPLE__" is used to distinguish the OS.
2. the third argument "CARG3" is the only variadic argument and put on
stack.
3. the invocation of zend_error() is converted back to regular call in
zend_jit_undefined_offset_stub() and zend_jit_undefined_index_stub().

With this patch, all ~4k test cases can pass for "nonZTS+CALL"
functional/tracing JIT with Macos Apple Silicion.

[1]
https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms#Overview
[2] https://github.com/below/HelloSilicon#listing-9-1

Change-Id: I49bc3233fc253ad3e77e8664464ff3e830dcd183
2021-05-21 17:59:15 +08:00
Dmitry Stogov 0b4706819b Fix register save/restore around calls. (This fixes ext/opcache/tests/jit/fetch_dim_rw_001.phpt with -d opcache.jit=1202 without PROFITABILITY_CHECKS) 2021-05-21 11:12:22 +03:00
Dmitry Stogov e9d171805a Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix register save/restore around calls. (This fixes ext/opcache/tests/jit/fetch_dim_rw_001.phpt with -d opcache.jit=1202 without PROFITABILITY_CHECKS)
2021-05-21 11:10:20 +03:00
Dmitry Stogov 025c0763e7 Fix register save/restore around calls. (This fixes
ext/opcache/tests/jit/fetch_dim_rw_001.phpt with -d opcache.jit=1202
without PROFITABILITY_CHECKS)
2021-05-21 11:08:56 +03:00
Dmitry Stogov ab1827f3d4 Merge branch 'PHP-8.0'
* PHP-8.0:
  Add missing undefined variable warning an result initialization. (This fixes Zend/tests/bug78531.phpt without PROFITABILITY_CHECKS).
2021-05-21 10:04:38 +03:00
Dmitry Stogov bf21261c63 Add missing undefined variable warning an result initialization.
(This fixes Zend/tests/bug78531.phpt without PROFITABILITY_CHECKS).
2021-05-21 10:03:00 +03:00
Hao Sun b8a29319a7 JIT/AArch64: Fix typo in commit dc0e259 (#7021)
PHP JIT/AArch64 building is broken. Instruction "beq" should be used.

Change-Id: I16c00f87bafb3a565141e1e02c9e15653f39a276
2021-05-21 14:06:33 +08:00
Dmitry Stogov 6881a002d4 Merge branch 'PHP-8.0'
* PHP-8.0:
  Don't assign to string offset after exception (This fixes Zend/tests/bug31098.phpt failure without PROFITABILITY_CHECKS)
2021-05-21 00:49:44 +03:00
Dmitry Stogov db309b2e4b Don't assign to string offset after exception (This fixes
Zend/tests/bug31098.phpt failure without PROFITABILITY_CHECKS)
2021-05-21 00:48:24 +03:00
Dmitry Stogov dc0e259154 Merge branch 'PHP-8.0'
* PHP-8.0:
  JIT: Fixed incorrect condition (this leaded to Zend/tests/type_declarations/typed_properties_083.phpt failure without PROFITABILITY_CHECKS)
2021-05-21 00:02:46 +03:00
Dmitry Stogov cce0cc8836 JIT: Fixed incorrect condition (this leaded to
Zend/tests/type_declarations/typed_properties_083.phpt failure without
PROFITABILITY_CHECKS)
2021-05-21 00:01:00 +03:00
Dmitry Stogov cb376d8f61 Fixed Zend/tests/type_declarations/union_types/incdec_prop.phpt failure
masked by PROFITABILITY_CHECKS.
2021-05-20 22:52:47 +03:00
Dmitry Stogov 6be0278332 Fixed 32-bit x86 disassembler 2021-05-20 20:17:50 +03:00
Dmitry Stogov 4135ce9d38 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #80968 (JIT segfault with return from required file)
2021-05-20 16:50:14 +03:00
Dmitry Stogov 6e2d47e071 Fixed bug #80968 (JIT segfault with return from required file) 2021-05-20 16:45:24 +03:00
Dmitry Stogov f44ff44516 JIT/AArch64: Fixed incorrect MEM_LOAD usage 2021-05-20 14:43:49 +03:00
Dmitry Stogov 53021b4b9b JIT/AArch64: Fixed DWARF frame description for helper stubs 2021-05-20 12:14:29 +03:00
Dmitry Stogov e5d2681074 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)
2021-05-20 02:53:00 +03:00
Dmitry Stogov 7358457aa7 JIT: Don't include zend_jit_trace_info.jmp_table_size into zend_jit_trace_info.code_size 2021-05-20 02:46:14 +03:00
Dmitry Stogov 45325bd425 JIT/AArch64: Fixed code alignment 2021-05-20 02:32:35 +03:00
Dmitry Stogov d52fdd5056 DynASM/ARM64: Fixed incorrect ADRP instruction encoding (-4 => +4) 2021-05-19 18:21:01 +03:00
Nikita Popov f31c531960 Merge branch 'PHP-8.0'
* PHP-8.0:
  Move preload_autoload assignment into preload_load()
2021-05-19 12:56:28 +02:00
Nikita Popov 62a9f97381 Move preload_autoload assignment into preload_load()
We need to set the preload autoloader even if preloading happened
in a different process. accel_preload() will only run in one.

In particular, this fixes the behavior if preload_user is used.
2021-05-19 12:55:46 +02:00
Dmitry Stogov 9a907b2e17 JIT/AArch64: Combine ADRP+ADD+LDR into ADRP+LDR
before:
	adrp x15, #0xffff8ae5a000
	add x15, x15, #0xd90
	ldr d16, [x15]
after:
	adrp x15, #0xffff8ae5a000
	ldr d16, [x15, #0xd90]
2021-05-19 13:23:28 +03:00
Dmitry Stogov ddb35fe14a JIT/AArch64: Use ADR/ADRP if it makes sense 2021-05-19 11:52:59 +03:00
Dmitry Stogov dec7b7493b DynASM/ARM64: Fixed incorrect ADRP instruction encoding
See: https://developer.arm.com/documentation/ddi0596/2021-03/Base-Instructions/ADRP--Form-PC-relative-address-to-4KB-page-
2021-05-19 11:51:30 +03:00
Dmitry Stogov 2fabe2751c JIT/AArch64: Rename B_IMM26 into B_IMM. 2021-05-19 09:47:23 +03:00
Dmitry Stogov a6bb79f16d 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).
2021-05-19 09:09:51 +03:00
Dmitry Stogov 767a4af2c7 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.
2021-05-18 21:59:32 +03:00
Dmitry Stogov 5fe2062585 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).
2021-05-18 18:21:08 +03:00
Dmitry Stogov dae662ffbc Fixed zend_long_is_power_of_two/zend_long_floor_log2 mess 2021-05-18 15:32:36 +03:00
Dmitry Stogov d6d0b1c389 Remove unnecessary #ifdef 2021-05-18 15:32:36 +03:00
Dmitry Stogov f70ac416c3 Fixed possible failure when repair after overflow detection 2021-05-18 15:32:36 +03:00
Dmitry Stogov a69701de2e Fix "store to misaligned address" ASAN warnings 2021-05-18 15:32:36 +03:00
Dmitry Stogov d6bf98428d Fixed format specifier 2021-05-18 15:32:35 +03:00
Dmitry Stogov f15f01aed7 JIT/AArch64: disable register allocation for expected ++/-- overflow case.
This fixes ext/opcache/tests/jit/inc_021.phpt with tracing JIT.
2021-05-18 15:32:35 +03:00
Dmitry Stogov fc3157ea0f Generate veneers to perform long jumps.
This makes symfony_demo app working with -d opcacge.jit=1205.
(21 MB of JIT-ed code).
2021-05-18 15:32:35 +03:00
Dmitry Stogov 0e8fc156f8 DynASM/ARM64: Add abiulity to plug-in generation of veneers to perform long jumps. 2021-05-18 15:32:35 +03:00
Dmitry Stogov 59ef219994 Fixed ZTS build. 2021-05-18 15:32:35 +03:00
Dmitry Stogov 8970b684e9 Use symbolic labels for BL and ADR instructions 2021-05-18 15:32:35 +03:00
Dmitry Stogov e1e050d752 Use better code for trace exits. Don't store CPU registers that can't be used by deoptimizer. 2021-05-18 15:32:35 +03:00
Dmitry Stogov 43b138852e Remove unused TMP4. Use intra-precedure call scratch registers for TMP2 and TMP3. 2021-05-18 15:32:35 +03:00
Dmitry Stogov 78cdb2a7a0 Allow to print JIT assemble without binary addresses (opcache.jit_debug=0x001) and with (opcache.jit_debug=0x401) for both ARM and x86. 2021-05-18 15:32:35 +03:00
Dmitry Stogov 5dd539b866 Fixed JIT memory usage debug info (opcache.jit_debug=0x200) 2021-05-18 15:32:35 +03:00
Dmitry Stogov 94ce76a331 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.
2021-05-18 15:32:35 +03:00
Dmitry Stogov b5aa339cfd Reenable PROFITABILITY_CHECKS 2021-05-18 15:32:35 +03:00
Dmitry Stogov da2bed357a Fixed incorrect range check (missed sign bit) 2021-05-18 15:32:35 +03:00
Hao Sun 1a6bcd0f80 Fix commit 8143a49: macro ADD_SUB_64_WITH_CONST_32 should be used
"(struct.._offset+offsetof(zend_..struct, field))" might exceed the
range of ADD_SUB_IMM, leading to DynASM error DASM_S_RANGE_I for
ZTS+CALL test variant.

Using macro ADD_SUB_64_WITH_CONST_32 would fix it.

Change-Id: I3233cefbcd1ddea16e7de6725c2dc5ff43373916
2021-05-18 15:32:35 +03:00