1
0
mirror of https://github.com/php/php-src.git synced 2026-04-13 02:52:48 +02:00
Commit Graph

1727 Commits

Author SHA1 Message Date
Dmitry Stogov
ca93e48b77 Uniform placing of init_fcall guards.
This fixes trcing JIT with opcache.jit=51
2022-09-27 11:30:36 +03:00
Dmitry Stogov
95d9e5157f Check "ssa_op" before dereference (it may be NULL for opcache.jit=51) 2022-09-23 13:14:07 +03:00
David Carlier
fd55b50833 Merge branch 'PHP-8.1' into PHP-8.2 2022-09-22 11:24:37 +01:00
wxue1
52f4ed16e0 Indirect call reduction for Jit code
Changing indirect call to direct call for Jit code
benefits the branch prediction, which gets 1% performance
gain in our workload.
Similarly, we change indirect jump to direct jump.

Signed-off-by: Su, Tao <tao.su@intel.com>
Signed-off-by: Wang, Xue <xue1.wang@intel.com>
2022-09-22 11:22:27 +01:00
Arnaud Le Blanc
3c852cf43f Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Check return value of zend_jit_trace_get_exit_addr() (#9097)
2022-09-09 10:51:10 +02:00
Arnaud Le Blanc
466e4dc2a2 Check return value of zend_jit_trace_get_exit_addr() (#9097) 2022-09-09 10:50:03 +02:00
Dmitry Stogov
4b884bedc8 JIT: Fix missing type store
Fixes oss-fuzz #50653
2022-08-29 14:36:16 +03:00
Dmitry Stogov
2f9bc6e37a Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix ext/opcache/tests/jit/inc_obj_004.phpt failure introduced by fd74ee7e90
2022-08-29 12:36:06 +03:00
Dmitry Stogov
a516e2992d Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix ext/opcache/tests/jit/inc_obj_004.phpt failure introduced by fd74ee7e90
2022-08-29 12:35:46 +03:00
Dmitry Stogov
ce42dcf483 Fix ext/opcache/tests/jit/inc_obj_004.phpt failure introduced by fd74ee7e90
This should fix GH-9445
2022-08-29 12:30:14 +03:00
Ilija Tovilo
3264f2367d Fix strict-prototypes warning 2022-08-26 13:57:39 +02:00
David CARLIER
e787d9a0dc GH-9370: Fix opcache jit protection bits.
Allow mprotect to occur, pthread_jit_write_np are just to allow mprotect
 flags to be used.

Closes #9371.
2022-08-24 16:11:35 +01:00
Dmitry Stogov
205ad0af29 Fix coding style 2022-08-24 08:44:49 +03:00
wxue1
9f926d6b2d Stop JIT hot spot counting (#9343)
When max_root_trace is reached, JIT in tracing mode will not
compile any new code for root trace and side trace, but
counting hot code is still going on. This patch stops counting
as soon as possible by replacing counter handler with
original handler, which increases 1.5% performance.

Signed-off-by: Wang, Xue <xue1.wang@intel.com>

Signed-off-by: Wang, Xue <xue1.wang@intel.com>
2022-08-24 08:37:49 +03:00
Dmitry Stogov
d8c6549974 Merge branch 'PHP-8.1'
* PHP-8.1:
  JIT: Make code generation to be consistent with register allocation
2022-08-22 20:00:44 +03:00
Dmitry Stogov
2a33280ceb Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  JIT: Make code generation to be consistent with register allocation
2022-08-22 19:55:10 +03:00
Dmitry Stogov
fd74ee7e90 JIT: Make code generation to be consistent with register allocation
Fixes ext/opcache/tests/jit/add_014.phpt with opcache.jit=1205
2022-08-22 19:53:33 +03:00
Dmitry Stogov
a5d84ba0d8 Merge branch 'PHP-8.1'
* PHP-8.1:
  Tracing JIT: Fix incorrect guard elimination
2022-08-22 15:42:28 +03:00
Dmitry Stogov
5762fc52c6 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Tracing JIT: Fix incorrect guard elimination
2022-08-22 15:39:47 +03:00
Dmitry Stogov
c9c51eb1f1 Tracing JIT: Fix incorrect guard elimination
Fixes oss-fuzz #49917
2022-08-22 15:38:41 +03:00
David Carlier
5a9411d086 Merge branch 'PHP-8.1' 2022-08-19 16:41:06 +01:00
David Carlier
9360cd6add Merge branch 'PHP-8.0' into PHP-8.1 2022-08-19 16:40:54 +01:00
David Carlier
52e312afb8 opcache jit fix message format for OpenBSD.
like macOs it requires `ll`.
Closes #9380.
2022-08-19 16:40:29 +01:00
Bob Weinand
dc5475c191 Save previous observer on the VM stack
This avoids a possible significant performance penalty, when some leaf function was observed, deep in the stack.
As a side effect, we are not iterating over prev_execute_data anymore and thus, non-observed fake frames, possibly on stack, cannot have any impact on the observer anymore (especially within zend_observer_fcall_end_all).

Saving the previous observer happens now directly on the VM stack. If there is any observer, function frames are allocated an extra zval (the last temporary), which will, on observed frames, contain the previous observed frame address.
2022-08-04 17:16:27 +02:00
Dmitry Stogov
c207efab63 Merge branch 'PHP-8.1'
* PHP-8.1:
  Tracing: Prevent recording types of variables used to pass zend_class_entry
2022-08-01 17:04:08 +03:00
Dmitry Stogov
7ff71a0a55 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Tracing: Prevent recording types of variables used to pass zend_class_entry
2022-08-01 17:03:56 +03:00
Dmitry Stogov
2758ff2a77 Tracing: Prevent recording types of variables used to pass zend_class_entry 2022-08-01 17:02:53 +03:00
Dmitry Stogov
fac37347ce Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix incorrect guard motion out of the loop
2022-08-01 15:33:50 +03:00
Dmitry Stogov
69c10aed58 Fix incorrect guard motion out of the loop
Fixes oss-fuzz #49579
2022-08-01 15:32:49 +03:00
Bob Weinand
625f164963 Include internal functions in the observer API
There are two main motivations to this:
a) The logic for handling internal and userland observation can be unified.
b) Unwinding of observed functions on a bailout does notably not include observers. Even if users of observers were to ensure such handling themselves, it would be impossible to retain the relative ordering - either the user has to unwind all internal observed frames before the automatic unwinding (zend_observer_fcall_end_all) or afterwards, but not properly interleaved.

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-07-30 19:20:55 +02:00
David CARLIER
099b16800c GH-9157: opcache fix build on older macOs releases.
Closes #9158.
2022-07-27 09:37:54 +01:00
Dmitry Stogov
9d52081741 Merge branch 'PHP-8.1'
* PHP-8.1:
  JIT: Fix missing type stote
2022-07-25 15:25:08 +03:00
Dmitry Stogov
e70d282077 JIT: Fix missing type stote
Fixes oss-fuzz #49402
2022-07-25 15:24:26 +03:00
Dmitry Stogov
4227fddf4d Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix memory leak
2022-07-25 12:08:09 +03:00
Dmitry Stogov
cc465ba0bb Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix memory leak
2022-07-25 12:08:00 +03:00
Dmitry Stogov
44b86aee31 Fix memory leak
Fixes oss-fuzz #49272
2022-07-25 12:04:46 +03:00
David CARLIER
1416961505 opcache JIT support improvements attempts on macOs.
for cases when shared segments switch b/w R/W/X and R/X bits.

Closes #8382.
2022-07-19 13:41:33 +01:00
David CARLIER
f6aa7a4960 [ci skip] Follow-up on #8914, usage comments addition. 2022-07-18 13:28:04 +01:00
Arnaud Le Blanc
02a0a8ae26 Merge branch 'PHP-8.1'
* PHP-8.1:
  [ci skip] NEWS
  Fix JIT crash with large number of match/switch arms (#8961)
2022-07-18 12:36:13 +02:00
Arnaud Le Blanc
f2381ae4ba Fix JIT crash with large number of match/switch arms (#8961)
Switch statements may generate a large number of exit points. Once the max
number of exit points is reached, get_exit_addr() returns NULL. This was not
checked, and this resulted in a jump table with some 0 addresses.
2022-07-18 12:34:20 +02:00
David CARLIER
c56e183226 opcache JIT: Adds initial support for macOs Instruments performance measurement.
By default, it is based on the perf_event Linux api, here
we add the proprietary Apple's format using directly its api.

Closes #8914.
2022-07-15 14:27:07 +01:00
Dmitry Stogov
e01586ac4f Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix incorrect condition introdused in 7cf6f17383
2022-06-29 13:09:22 +03:00
Dmitry Stogov
af75eab0ef Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix incorrect condition introdused in 7cf6f17383
2022-06-29 13:09:14 +03:00
Dmitry Stogov
d66d477d6f Fix incorrect condition introdused in 7cf6f17383 2022-06-29 13:08:18 +03:00
Dmitry Stogov
7e32033331 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fixed bug GH-8847 (PHP hanging infinitly at 100% cpu when check php syntaxe of a valid file)
2022-06-29 12:16:20 +03:00
Dmitry Stogov
b7693360cb Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fixed bug GH-8847 (PHP hanging infinitly at 100% cpu when check php syntaxe of a valid file)
2022-06-29 12:13:03 +03:00
Dmitry Stogov
7cf6f17383 Fixed bug GH-8847 (PHP hanging infinitly at 100% cpu when check php syntaxe of a valid file) 2022-06-29 12:10:46 +03:00
Chen, Hu
d8de067b0f JIT: Add IBT support (#8774)
Indirect Branch Tracking (IBT) is part of Intel's Control-Flow
Enforcement Technology (CET). IBT is hardware based, forward edge
Control-Flow-Integrity mechanism where any indirect CALL/JMP must target
an ENDBR instruction or suffer #CP.

This commit adds IBT support for JIT:
1. Add endbr32/64 instruction in Dynasm.
2. Insert endbr32/64 in indirect branch target for jitted code.

gcc support CET since v8.1 and set it to default since gcc 11. With this
commit, endbr is inserted in jitted code if PHP is compiled with "gcc
-fcf-protection=full/branch".

Signed-off-by: Chen, Hu <hu1.chen@intel.com>
2022-06-28 08:42:19 +03:00
Dmitry Stogov
7e23c838e2 Fixed Bug GH-8863: RW operation on readonly property doesn't throw with JIT 2022-06-27 16:41:53 +03:00
Dmitry Stogov
ad40fffd36 Fixed Bug GH-8863: RW operation on readonly property doesn't throw with JIT 2022-06-27 14:25:30 +03:00