summaryrefslogtreecommitdiff
path: root/ext/opcache/jit
Commit message (Collapse)AuthorAgeFilesLines
* Improved JIT for TYPE_CHECK opcodeDmitry Stogov2021-03-252-26/+76
|
* Improve JIT for IS_IDENTICALDmitry Stogov2021-03-251-18/+36
|
* Replace function with macroDmitry Stogov2021-03-243-13/+5
|
* Move system independent code out from x86 specific headerDmitry Stogov2021-03-233-190/+204
|
* Move x86 dependent code out from platform independed parts.Dmitry Stogov2021-03-234-23/+33
|
* Use capstone disassembler, if available.Dmitry Stogov2021-03-234-30/+206
|
* Use zend_hash_lookup()Dmitry Stogov2021-03-193-44/+6
|
* Support prototypes in call graphNikita Popov2021-03-192-4/+7
| | | | | | | | | | Even if we don't know the exact method being called, include it in the call graph with the is_prototype flag. In particular, we can still make use of return types from prototype methods, as PHP 8 makes LSP violations a hard error. Most other places are adjusted to skip calls with !is_prototype. Maybe some of them would be fine, but ignoring them is conservative.
* Update one more use of NO_AUTOLOADNikita Popov2021-03-181-2/+3
|
* Merge branch 'PHP-8.0'Dmitry Stogov2021-03-171-1/+1
|\ | | | | | | | | * PHP-8.0: Fixed bug #80861 (erronous array key overflow in 2D array with JIT)
| * Fixed bug #80861 (erronous array key overflow in 2D array with JIT)Dmitry Stogov2021-03-171-1/+1
| |
* | Merge branch 'PHP-8.0'Dmitry Stogov2021-03-171-0/+6
|\ \ | |/ | | | | | | * PHP-8.0: Fixed bug #80839 (PHP problem with JIT)
| * Fixed bug #80839 (PHP problem with JIT)Dmitry Stogov2021-03-171-0/+6
| |
* | Merge branch 'PHP-8.0'Dmitry Stogov2021-03-101-2/+2
|\ \ | |/ | | | | | | * PHP-8.0: Fixed bug #80814 (threaded mod_php won't load on FreeBSD: No space available for static Thread Local Storage)
| * Fixed bug #80814 (threaded mod_php won't load on FreeBSD: No space available ↵Dmitry Stogov2021-03-101-2/+2
| | | | | | | | for static Thread Local Storage)
* | Merge branch 'PHP-8.0'Dmitry Stogov2021-02-241-4/+13
|\ \ | |/ | | | | | | * PHP-8.0: Fixed bug #80782 (DASM_S_RANGE_VREG on PHP_INT_MIN-1)
| * Fixed bug #80782 (DASM_S_RANGE_VREG on PHP_INT_MIN-1)Dmitry Stogov2021-02-241-4/+13
| |
* | Merge branch 'PHP-8.0'Nikita Popov2021-02-231-10/+11
|\ \ | |/ | | | | | | * PHP-8.0: Fixed bug #80786
| * Fixed bug #80786Nikita Popov2021-02-231-10/+11
| | | | | | | | | | | | | | Don't use r0 as temporary register in math_double_long if it is already used for a memory result. This was already done in one branch, but not the other.
* | Merge branch 'PHP-8.0'Dmitry Stogov2021-02-172-12/+57
|\ \ | |/ | | | | | | * PHP-8.0: Fixed bug #80745 (JIT produces Assert failure and UNKNOWN:0 var_dumps in code involving bitshifts)
| * Fixed bug #80745 (JIT produces Assert failure and UNKNOWN:0 var_dumps in ↵Dmitry Stogov2021-02-172-12/+57
| | | | | | | | code involving bitshifts)
* | Merge branch 'PHP-8.0'Dmitry Stogov2021-02-161-3/+3
|\ \ | |/ | | | | | | * PHP-8.0: Fixed bug #80742 (Opcache JIT makes some boolean logic unexpectedly be true)
| * Fixed bug #80742 (Opcache JIT makes some boolean logic unexpectedly be true)Dmitry Stogov2021-02-161-3/+3
| |
* | Revert "Implement fetching TLS TCB offset on MacOS"Nikita Popov2021-02-121-8/+0
| | | | | | | | | | | | This reverts commit 1106ff9a0e420e043c2e56c8ca00db85f1b85ee6. Looks like this sauses segfaults on MacOs ZTS with JIT.
* | Implement fetching TLS TCB offset on MacOSDavid Carlier2021-02-111-0/+8
| | | | | | | | | | | | Tested with php-cgi and wordpress and 1255 for jit settings. Closes GH-6659.
* | Use zend_type.ce_cache__ptr for caching class resulution during ↵Dmitry Stogov2021-02-101-0/+12
| | | | | | | | argument/result type checks
* | Optimize ZEND_COUNT opcodes on arrays in the jitTyson Andre2021-02-093-1/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid the overhead of a call and checking types when the argument is definitely an array. Avoid the overhead of gc when `__destruct` won't get called. This seemed cheap enough to check for in the jit. Because of https://wiki.php.net/rfc/restrict_globals_usage we can be sure in the ZEND_COUNT handler that the array count does not have to be recomputed in php 8.1. The below example took 0.854 seconds before the optimization, and 0.564 seconds after the optimization, giving the same result ```php <?php /** @jit */ function bench_count(int $n): int { $total = 0; $arr = []; for ($i = 0; $i < $n; $i++) { $arr[] = $i; $total += count($arr); } return $total; } function main() { $n = 1000; $iterations = 50000; $start = microtime(true); $result = 0; for ($i = 0; $i < $iterations; $i++) { $result += bench_count($n); } $elapsed = microtime(true) - $start; printf("Total for n=%d, iterations=%d = %d, elapsed=%.3f\n", $n, $iterations, $result, $elapsed); } main(); ``` Before ```asm mov $0x7feb8cf8a858, %r15 mov $ZEND_COUNT_SPEC_CV_UNUSED_HANDLER, %rax call *%rax ``` After ```asm mov 0x70(%r14), %rdi - Copy the count from the `zend_array*` pointer mov %rdi, (%rax) - Store the count in the destination's value mov $0x4, 0x8(%rax) - Store IS_LONG(4) in the destination's type ``` And add tracing jit support Closes GH-5584
* | Added Inheritance Cache.Dmitry Stogov2021-02-091-11/+15
| | | | | | | | | | | | | | | | | | | | This is a new transparent technology that eliminates overhead of PHP class inheritance. PHP classes are compiled and cached (by opcahce) separately, however their "linking" was done at run-time - on each request. The process of "linking" may involve a number of compatibility checks and borrowing methods/properties/constants form parent and traits. This takes significant time, but the result is the same on each request. Inheritance Cache performs "linking" for unique set of all the depending classes (parent, interfaces, traits, property types, method types involved into compatibility checks) once and stores result in opcache shared memory. As a part of the this patch, I removed limitations for immutable classes (unresolved constants, typed properties and covariant type checks). So now all classes stored in opcache are "immutable". They may be lazily loaded into process memory, if necessary, but this usually occurs just once (on first linking). The patch shows 8% improvement on Symphony "Hello World" app.
* | Merge branch 'PHP-8.0'Dmitry Stogov2021-01-261-0/+8
|\ \ | |/ | | | | | | * PHP-8.0: Fixed observer API and JIT compatibility
| * Fixed observer API and JIT compatibilityDmitry Stogov2021-01-261-0/+8
| |
* | Merge branch 'PHP-8.0'Nikita Popov2021-01-251-0/+3
|\ \ | |/ | | | | | | | | * PHP-8.0: Fix opcache phpize build on FreeBSD Updated to version 2021.1 (2021a)
| * Fix opcache phpize build on FreeBSDAlex Samorukov2021-01-251-0/+3
| | | | | | | | Closes GH-6589.
* | Merge branch 'PHP-8.0'Dmitry Stogov2021-01-201-1/+4
|\ \ | |/ | | | | | | * PHP-8.0: Fixed bug #80634 (write_property handler of internal classes is skipped on preloaded JITted code)
| * Fixed bug #80634 (write_property handler of internal classes is skipped on ↵Dmitry Stogov2021-01-201-1/+4
| | | | | | | | preloaded JITted code)
* | Merge branch 'PHP-8.0'Nikita Popov2021-01-191-4/+13
|\ \ | |/ | | | | | | * PHP-8.0: Keep JIT region executable under ZTS
| * Keep JIT region executable under ZTSDylan K. Taylor2021-01-191-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | When one thread tries to compile a script, another thread may already be executing JITed code. In this case we can't make the memory non-executable. This violates the W^X principle, but doesn't seem to be avoidable for ZTS builds for now. The same problem does not exist for NTS, as it's a different process executing there, which has it's own memory protection mapping. Closes GH-6595.
* | Merge branch 'PHP-8.0'Nikita Popov2021-01-191-12/+7
|\ \ | |/ | | | | | | * PHP-8.0: Observe unused return values in JIT
| * Observe unused return values in JITNikita Popov2021-01-191-12/+7
| | | | | | | | | | Even if the return value is not used, it should still be available to the observer.
* | Replace zend_bool uses with boolNikita Popov2021-01-158-149/+149
| | | | | | | | | | | | | | We're starting to see a mix between uses of zend_bool and bool. Replace all usages with the standard bool type everywhere. Of course, zend_bool is retained as an alias.
* | Merge branch 'PHP-8.0'Dmitry Stogov2021-01-141-0/+5
|\ \ | |/ | | | | | | * PHP-8.0: Fixed bug #80422 (php_opcache.dll crashes when using Apache 2.4 with JIT)
| * Fixed bug #80422 (php_opcache.dll crashes when using Apache 2.4 with JIT)Dmitry Stogov2021-01-141-0/+5
| |
* | Merge branch 'PHP-8.0'Dmitry Stogov2021-01-111-0/+5
|\ \ | |/ | | | | | | * PHP-8.0: Add guard if lvalue of assignment may be a reference, but wasn't a reference during recording
| * Add guard if lvalue of assignment may be a reference, but wasn't a reference ↵Dmitry Stogov2021-01-111-0/+5
| | | | | | | | during recording
* | Better CPU registers usageDmitry Stogov2021-01-111-20/+19
| |
* | Remove redundand IS_INDIRECT checks (they were necessary for $GLOBALS handling)Dmitry Stogov2021-01-111-46/+14
| |
* | Remove unnecessary INDIRECT checks in JIT helpersNikita Popov2021-01-061-92/+13
|/
* Initialize EX(call)->func by single instructionDmitry Stogov2020-12-291-7/+17
|
* Reuse value stored in %r0 instead of immediate operandDmitry Stogov2020-12-291-2/+2
|
* Eliminate redundand comparison insructionsDmitry Stogov2020-12-243-14/+117
|
* JIT: Update invalid opcache.jit INI value message to include "tracing" and ↵Ayesh Karunaratne2020-12-151-1/+1
| | | | | | | | | "function" values `opcache.jit` accepts `tracing` and `function` as aliases, but they were not mentioned in the start-up INI warning message. This updates the error message to include all possible values. Closes GH-6490.