From ef6db9fd38378a89ae15ac036f0bb338f7d6f3bb Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 18 Sep 2023 10:34:35 +0200 Subject: [PATCH 01/29] Trigger JIT tracing&compilation more often, enable JIT for ASAN --- .github/workflows/nightly.yml | 49 +++++++++++++++++++++++++++++++++++ .github/workflows/push.yml | 22 ++++++++++++++-- 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 4b69154d150bf..a5ed885f4073a 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -106,8 +106,17 @@ jobs: runTestsParameters: >- ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so + -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.jit_buffer_size=16M + -d opcache.jit_prof_threshold=0.000000001 + -d opcache.jit_max_root_traces=10000000 + -d opcache.jit_max_side_traces=10000000 + -d opcache.jit_max_exit_counters=1000000 + -d opcache.jit_hot_loop=1 + -d opcache.jit_hot_func=1 + -d opcache.jit_hot_return=1 + -d opcache.jit_hot_side_exit=1 - name: Test OpCache uses: ./.github/actions/test-linux with: @@ -115,6 +124,7 @@ jobs: runTestsParameters: >- ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so + -d opcache.enable=1 -d opcache.enable_cli=1 - name: Test Function JIT # ASAN frequently timeouts. Each test run takes ~90 minutes, we can @@ -126,6 +136,7 @@ jobs: runTestsParameters: >- ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so + -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.jit_buffer_size=16M -d opcache.jit=1205 @@ -197,14 +208,24 @@ jobs: runTestsParameters: >- ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so + -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.jit_buffer_size=16M + -d opcache.jit_prof_threshold=0.000000001 + -d opcache.jit_max_root_traces=10000000 + -d opcache.jit_max_side_traces=10000000 + -d opcache.jit_max_exit_counters=1000000 + -d opcache.jit_hot_loop=1 + -d opcache.jit_hot_func=1 + -d opcache.jit_hot_return=1 + -d opcache.jit_hot_side_exit=1 - name: Test OpCache uses: ./.github/actions/test-linux with: runTestsParameters: >- ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so + -d opcache.enable=1 -d opcache.enable_cli=1 - name: Test Function JIT uses: ./.github/actions/test-linux @@ -212,6 +233,7 @@ jobs: runTestsParameters: >- ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so + -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.jit_buffer_size=16M -d opcache.jit=1205 @@ -260,15 +282,25 @@ jobs: testArtifacts: ${{ matrix.branch.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} Tracing JIT runTestsParameters: >- -d zend_extension=opcache.so + -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=16M + -d opcache.jit_prof_threshold=0.000000001 + -d opcache.jit_max_root_traces=10000000 + -d opcache.jit_max_side_traces=10000000 + -d opcache.jit_max_exit_counters=1000000 + -d opcache.jit_hot_loop=1 + -d opcache.jit_hot_func=1 + -d opcache.jit_hot_return=1 + -d opcache.jit_hot_side_exit=1 - name: Test OpCache uses: ./.github/actions/test-macos with: testArtifacts: ${{ matrix.branch.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} OpCache runTestsParameters: >- -d zend_extension=opcache.so + -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 - name: Test Function JIT @@ -277,6 +309,7 @@ jobs: testArtifacts: ${{ matrix.branch.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} Function JIT runTestsParameters: >- -d zend_extension=opcache.so + -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=16M @@ -323,6 +356,7 @@ jobs: with: runTestsParameters: >- -d zend_extension=opcache.so + -d opcache.enable=1 -d opcache.enable_cli=1 - name: Upload Test Coverage to Codecov.io if: always() @@ -372,9 +406,18 @@ jobs: - name: Enable Opcache and JIT run: | echo zend_extension=opcache.so > /etc/php.d/opcache.ini + echo opcache.enable=1 >> /etc/php.d/opcache.ini echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini echo opcache.jit_buffer_size=1G >> /etc/php.d/opcache.ini + echo opcache.jit_prof_threshold=0.000000001 >> /etc/php.d/opcache.ini + echo opcache.jit_max_root_traces=10000000 >> /etc/php.d/opcache.ini + echo opcache.jit_max_side_traces=10000000 >> /etc/php.d/opcache.ini + echo opcache.jit_max_exit_counters=1000000 >> /etc/php.d/opcache.ini + echo opcache.jit_hot_loop=1 >> /etc/php.d/opcache.ini + echo opcache.jit_hot_func=1 >> /etc/php.d/opcache.ini + echo opcache.jit_hot_return=1 >> /etc/php.d/opcache.ini + echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini - name: Test AMPHP if: matrix.branch.ref != 'PHP-8.0' run: | @@ -545,6 +588,7 @@ jobs: with: runTestsParameters: >- -d zend_extension=opcache.so + -d opcache.enable=1 -d opcache.enable_cli=1 --file-cache-prime - name: Test File Cache (prime shm, use shm) @@ -552,6 +596,7 @@ jobs: with: runTestsParameters: >- -d zend_extension=opcache.so + -d opcache.enable=1 -d opcache.enable_cli=1 --file-cache-use - name: Test File Cache (prime shm, use file) @@ -559,6 +604,7 @@ jobs: with: runTestsParameters: >- -d zend_extension=opcache.so + -d opcache.enable=1 -d opcache.enable_cli=1 --file-cache-use -d opcache.file_cache_only=1 @@ -567,6 +613,7 @@ jobs: with: runTestsParameters: >- -d zend_extension=opcache.so + -d opcache.enable=1 -d opcache.enable_cli=1 --file-cache-prime -d opcache.file_cache_only=1 @@ -575,6 +622,7 @@ jobs: with: runTestsParameters: >- -d zend_extension=opcache.so + -d opcache.enable=1 -d opcache.enable_cli=1 --file-cache-use -d opcache.file_cache_only=1 @@ -675,6 +723,7 @@ jobs: runTestsParameters: >- --msan -d zend_extension=opcache.so + -d opcache.enable=1 -d opcache.enable_cli=1 - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 51751c1fc52d8..a83f2fba19bb9 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -108,7 +108,7 @@ jobs: configurationParameters: >- --${{ matrix.debug && 'enable' || 'disable' }}-debug --${{ matrix.zts && 'enable' || 'disable' }}-zts - ${{ matrix.asan && 'CFLAGS="-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=undefined,address" CC=clang CXX=clang++ --disable-opcache-jit' || '' }} + ${{ matrix.asan && 'CFLAGS="-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=undefined,address" CC=clang CXX=clang++' || '' }} skipSlow: ${{ matrix.asan }} - name: make run: make -j$(/usr/bin/nproc) >/dev/null @@ -128,8 +128,17 @@ jobs: testArtifacts: ${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || '' }}_${{ matrix.asan && 'OpCache' || 'Tracing JIT' }} runTestsParameters: >- -d zend_extension=opcache.so + -d opcache.enable=1 -d opcache.enable_cli=1 - ${{ !matrix.asan && '-d opcache.jit_buffer_size=16M' || '' }} + -d opcache.jit_buffer_size=16M + -d opcache.jit_prof_threshold=0.000000001 + -d opcache.jit_max_root_traces=10000000 + -d opcache.jit_max_side_traces=10000000 + -d opcache.jit_max_exit_counters=1000000 + -d opcache.jit_hot_loop=1 + -d opcache.jit_hot_func=1 + -d opcache.jit_hot_return=1 + -d opcache.jit_hot_side_exit=1 ${{ matrix.asan && '--asan -x' || '' }} - name: Verify generated files are up to date if: ${{ !matrix.asan }} @@ -162,9 +171,18 @@ jobs: testArtifacts: ${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} Tracing JIT runTestsParameters: >- -d zend_extension=opcache.so + -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=16M + -d opcache.jit_prof_threshold=0.000000001 + -d opcache.jit_max_root_traces=10000000 + -d opcache.jit_max_side_traces=10000000 + -d opcache.jit_max_exit_counters=1000000 + -d opcache.jit_hot_loop=1 + -d opcache.jit_hot_func=1 + -d opcache.jit_hot_return=1 + -d opcache.jit_hot_side_exit=1 - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files WINDOWS: From 4e504e1ef5d2043b8b08546f5b321672ab874c31 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 20 Sep 2023 16:04:56 +0200 Subject: [PATCH 02/29] Revert some changes --- .github/workflows/push.yml | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index a83f2fba19bb9..51751c1fc52d8 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -108,7 +108,7 @@ jobs: configurationParameters: >- --${{ matrix.debug && 'enable' || 'disable' }}-debug --${{ matrix.zts && 'enable' || 'disable' }}-zts - ${{ matrix.asan && 'CFLAGS="-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=undefined,address" CC=clang CXX=clang++' || '' }} + ${{ matrix.asan && 'CFLAGS="-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=undefined,address" CC=clang CXX=clang++ --disable-opcache-jit' || '' }} skipSlow: ${{ matrix.asan }} - name: make run: make -j$(/usr/bin/nproc) >/dev/null @@ -128,17 +128,8 @@ jobs: testArtifacts: ${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || '' }}_${{ matrix.asan && 'OpCache' || 'Tracing JIT' }} runTestsParameters: >- -d zend_extension=opcache.so - -d opcache.enable=1 -d opcache.enable_cli=1 - -d opcache.jit_buffer_size=16M - -d opcache.jit_prof_threshold=0.000000001 - -d opcache.jit_max_root_traces=10000000 - -d opcache.jit_max_side_traces=10000000 - -d opcache.jit_max_exit_counters=1000000 - -d opcache.jit_hot_loop=1 - -d opcache.jit_hot_func=1 - -d opcache.jit_hot_return=1 - -d opcache.jit_hot_side_exit=1 + ${{ !matrix.asan && '-d opcache.jit_buffer_size=16M' || '' }} ${{ matrix.asan && '--asan -x' || '' }} - name: Verify generated files are up to date if: ${{ !matrix.asan }} @@ -171,18 +162,9 @@ jobs: testArtifacts: ${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} Tracing JIT runTestsParameters: >- -d zend_extension=opcache.so - -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=16M - -d opcache.jit_prof_threshold=0.000000001 - -d opcache.jit_max_root_traces=10000000 - -d opcache.jit_max_side_traces=10000000 - -d opcache.jit_max_exit_counters=1000000 - -d opcache.jit_hot_loop=1 - -d opcache.jit_hot_func=1 - -d opcache.jit_hot_return=1 - -d opcache.jit_hot_side_exit=1 - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files WINDOWS: From 2c965c1af6c841d096dae4a39236ef31ee3ffa3b Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 20 Sep 2023 19:59:28 +0200 Subject: [PATCH 03/29] Fix --- .github/workflows/nightly.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index a5ed885f4073a..3f63b14eb62f1 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -106,7 +106,6 @@ jobs: runTestsParameters: >- ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so - -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.jit_buffer_size=16M -d opcache.jit_prof_threshold=0.000000001 @@ -124,7 +123,6 @@ jobs: runTestsParameters: >- ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so - -d opcache.enable=1 -d opcache.enable_cli=1 - name: Test Function JIT # ASAN frequently timeouts. Each test run takes ~90 minutes, we can @@ -136,7 +134,6 @@ jobs: runTestsParameters: >- ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so - -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.jit_buffer_size=16M -d opcache.jit=1205 @@ -208,7 +205,6 @@ jobs: runTestsParameters: >- ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so - -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.jit_buffer_size=16M -d opcache.jit_prof_threshold=0.000000001 @@ -225,7 +221,6 @@ jobs: runTestsParameters: >- ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so - -d opcache.enable=1 -d opcache.enable_cli=1 - name: Test Function JIT uses: ./.github/actions/test-linux @@ -233,7 +228,6 @@ jobs: runTestsParameters: >- ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so - -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.jit_buffer_size=16M -d opcache.jit=1205 @@ -282,7 +276,6 @@ jobs: testArtifacts: ${{ matrix.branch.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} Tracing JIT runTestsParameters: >- -d zend_extension=opcache.so - -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=16M @@ -300,7 +293,6 @@ jobs: testArtifacts: ${{ matrix.branch.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} OpCache runTestsParameters: >- -d zend_extension=opcache.so - -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 - name: Test Function JIT @@ -309,7 +301,6 @@ jobs: testArtifacts: ${{ matrix.branch.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} Function JIT runTestsParameters: >- -d zend_extension=opcache.so - -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=16M @@ -356,7 +347,6 @@ jobs: with: runTestsParameters: >- -d zend_extension=opcache.so - -d opcache.enable=1 -d opcache.enable_cli=1 - name: Upload Test Coverage to Codecov.io if: always() @@ -406,7 +396,6 @@ jobs: - name: Enable Opcache and JIT run: | echo zend_extension=opcache.so > /etc/php.d/opcache.ini - echo opcache.enable=1 >> /etc/php.d/opcache.ini echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini echo opcache.jit_buffer_size=1G >> /etc/php.d/opcache.ini @@ -588,7 +577,6 @@ jobs: with: runTestsParameters: >- -d zend_extension=opcache.so - -d opcache.enable=1 -d opcache.enable_cli=1 --file-cache-prime - name: Test File Cache (prime shm, use shm) @@ -596,7 +584,6 @@ jobs: with: runTestsParameters: >- -d zend_extension=opcache.so - -d opcache.enable=1 -d opcache.enable_cli=1 --file-cache-use - name: Test File Cache (prime shm, use file) @@ -604,7 +591,6 @@ jobs: with: runTestsParameters: >- -d zend_extension=opcache.so - -d opcache.enable=1 -d opcache.enable_cli=1 --file-cache-use -d opcache.file_cache_only=1 @@ -613,7 +599,6 @@ jobs: with: runTestsParameters: >- -d zend_extension=opcache.so - -d opcache.enable=1 -d opcache.enable_cli=1 --file-cache-prime -d opcache.file_cache_only=1 @@ -622,7 +607,6 @@ jobs: with: runTestsParameters: >- -d zend_extension=opcache.so - -d opcache.enable=1 -d opcache.enable_cli=1 --file-cache-use -d opcache.file_cache_only=1 @@ -723,7 +707,6 @@ jobs: runTestsParameters: >- --msan -d zend_extension=opcache.so - -d opcache.enable=1 -d opcache.enable_cli=1 - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files From ca533912b90b359de864686b9a6704a6c79b2b41 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 20 Sep 2023 20:24:35 +0200 Subject: [PATCH 04/29] Increase JIT buffer size since Psalm get dangerously close to the 16M limit --- .github/scripts/windows/test_task.bat | 2 +- .github/workflows/nightly.yml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/scripts/windows/test_task.bat b/.github/scripts/windows/test_task.bat index c65c33c938e45..7b83719a4aec9 100644 --- a/.github/scripts/windows/test_task.bat +++ b/.github/scripts/windows/test_task.bat @@ -86,7 +86,7 @@ set OPENSSL_CONF= rem set SSLEAY_CONF= rem prepare for OPcache -if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=16M +if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=64M -d opcache.jit_prof_threshold=0.000000001 -d opcache.jit_max_root_traces=10000000 -d opcache.jit_max_side_traces=10000000 -d opcache.jit_max_exit_counters=1000000 -d opcache.jit_hot_loop=1 -d opcache.jit_hot_func=1 -d opcache.jit_hot_return=1 -d opcache.jit_hot_side_exit=1 rem work-around for failing to dl(mysqli) with OPcache (https://github.com/php/php-src/issues/8508) if "%OPCACHE%" equ "1" set OPCACHE_OPTS=%OPCACHE_OPTS% -d extension=mysqli diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 3f63b14eb62f1..3500bc0387eea 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -107,7 +107,7 @@ jobs: ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit_buffer_size=16M + -d opcache.jit_buffer_size=64M -d opcache.jit_prof_threshold=0.000000001 -d opcache.jit_max_root_traces=10000000 -d opcache.jit_max_side_traces=10000000 @@ -135,7 +135,7 @@ jobs: ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit_buffer_size=16M + -d opcache.jit_buffer_size=64M -d opcache.jit=1205 - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files @@ -206,7 +206,7 @@ jobs: ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit_buffer_size=16M + -d opcache.jit_buffer_size=64M -d opcache.jit_prof_threshold=0.000000001 -d opcache.jit_max_root_traces=10000000 -d opcache.jit_max_side_traces=10000000 @@ -229,7 +229,7 @@ jobs: ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit_buffer_size=16M + -d opcache.jit_buffer_size=64M -d opcache.jit=1205 - name: Notify Slack if: failure() @@ -278,7 +278,7 @@ jobs: -d zend_extension=opcache.so -d opcache.enable_cli=1 -d opcache.protect_memory=1 - -d opcache.jit_buffer_size=16M + -d opcache.jit_buffer_size=64M -d opcache.jit_prof_threshold=0.000000001 -d opcache.jit_max_root_traces=10000000 -d opcache.jit_max_side_traces=10000000 @@ -303,7 +303,7 @@ jobs: -d zend_extension=opcache.so -d opcache.enable_cli=1 -d opcache.protect_memory=1 - -d opcache.jit_buffer_size=16M + -d opcache.jit_buffer_size=64M -d opcache.jit=1205 - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files From 88cf39580c49a92efefabeff19efc1887a2fe73a Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 20 Sep 2023 20:24:50 +0200 Subject: [PATCH 05/29] Add test for https://github.com/php/php-src/issues/11917 --- tests/basic/bug11917.phpt | 58 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 tests/basic/bug11917.phpt diff --git a/tests/basic/bug11917.phpt b/tests/basic/bug11917.phpt new file mode 100644 index 0000000000000..e5f56866e4986 --- /dev/null +++ b/tests/basic/bug11917.phpt @@ -0,0 +1,58 @@ +--TEST-- +Bug #11917 (primitives seem to be passed via reference instead of by value under some conditions when JIT is enabled on windows) +--FILE-- +>= $split; + if (!$overflow) { + $remaining -= $split; + $overflow = $split <= $remaining ? 0 : $split - $remaining; + + if (!$remaining) { + $i++; + $remaining = 31; + $overflow = 0; + } + } elseif (++$i != $len) { + $tempmask = (1 << $overflow) - 1; + $digit |= ($val[$i] & $tempmask) << $remaining; + $val[$i] >>= $overflow; + $remaining = 31 - $overflow; + $overflow = $split <= $remaining ? 0 : $split - $remaining; + } + + $vals[] = $digit; + } + + while ($vals[count($vals) - 1] == 0) { + unset($vals[count($vals) - 1]); + } + + return array_reverse($vals); +} +?> +--EXPECT-- +48207660 +48207660 +48207660 +48207660 From b3a2b3e1b9a79707795537c69ede44273eb35c52 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 20 Sep 2023 20:25:47 +0200 Subject: [PATCH 06/29] Remove jit_prof_threshold --- .github/scripts/windows/test_task.bat | 2 +- .github/workflows/nightly.yml | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/scripts/windows/test_task.bat b/.github/scripts/windows/test_task.bat index 7b83719a4aec9..ad6efb542de30 100644 --- a/.github/scripts/windows/test_task.bat +++ b/.github/scripts/windows/test_task.bat @@ -86,7 +86,7 @@ set OPENSSL_CONF= rem set SSLEAY_CONF= rem prepare for OPcache -if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=64M -d opcache.jit_prof_threshold=0.000000001 -d opcache.jit_max_root_traces=10000000 -d opcache.jit_max_side_traces=10000000 -d opcache.jit_max_exit_counters=1000000 -d opcache.jit_hot_loop=1 -d opcache.jit_hot_func=1 -d opcache.jit_hot_return=1 -d opcache.jit_hot_side_exit=1 +if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=64M -d opcache.jit_max_root_traces=10000000 -d opcache.jit_max_side_traces=10000000 -d opcache.jit_max_exit_counters=1000000 -d opcache.jit_hot_loop=1 -d opcache.jit_hot_func=1 -d opcache.jit_hot_return=1 -d opcache.jit_hot_side_exit=1 rem work-around for failing to dl(mysqli) with OPcache (https://github.com/php/php-src/issues/8508) if "%OPCACHE%" equ "1" set OPCACHE_OPTS=%OPCACHE_OPTS% -d extension=mysqli diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 3500bc0387eea..e744e4fb58254 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -108,7 +108,6 @@ jobs: -d zend_extension=opcache.so -d opcache.enable_cli=1 -d opcache.jit_buffer_size=64M - -d opcache.jit_prof_threshold=0.000000001 -d opcache.jit_max_root_traces=10000000 -d opcache.jit_max_side_traces=10000000 -d opcache.jit_max_exit_counters=1000000 @@ -207,7 +206,6 @@ jobs: -d zend_extension=opcache.so -d opcache.enable_cli=1 -d opcache.jit_buffer_size=64M - -d opcache.jit_prof_threshold=0.000000001 -d opcache.jit_max_root_traces=10000000 -d opcache.jit_max_side_traces=10000000 -d opcache.jit_max_exit_counters=1000000 @@ -279,7 +277,6 @@ jobs: -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=64M - -d opcache.jit_prof_threshold=0.000000001 -d opcache.jit_max_root_traces=10000000 -d opcache.jit_max_side_traces=10000000 -d opcache.jit_max_exit_counters=1000000 From a979682ff52a8d3a35e0e1cd077d0c28c3120201 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 20 Sep 2023 20:32:17 +0200 Subject: [PATCH 07/29] Run opcache tests with JIT on windows --- .github/scripts/windows/test_task.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/windows/test_task.bat b/.github/scripts/windows/test_task.bat index ad6efb542de30..369e5f0c0f7db 100644 --- a/.github/scripts/windows/test_task.bat +++ b/.github/scripts/windows/test_task.bat @@ -86,7 +86,7 @@ set OPENSSL_CONF= rem set SSLEAY_CONF= rem prepare for OPcache -if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=64M -d opcache.jit_max_root_traces=10000000 -d opcache.jit_max_side_traces=10000000 -d opcache.jit_max_exit_counters=1000000 -d opcache.jit_hot_loop=1 -d opcache.jit_hot_func=1 -d opcache.jit_hot_return=1 -d opcache.jit_hot_side_exit=1 +if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=64M -d opcache.jit_max_root_traces=10000000 -d opcache.jit_max_side_traces=10000000 -d opcache.jit_max_exit_counters=1000000 -d opcache.jit_hot_loop=1 -d opcache.jit_hot_func=1 -d opcache.jit_hot_return=1 -d opcache.jit_hot_side_exit=1 -d opcache.jit=tracing rem work-around for failing to dl(mysqli) with OPcache (https://github.com/php/php-src/issues/8508) if "%OPCACHE%" equ "1" set OPCACHE_OPTS=%OPCACHE_OPTS% -d extension=mysqli From 94714eb82467d261d8af7d0400a0080429a0b933 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 20 Sep 2023 20:50:00 +0200 Subject: [PATCH 08/29] Unify JIT settings and explicitly disable JIT where needed --- .github/actions/test-linux/action.yml | 9 +++++ .github/workflows/nightly.yml | 49 +++++++++------------------ .github/workflows/push.yml | 2 +- 3 files changed, 26 insertions(+), 34 deletions(-) diff --git a/.github/actions/test-linux/action.yml b/.github/actions/test-linux/action.yml index 7657ff8c85ad2..5cbdda32f2ece 100644 --- a/.github/actions/test-linux/action.yml +++ b/.github/actions/test-linux/action.yml @@ -38,6 +38,15 @@ runs: export TEST_PHP_JUNIT=junit.out.xml export STACK_LIMIT_DEFAULTS_CHECK=1 sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \ + -d opcache.protect_memory=1 \ + -d opcache.jit_buffer_size=64M \ + -d opcache.jit_max_root_traces=10000000 \ + -d opcache.jit_max_side_traces=10000000 \ + -d opcache.jit_max_exit_counters=1000000 \ + -d opcache.jit_hot_loop=1 \ + -d opcache.jit_hot_func=1 \ + -d opcache.jit_hot_return=1 \ + -d opcache.jit_hot_side_exit=1 \ -j$(/usr/bin/nproc) \ -g FAIL,BORK,LEAK,XLEAK \ --no-progress \ diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index e744e4fb58254..4b46e3d0a12a5 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -107,14 +107,7 @@ jobs: ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit_buffer_size=64M - -d opcache.jit_max_root_traces=10000000 - -d opcache.jit_max_side_traces=10000000 - -d opcache.jit_max_exit_counters=1000000 - -d opcache.jit_hot_loop=1 - -d opcache.jit_hot_func=1 - -d opcache.jit_hot_return=1 - -d opcache.jit_hot_side_exit=1 + -d opcache.jit=tracing - name: Test OpCache uses: ./.github/actions/test-linux with: @@ -123,6 +116,7 @@ jobs: ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so -d opcache.enable_cli=1 + -d opcache.jit=disable - name: Test Function JIT # ASAN frequently timeouts. Each test run takes ~90 minutes, we can # avoid running into the 6 hour timeout by skipping the function JIT. @@ -134,8 +128,7 @@ jobs: ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit_buffer_size=64M - -d opcache.jit=1205 + -d opcache.jit=function - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files - name: Notify Slack @@ -205,14 +198,7 @@ jobs: ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit_buffer_size=64M - -d opcache.jit_max_root_traces=10000000 - -d opcache.jit_max_side_traces=10000000 - -d opcache.jit_max_exit_counters=1000000 - -d opcache.jit_hot_loop=1 - -d opcache.jit_hot_func=1 - -d opcache.jit_hot_return=1 - -d opcache.jit_hot_side_exit=1 + -d opcache.jit=tracing - name: Test OpCache uses: ./.github/actions/test-linux with: @@ -220,6 +206,7 @@ jobs: ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so -d opcache.enable_cli=1 + -d opcache.jit=disable - name: Test Function JIT uses: ./.github/actions/test-linux with: @@ -227,8 +214,7 @@ jobs: ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit_buffer_size=64M - -d opcache.jit=1205 + -d opcache.jit=function - name: Notify Slack if: failure() uses: ./.github/actions/notify-slack @@ -275,15 +261,7 @@ jobs: runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.protect_memory=1 - -d opcache.jit_buffer_size=64M - -d opcache.jit_max_root_traces=10000000 - -d opcache.jit_max_side_traces=10000000 - -d opcache.jit_max_exit_counters=1000000 - -d opcache.jit_hot_loop=1 - -d opcache.jit_hot_func=1 - -d opcache.jit_hot_return=1 - -d opcache.jit_hot_side_exit=1 + -d opcache.jit=tracing - name: Test OpCache uses: ./.github/actions/test-macos with: @@ -291,7 +269,7 @@ jobs: runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.protect_memory=1 + -d opcache.jit=disable - name: Test Function JIT uses: ./.github/actions/test-macos with: @@ -299,9 +277,7 @@ jobs: runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.protect_memory=1 - -d opcache.jit_buffer_size=64M - -d opcache.jit=1205 + -d opcache.jit=function - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files - name: Notify Slack @@ -345,6 +321,7 @@ jobs: runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 + -d opcache.jit=tracing - name: Upload Test Coverage to Codecov.io if: always() run: bash <(curl -s https://codecov.io/bash) @@ -575,6 +552,7 @@ jobs: runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 + -d opcache.jit=disable --file-cache-prime - name: Test File Cache (prime shm, use shm) uses: ./.github/actions/test-linux @@ -582,6 +560,7 @@ jobs: runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 + -d opcache.jit=disable --file-cache-use - name: Test File Cache (prime shm, use file) uses: ./.github/actions/test-linux @@ -589,6 +568,7 @@ jobs: runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 + -d opcache.jit=disable --file-cache-use -d opcache.file_cache_only=1 - name: Test File Cache Only (prime) @@ -597,6 +577,7 @@ jobs: runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 + -d opcache.jit=disable --file-cache-prime -d opcache.file_cache_only=1 - name: Test File Cache Only (use) @@ -605,6 +586,7 @@ jobs: runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 + -d opcache.jit=disable --file-cache-use -d opcache.file_cache_only=1 - name: Verify generated files are up to date @@ -705,6 +687,7 @@ jobs: --msan -d zend_extension=opcache.so -d opcache.enable_cli=1 + -d opcache.jit=disable - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files - name: Notify Slack diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 51751c1fc52d8..c760daa9677e5 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -129,7 +129,7 @@ jobs: runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - ${{ !matrix.asan && '-d opcache.jit_buffer_size=16M' || '' }} + ${{ !matrix.asan && '-d opcache.jit=tracing' || '' }} ${{ matrix.asan && '--asan -x' || '' }} - name: Verify generated files are up to date if: ${{ !matrix.asan }} From f397961f462a3967b9b200584e65657d8bf403d9 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 20 Sep 2023 21:02:03 +0200 Subject: [PATCH 09/29] Move new JIT test, fixup mac OS builds too --- .github/actions/test-macos/action.yml | 9 +++++++++ .github/workflows/push.yml | 3 +-- .../basic => ext/opcache/tests/jit}/bug11917.phpt | 15 +++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) rename {tests/basic => ext/opcache/tests/jit}/bug11917.phpt (81%) diff --git a/.github/actions/test-macos/action.yml b/.github/actions/test-macos/action.yml index 8284b8905ef74..9cdc3f8f5e5ad 100644 --- a/.github/actions/test-macos/action.yml +++ b/.github/actions/test-macos/action.yml @@ -17,6 +17,15 @@ runs: export TEST_PHP_JUNIT=junit.out.xml export STACK_LIMIT_DEFAULTS_CHECK=1 sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \ + -d opcache.protect_memory=1 \ + -d opcache.jit_buffer_size=64M \ + -d opcache.jit_max_root_traces=10000000 \ + -d opcache.jit_max_side_traces=10000000 \ + -d opcache.jit_max_exit_counters=1000000 \ + -d opcache.jit_hot_loop=1 \ + -d opcache.jit_hot_func=1 \ + -d opcache.jit_hot_return=1 \ + -d opcache.jit_hot_side_exit=1 \ -j$(sysctl -n hw.ncpu) \ -g FAIL,BORK,LEAK,XLEAK \ --no-progress \ diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index c760daa9677e5..0c86cf1b5f6e6 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -163,8 +163,7 @@ jobs: runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.protect_memory=1 - -d opcache.jit_buffer_size=16M + -d opcache.jit=tracing - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files WINDOWS: diff --git a/tests/basic/bug11917.phpt b/ext/opcache/tests/jit/bug11917.phpt similarity index 81% rename from tests/basic/bug11917.phpt rename to ext/opcache/tests/jit/bug11917.phpt index e5f56866e4986..c2ece52d09141 100644 --- a/tests/basic/bug11917.phpt +++ b/ext/opcache/tests/jit/bug11917.phpt @@ -1,5 +1,20 @@ --TEST-- Bug #11917 (primitives seem to be passed via reference instead of by value under some conditions when JIT is enabled on windows) +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.protect_memory=1 +opcache.jit_buffer_size=64M +opcache.jit=1255 +opcache.jit_max_root_traces=10000000 +opcache.jit_max_side_traces=10000000 +opcache.jit_max_exit_counters=1000000 +opcache.jit_hot_loop=1 +opcache.jit_hot_func=1 +opcache.jit_hot_return=1 +opcache.jit_hot_side_exit=1 +--EXTENSIONS-- +opcache --FILE-- Date: Wed, 20 Sep 2023 21:15:41 +0200 Subject: [PATCH 10/29] Explicitly disable JIT for ASAN builds --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 0c86cf1b5f6e6..b8c0a87931233 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -129,7 +129,7 @@ jobs: runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - ${{ !matrix.asan && '-d opcache.jit=tracing' || '' }} + ${{ matrix.asan && '-d opcache.jit=disable' || '-d opcache.jit=tracing' }} ${{ matrix.asan && '--asan -x' || '' }} - name: Verify generated files are up to date if: ${{ !matrix.asan }} From 8c92c0ec05b11b12d1a305f33bc136a8b670c67b Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 20 Sep 2023 21:30:05 +0200 Subject: [PATCH 11/29] Remove mistakenly added additional 0 --- .github/actions/test-linux/action.yml | 4 ++-- .github/actions/test-macos/action.yml | 4 ++-- .github/scripts/windows/test_task.bat | 2 +- .github/workflows/nightly.yml | 4 ++-- ext/opcache/tests/jit/bug11917.phpt | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/actions/test-linux/action.yml b/.github/actions/test-linux/action.yml index 5cbdda32f2ece..d53446db5ee3b 100644 --- a/.github/actions/test-linux/action.yml +++ b/.github/actions/test-linux/action.yml @@ -40,8 +40,8 @@ runs: sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \ -d opcache.protect_memory=1 \ -d opcache.jit_buffer_size=64M \ - -d opcache.jit_max_root_traces=10000000 \ - -d opcache.jit_max_side_traces=10000000 \ + -d opcache.jit_max_root_traces=1000000 \ + -d opcache.jit_max_side_traces=1000000 \ -d opcache.jit_max_exit_counters=1000000 \ -d opcache.jit_hot_loop=1 \ -d opcache.jit_hot_func=1 \ diff --git a/.github/actions/test-macos/action.yml b/.github/actions/test-macos/action.yml index 9cdc3f8f5e5ad..9ca91e77831bd 100644 --- a/.github/actions/test-macos/action.yml +++ b/.github/actions/test-macos/action.yml @@ -19,8 +19,8 @@ runs: sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \ -d opcache.protect_memory=1 \ -d opcache.jit_buffer_size=64M \ - -d opcache.jit_max_root_traces=10000000 \ - -d opcache.jit_max_side_traces=10000000 \ + -d opcache.jit_max_root_traces=1000000 \ + -d opcache.jit_max_side_traces=1000000 \ -d opcache.jit_max_exit_counters=1000000 \ -d opcache.jit_hot_loop=1 \ -d opcache.jit_hot_func=1 \ diff --git a/.github/scripts/windows/test_task.bat b/.github/scripts/windows/test_task.bat index 369e5f0c0f7db..6cd4134a12a80 100644 --- a/.github/scripts/windows/test_task.bat +++ b/.github/scripts/windows/test_task.bat @@ -86,7 +86,7 @@ set OPENSSL_CONF= rem set SSLEAY_CONF= rem prepare for OPcache -if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=64M -d opcache.jit_max_root_traces=10000000 -d opcache.jit_max_side_traces=10000000 -d opcache.jit_max_exit_counters=1000000 -d opcache.jit_hot_loop=1 -d opcache.jit_hot_func=1 -d opcache.jit_hot_return=1 -d opcache.jit_hot_side_exit=1 -d opcache.jit=tracing +if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=64M -d opcache.jit_max_root_traces=1000000 -d opcache.jit_max_side_traces=1000000 -d opcache.jit_max_exit_counters=1000000 -d opcache.jit_hot_loop=1 -d opcache.jit_hot_func=1 -d opcache.jit_hot_return=1 -d opcache.jit_hot_side_exit=1 -d opcache.jit=tracing rem work-around for failing to dl(mysqli) with OPcache (https://github.com/php/php-src/issues/8508) if "%OPCACHE%" equ "1" set OPCACHE_OPTS=%OPCACHE_OPTS% -d extension=mysqli diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 4b46e3d0a12a5..9fdeec5e573cd 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -374,8 +374,8 @@ jobs: echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini echo opcache.jit_buffer_size=1G >> /etc/php.d/opcache.ini echo opcache.jit_prof_threshold=0.000000001 >> /etc/php.d/opcache.ini - echo opcache.jit_max_root_traces=10000000 >> /etc/php.d/opcache.ini - echo opcache.jit_max_side_traces=10000000 >> /etc/php.d/opcache.ini + echo opcache.jit_max_root_traces=1000000 >> /etc/php.d/opcache.ini + echo opcache.jit_max_side_traces=1000000 >> /etc/php.d/opcache.ini echo opcache.jit_max_exit_counters=1000000 >> /etc/php.d/opcache.ini echo opcache.jit_hot_loop=1 >> /etc/php.d/opcache.ini echo opcache.jit_hot_func=1 >> /etc/php.d/opcache.ini diff --git a/ext/opcache/tests/jit/bug11917.phpt b/ext/opcache/tests/jit/bug11917.phpt index c2ece52d09141..637f7261cbc43 100644 --- a/ext/opcache/tests/jit/bug11917.phpt +++ b/ext/opcache/tests/jit/bug11917.phpt @@ -6,8 +6,8 @@ opcache.enable_cli=1 opcache.protect_memory=1 opcache.jit_buffer_size=64M opcache.jit=1255 -opcache.jit_max_root_traces=10000000 -opcache.jit_max_side_traces=10000000 +opcache.jit_max_root_traces=1000000 +opcache.jit_max_side_traces=1000000 opcache.jit_max_exit_counters=1000000 opcache.jit_hot_loop=1 opcache.jit_hot_func=1 From 87019697c3454911160a99b943f196a1d39ffc91 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 20 Sep 2023 22:15:23 +0200 Subject: [PATCH 12/29] Add phpseclib, psalm, phpstan nightly JIT+ASAN tests --- .github/workflows/nightly.yml | 72 +++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 9fdeec5e573cd..abffccd3dd537 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -381,6 +381,78 @@ jobs: echo opcache.jit_hot_func=1 >> /etc/php.d/opcache.ini echo opcache.jit_hot_return=1 >> /etc/php.d/opcache.ini echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini + - name: Test PHPSeclib (fixed commit for JIT) + if: always() + run: | + git clone https://github.com/phpseclib/phpseclib --branch=master + cd phpseclib + git checkout e840f7a6018172c48601316aa111546132ec653e + export ASAN_OPTIONS=exitcode=139 + export PHPSECLIB_ALLOW_JIT=1 + php /usr/bin/composer install --no-progress --ignore-platform-reqs + php vendor/bin/phpunit --configuration=tests/phpunit.xml || exit $? + - name: Test PHPSeclib (latest commit for ASAN) + if: always() + run: | + git clone https://github.com/phpseclib/phpseclib --branch=master --depth 1 + cd phpseclib + git rev-parse HEAD + export ASAN_OPTIONS=exitcode=139 + export PHPSECLIB_ALLOW_JIT=1 + php /usr/bin/composer install --no-progress --ignore-platform-reqs + php vendor/bin/phpunit --configuration=tests/phpunit.xml || EXIT_CODE=$? + if [ ${EXIT_CODE:-0} -gt 128 ]; then + exit 1 + fi + - name: Test Psalm (fixed commit for JIT) + if: always() + run: | + git clone https://github.com/vimeo/psalm --branch=master + cd psalm + git checkout 7428e49b115a2a837aa29cf0fafd0ca902fe2457 + export ASAN_OPTIONS=exitcode=139 + export PSALM_ALLOW_XDEBUG=1 + php /usr/bin/composer install --no-progress --ignore-platform-reqs + php ./psalm --no-cache --threads=1 || EXIT_CODE=$? + if [ ${EXIT_CODE:-0} -gt 128 ]; then + exit 1 + fi + - name: Test Psalm (latest commit for ASAN) + if: always() + run: | + git clone https://github.com/vimeo/psalm --branch=master --depth=1 + cd psalm + git rev-parse HEAD + export ASAN_OPTIONS=exitcode=139 + export PSALM_ALLOW_XDEBUG=1 + php /usr/bin/composer install --no-progress --ignore-platform-reqs + php ./psalm --no-cache --threads=1 || EXIT_CODE=$? + if [ ${EXIT_CODE:-0} -gt 128 ]; then + exit 1 + fi + - name: Test PHPStan (fixed commit for JIT) + if: always() + run: | + git clone https://github.com/phpstan/phpstan-src + cd phpstan-src + git checkout 1f608dc6a560f4a5accc854add8e005da0e7ceea + export ASAN_OPTIONS=exitcode=139 + php /usr/bin/composer install --no-progress --ignore-platform-reqs + php bin/phpstan clear-result-cache + php bin/phpstan --debug || exit $? + - name: Test PHPStan (latest commit for ASAN) + if: always() + run: | + git clone https://github.com/phpstan/phpstan-src --depth=1 + cd phpstan-src + git rev-parse HEAD + export ASAN_OPTIONS=exitcode=139 + php /usr/bin/composer install --no-progress --ignore-platform-reqs + php bin/phpstan clear-result-cache + php bin/phpstan --debug || EXIT_CODE=$? + if [ ${EXIT_CODE:-0} -gt 128 ]; then + exit 1 + fi - name: Test AMPHP if: matrix.branch.ref != 'PHP-8.0' run: | From 104f03f95dd3e5adab0125f60424fb0074b86f6e Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 20 Sep 2023 22:33:30 +0200 Subject: [PATCH 13/29] Change config in all other CIs --- .cirrus.yml | 11 +++++++++-- .github/workflows/nightly.yml | 1 - .travis.yml | 10 +++++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index c1b17f3eb4260..c9d6342b50f8a 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -204,7 +204,7 @@ arm_task: sapi/cli/php run-tests.php -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit_buffer_size=16M + -d opcache.jit_buffer_size=64M -d opcache.jit=function -P -q -x -j2 -g FAIL,BORK,LEAK,XLEAK @@ -217,7 +217,14 @@ arm_task: sapi/cli/php run-tests.php -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit_buffer_size=16M + -d opcache.jit_buffer_size=64M + -d opcache.jit_max_root_traces=1000000 + -d opcache.jit_max_side_traces=1000000 + -d opcache.jit_max_exit_counters=1000000 + -d opcache.jit_hot_loop=1 + -d opcache.jit_hot_func=1 + -d opcache.jit_hot_return=1 + -d opcache.jit_hot_side_exit=1 -d opcache.jit=tracing -P -q -x -j2 -g FAIL,BORK,LEAK,XLEAK diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index abffccd3dd537..475afb38ad30b 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -373,7 +373,6 @@ jobs: echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini echo opcache.jit_buffer_size=1G >> /etc/php.d/opcache.ini - echo opcache.jit_prof_threshold=0.000000001 >> /etc/php.d/opcache.ini echo opcache.jit_max_root_traces=1000000 >> /etc/php.d/opcache.ini echo opcache.jit_max_side_traces=1000000 >> /etc/php.d/opcache.ini echo opcache.jit_max_exit_counters=1000000 >> /etc/php.d/opcache.ini diff --git a/.travis.yml b/.travis.yml index cd861303fc3a2..3202e899ea538 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,7 +85,15 @@ before_script: # Run PHPs run-tests.php script: - - travis_wait ./travis/test.sh -d opcache.jit_buffer_size=16M -d opcache.jit=tracing + - travis_wait ./travis/test.sh -d opcache.jit=tracing \ + -d opcache.jit_buffer_size=64M \ + -d opcache.jit_max_root_traces=1000000 \ + -d opcache.jit_max_side_traces=1000000 \ + -d opcache.jit_max_exit_counters=1000000 \ + -d opcache.jit_hot_loop=1 \ + -d opcache.jit_hot_func=1 \ + -d opcache.jit_hot_return=1 \ + -d opcache.jit_hot_side_exit=1 - sapi/cli/php -d extension_dir=`pwd`/modules -r 'dl("zend_test");' after_success: From c5af74534e6cff9aca12e903d844c270a0b35745 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 20 Sep 2023 22:41:35 +0200 Subject: [PATCH 14/29] Change config in all other CIs --- .github/workflows/nightly.yml | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 475afb38ad30b..b818b23a52f79 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -393,12 +393,11 @@ jobs: - name: Test PHPSeclib (latest commit for ASAN) if: always() run: | - git clone https://github.com/phpseclib/phpseclib --branch=master --depth 1 cd phpseclib + git checkout master git rev-parse HEAD export ASAN_OPTIONS=exitcode=139 export PHPSECLIB_ALLOW_JIT=1 - php /usr/bin/composer install --no-progress --ignore-platform-reqs php vendor/bin/phpunit --configuration=tests/phpunit.xml || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 @@ -419,30 +418,19 @@ jobs: - name: Test Psalm (latest commit for ASAN) if: always() run: | - git clone https://github.com/vimeo/psalm --branch=master --depth=1 cd psalm + git checkout master git rev-parse HEAD export ASAN_OPTIONS=exitcode=139 export PSALM_ALLOW_XDEBUG=1 - php /usr/bin/composer install --no-progress --ignore-platform-reqs php ./psalm --no-cache --threads=1 || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 fi - - name: Test PHPStan (fixed commit for JIT) - if: always() - run: | - git clone https://github.com/phpstan/phpstan-src - cd phpstan-src - git checkout 1f608dc6a560f4a5accc854add8e005da0e7ceea - export ASAN_OPTIONS=exitcode=139 - php /usr/bin/composer install --no-progress --ignore-platform-reqs - php bin/phpstan clear-result-cache - php bin/phpstan --debug || exit $? - name: Test PHPStan (latest commit for ASAN) if: always() run: | - git clone https://github.com/phpstan/phpstan-src --depth=1 + git clone https://github.com/phpstan/phpstan-src cd phpstan-src git rev-parse HEAD export ASAN_OPTIONS=exitcode=139 @@ -452,6 +440,14 @@ jobs: if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 fi + - name: Test PHPStan (fixed commit for JIT) + if: always() + run: | + cd phpstan-src + git checkout 1f608dc6a560f4a5accc854add8e005da0e7ceea + export ASAN_OPTIONS=exitcode=139 + php bin/phpstan clear-result-cache + php bin/phpstan --debug || exit $? - name: Test AMPHP if: matrix.branch.ref != 'PHP-8.0' run: | From c30b9b3d3cece3ed3d1c6d1d58632d1171a1a385 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 20 Sep 2023 22:51:40 +0200 Subject: [PATCH 15/29] Fixup config --- .github/workflows/nightly.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index b818b23a52f79..1ae84705cdb4d 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -398,6 +398,7 @@ jobs: git rev-parse HEAD export ASAN_OPTIONS=exitcode=139 export PHPSECLIB_ALLOW_JIT=1 + php /usr/bin/composer install --no-progress --ignore-platform-reqs php vendor/bin/phpunit --configuration=tests/phpunit.xml || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 @@ -421,6 +422,7 @@ jobs: cd psalm git checkout master git rev-parse HEAD + php /usr/bin/composer install --no-progress --ignore-platform-reqs export ASAN_OPTIONS=exitcode=139 export PSALM_ALLOW_XDEBUG=1 php ./psalm --no-cache --threads=1 || EXIT_CODE=$? @@ -434,6 +436,7 @@ jobs: cd phpstan-src git rev-parse HEAD export ASAN_OPTIONS=exitcode=139 + sed 's/80299/89999/g' -i conf/config.neon php /usr/bin/composer install --no-progress --ignore-platform-reqs php bin/phpstan clear-result-cache php bin/phpstan --debug || EXIT_CODE=$? @@ -444,7 +447,10 @@ jobs: if: always() run: | cd phpstan-src + git reset --hard git checkout 1f608dc6a560f4a5accc854add8e005da0e7ceea + sed 's/80299/89999/g' -i conf/config.neon + php /usr/bin/composer install --no-progress --ignore-platform-reqs export ASAN_OPTIONS=exitcode=139 php bin/phpstan clear-result-cache php bin/phpstan --debug || exit $? From e11a67a0d9a53841d6bd0a87ad3132d639272152 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 20 Sep 2023 23:53:35 +0200 Subject: [PATCH 16/29] Improve --- .github/workflows/nightly.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 1ae84705cdb4d..a4405d7486f95 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -380,6 +380,7 @@ jobs: echo opcache.jit_hot_func=1 >> /etc/php.d/opcache.ini echo opcache.jit_hot_return=1 >> /etc/php.d/opcache.ini echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini + php -v - name: Test PHPSeclib (fixed commit for JIT) if: always() run: | @@ -390,6 +391,7 @@ jobs: export PHPSECLIB_ALLOW_JIT=1 php /usr/bin/composer install --no-progress --ignore-platform-reqs php vendor/bin/phpunit --configuration=tests/phpunit.xml || exit $? + git clean -ffdx - name: Test PHPSeclib (latest commit for ASAN) if: always() run: | @@ -416,6 +418,7 @@ jobs: if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 fi + git clean -ffdx - name: Test Psalm (latest commit for ASAN) if: always() run: | @@ -443,11 +446,11 @@ jobs: if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 fi + git clean -ffdx - name: Test PHPStan (fixed commit for JIT) if: always() run: | cd phpstan-src - git reset --hard git checkout 1f608dc6a560f4a5accc854add8e005da0e7ceea sed 's/80299/89999/g' -i conf/config.neon php /usr/bin/composer install --no-progress --ignore-platform-reqs @@ -457,6 +460,11 @@ jobs: - name: Test AMPHP if: matrix.branch.ref != 'PHP-8.0' run: | + git clone https://github.com/amphp/ext-uv --depth 1 + cd ext-uv + phpize && ./configure --enable-debug && make -j$(nproc) && make install + cd .. + echo extension=uv >> /etc/php.d/uv.ini repositories="amp cache dns file http parallel parser pipeline process serialization socket sync websocket-client websocket-server" X=0 for repository in $repositories; do From 665e09cb799ca3596c7ab844100f4358407e03e1 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 21 Sep 2023 10:56:30 +0200 Subject: [PATCH 17/29] Improve tests --- .github/workflows/nightly.yml | 62 ++++++----------------------------- 1 file changed, 10 insertions(+), 52 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index a4405d7486f95..ddd42d82a1fbf 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -381,32 +381,18 @@ jobs: echo opcache.jit_hot_return=1 >> /etc/php.d/opcache.ini echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini php -v - - name: Test PHPSeclib (fixed commit for JIT) + - name: Test PHPSeclib if: always() run: | - git clone https://github.com/phpseclib/phpseclib --branch=master + git clone https://github.com/danog/phpseclib --branch=php-nightly --depth 1 cd phpseclib - git checkout e840f7a6018172c48601316aa111546132ec653e export ASAN_OPTIONS=exitcode=139 export PHPSECLIB_ALLOW_JIT=1 php /usr/bin/composer install --no-progress --ignore-platform-reqs php vendor/bin/phpunit --configuration=tests/phpunit.xml || exit $? git clean -ffdx - - name: Test PHPSeclib (latest commit for ASAN) - if: always() - run: | - cd phpseclib - git checkout master - git rev-parse HEAD - export ASAN_OPTIONS=exitcode=139 - export PHPSECLIB_ALLOW_JIT=1 - php /usr/bin/composer install --no-progress --ignore-platform-reqs - php vendor/bin/phpunit --configuration=tests/phpunit.xml || EXIT_CODE=$? - if [ ${EXIT_CODE:-0} -gt 128 ]; then - exit 1 - fi - - name: Test Psalm (fixed commit for JIT) - if: always() + - name: Test Psalm + if: matrix.branch.ref != 'PHP-8.0' run: | git clone https://github.com/vimeo/psalm --branch=master cd psalm @@ -414,42 +400,12 @@ jobs: export ASAN_OPTIONS=exitcode=139 export PSALM_ALLOW_XDEBUG=1 php /usr/bin/composer install --no-progress --ignore-platform-reqs - php ./psalm --no-cache --threads=1 || EXIT_CODE=$? - if [ ${EXIT_CODE:-0} -gt 128 ]; then - exit 1 - fi - git clean -ffdx - - name: Test Psalm (latest commit for ASAN) - if: always() - run: | - cd psalm - git checkout master - git rev-parse HEAD - php /usr/bin/composer install --no-progress --ignore-platform-reqs - export ASAN_OPTIONS=exitcode=139 - export PSALM_ALLOW_XDEBUG=1 - php ./psalm --no-cache --threads=1 || EXIT_CODE=$? - if [ ${EXIT_CODE:-0} -gt 128 ]; then - exit 1 - fi - - name: Test PHPStan (latest commit for ASAN) - if: always() + php ./psalm --no-cache --threads=1 || exit $? + php ./psalm --no-cache || exit $? + - name: Test PHPStan + if: matrix.branch.ref != 'PHP-8.0' run: | git clone https://github.com/phpstan/phpstan-src - cd phpstan-src - git rev-parse HEAD - export ASAN_OPTIONS=exitcode=139 - sed 's/80299/89999/g' -i conf/config.neon - php /usr/bin/composer install --no-progress --ignore-platform-reqs - php bin/phpstan clear-result-cache - php bin/phpstan --debug || EXIT_CODE=$? - if [ ${EXIT_CODE:-0} -gt 128 ]; then - exit 1 - fi - git clean -ffdx - - name: Test PHPStan (fixed commit for JIT) - if: always() - run: | cd phpstan-src git checkout 1f608dc6a560f4a5accc854add8e005da0e7ceea sed 's/80299/89999/g' -i conf/config.neon @@ -457,6 +413,8 @@ jobs: export ASAN_OPTIONS=exitcode=139 php bin/phpstan clear-result-cache php bin/phpstan --debug || exit $? + php bin/phpstan clear-result-cache + php bin/phpstan || exit $? - name: Test AMPHP if: matrix.branch.ref != 'PHP-8.0' run: | From f822a5628e9a2bfdf0e3ce77f212cc1d3854d197 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 21 Sep 2023 11:50:30 +0200 Subject: [PATCH 18/29] Parallelize --- .github/workflows/nightly.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index ddd42d82a1fbf..5cb29280cd742 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -389,7 +389,7 @@ jobs: export ASAN_OPTIONS=exitcode=139 export PHPSECLIB_ALLOW_JIT=1 php /usr/bin/composer install --no-progress --ignore-platform-reqs - php vendor/bin/phpunit --configuration=tests/phpunit.xml || exit $? + php vendor/bin/paratest --verbose --configuration=tests/phpunit.xml --runner=WrapperRunner || exit $? git clean -ffdx - name: Test Psalm if: matrix.branch.ref != 'PHP-8.0' @@ -400,7 +400,6 @@ jobs: export ASAN_OPTIONS=exitcode=139 export PSALM_ALLOW_XDEBUG=1 php /usr/bin/composer install --no-progress --ignore-platform-reqs - php ./psalm --no-cache --threads=1 || exit $? php ./psalm --no-cache || exit $? - name: Test PHPStan if: matrix.branch.ref != 'PHP-8.0' @@ -412,8 +411,6 @@ jobs: php /usr/bin/composer install --no-progress --ignore-platform-reqs export ASAN_OPTIONS=exitcode=139 php bin/phpstan clear-result-cache - php bin/phpstan --debug || exit $? - php bin/phpstan clear-result-cache php bin/phpstan || exit $? - name: Test AMPHP if: matrix.branch.ref != 'PHP-8.0' From 4aa113f5c84dc1bd691cc3df75319664f5a7bc8f Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 21 Sep 2023 13:18:53 +0200 Subject: [PATCH 19/29] Remove RAM limitations --- .github/workflows/nightly.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 5cb29280cd742..cdcb3603eaa85 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -380,6 +380,7 @@ jobs: echo opcache.jit_hot_func=1 >> /etc/php.d/opcache.ini echo opcache.jit_hot_return=1 >> /etc/php.d/opcache.ini echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini + echo memory_limit=-1 >> /etc/php.d/opcache.ini php -v - name: Test PHPSeclib if: always() From 543b52b34c5b44c9447704e86fcc0697be3122df Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 21 Sep 2023 13:25:54 +0200 Subject: [PATCH 20/29] Update --- .github/workflows/nightly.yml | 48 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index cdcb3603eaa85..2f0f2ecee26f6 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -382,6 +382,30 @@ jobs: echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini echo memory_limit=-1 >> /etc/php.d/opcache.ini php -v + - name: Test AMPHP + if: matrix.branch.ref != 'PHP-8.0' + run: | + git clone https://github.com/amphp/ext-uv --depth 1 + cd ext-uv + phpize && ./configure --enable-debug && make -j$(nproc) && make install + cd .. + echo extension=uv >> /etc/php.d/uv.ini + repositories="amp cache dns file http parallel parser pipeline process serialization socket sync websocket-client websocket-server" + X=0 + for repository in $repositories; do + printf "Testing amp/%s\n" "$repository" + git clone "https://github.com/amphp/$repository.git" "amphp-$repository" --depth 1 + cd "amphp-$repository" + git rev-parse HEAD + php /usr/bin/composer install --no-progress --ignore-platform-reqs + export ASAN_OPTIONS=exitcode=139 + vendor/bin/phpunit || EXIT_CODE=$? + if [ ${EXIT_CODE:-0} -gt 128 ]; then + X=1; + fi + cd .. + done + exit $X - name: Test PHPSeclib if: always() run: | @@ -413,30 +437,6 @@ jobs: export ASAN_OPTIONS=exitcode=139 php bin/phpstan clear-result-cache php bin/phpstan || exit $? - - name: Test AMPHP - if: matrix.branch.ref != 'PHP-8.0' - run: | - git clone https://github.com/amphp/ext-uv --depth 1 - cd ext-uv - phpize && ./configure --enable-debug && make -j$(nproc) && make install - cd .. - echo extension=uv >> /etc/php.d/uv.ini - repositories="amp cache dns file http parallel parser pipeline process serialization socket sync websocket-client websocket-server" - X=0 - for repository in $repositories; do - printf "Testing amp/%s\n" "$repository" - git clone "https://github.com/amphp/$repository.git" "amphp-$repository" --depth 1 - cd "amphp-$repository" - git rev-parse HEAD - php /usr/bin/composer install --no-progress --ignore-platform-reqs - export ASAN_OPTIONS=exitcode=139 - vendor/bin/phpunit || EXIT_CODE=$? - if [ ${EXIT_CODE:-0} -gt 128 ]; then - X=1; - fi - cd .. - done - exit $X - name: Test Laravel if: matrix.branch.ref != 'PHP-8.0' run: | From a06eea99478878fd3a3ad03b0cd83b861daa38c3 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 21 Sep 2023 13:40:32 +0200 Subject: [PATCH 21/29] Fix deps --- .github/workflows/nightly.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 2f0f2ecee26f6..3793db6795236 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -385,6 +385,7 @@ jobs: - name: Test AMPHP if: matrix.branch.ref != 'PHP-8.0' run: | + sudo apt-get update && sudo apt-get install -y libuv1-dev git clone https://github.com/amphp/ext-uv --depth 1 cd ext-uv phpize && ./configure --enable-debug && make -j$(nproc) && make install From 8de706693786c0d6f8d099f91c58d21574d2fd73 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 21 Sep 2023 13:55:01 +0200 Subject: [PATCH 22/29] Fix deps --- .github/workflows/nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 3793db6795236..67c24efa05725 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -388,7 +388,7 @@ jobs: sudo apt-get update && sudo apt-get install -y libuv1-dev git clone https://github.com/amphp/ext-uv --depth 1 cd ext-uv - phpize && ./configure --enable-debug && make -j$(nproc) && make install + phpize && ./configure --enable-debug && make -j$(nproc) && sudo make install cd .. echo extension=uv >> /etc/php.d/uv.ini repositories="amp cache dns file http parallel parser pipeline process serialization socket sync websocket-client websocket-server" From 1a4d450e9850da7a721e403683261b9fb4668eb7 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 21 Sep 2023 15:21:39 +0200 Subject: [PATCH 23/29] Fixup opcache --- .travis.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3202e899ea538..b4bbcc2c70fb6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,15 +85,7 @@ before_script: # Run PHPs run-tests.php script: - - travis_wait ./travis/test.sh -d opcache.jit=tracing \ - -d opcache.jit_buffer_size=64M \ - -d opcache.jit_max_root_traces=1000000 \ - -d opcache.jit_max_side_traces=1000000 \ - -d opcache.jit_max_exit_counters=1000000 \ - -d opcache.jit_hot_loop=1 \ - -d opcache.jit_hot_func=1 \ - -d opcache.jit_hot_return=1 \ - -d opcache.jit_hot_side_exit=1 + - travis_wait ./travis/test.sh -d opcache.jit=tracing -d opcache.jit_buffer_size=64M -d opcache.jit_max_root_traces=1000000 -d opcache.jit_max_side_traces=1000000 -d opcache.jit_max_exit_counters=1000000 -d opcache.jit_hot_loop=1 -d opcache.jit_hot_func=1 -d opcache.jit_hot_return=1 -d opcache.jit_hot_side_exit=1 - sapi/cli/php -d extension_dir=`pwd`/modules -r 'dl("zend_test");' after_success: From 96f7b7451688cccd0c83ccaa0d1a64330d012174 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 21 Sep 2023 15:38:16 +0200 Subject: [PATCH 24/29] Reorder --- .github/workflows/nightly.yml | 50 +++++++++++++++++------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 67c24efa05725..d95a24b7c2f24 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -382,31 +382,6 @@ jobs: echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini echo memory_limit=-1 >> /etc/php.d/opcache.ini php -v - - name: Test AMPHP - if: matrix.branch.ref != 'PHP-8.0' - run: | - sudo apt-get update && sudo apt-get install -y libuv1-dev - git clone https://github.com/amphp/ext-uv --depth 1 - cd ext-uv - phpize && ./configure --enable-debug && make -j$(nproc) && sudo make install - cd .. - echo extension=uv >> /etc/php.d/uv.ini - repositories="amp cache dns file http parallel parser pipeline process serialization socket sync websocket-client websocket-server" - X=0 - for repository in $repositories; do - printf "Testing amp/%s\n" "$repository" - git clone "https://github.com/amphp/$repository.git" "amphp-$repository" --depth 1 - cd "amphp-$repository" - git rev-parse HEAD - php /usr/bin/composer install --no-progress --ignore-platform-reqs - export ASAN_OPTIONS=exitcode=139 - vendor/bin/phpunit || EXIT_CODE=$? - if [ ${EXIT_CODE:-0} -gt 128 ]; then - X=1; - fi - cd .. - done - exit $X - name: Test PHPSeclib if: always() run: | @@ -438,6 +413,31 @@ jobs: export ASAN_OPTIONS=exitcode=139 php bin/phpstan clear-result-cache php bin/phpstan || exit $? + - name: Test AMPHP + if: matrix.branch.ref != 'PHP-8.0' + run: | + sudo apt-get update && sudo apt-get install -y libuv1-dev + git clone https://github.com/amphp/ext-uv --depth 1 + cd ext-uv + phpize && ./configure --enable-debug && make -j$(nproc) && sudo make install + cd .. + echo extension=uv >> /etc/php.d/uv.ini + repositories="amp cache dns file http parallel parser pipeline process serialization socket sync websocket-client websocket-server" + X=0 + for repository in $repositories; do + printf "Testing amp/%s\n" "$repository" + git clone "https://github.com/amphp/$repository.git" "amphp-$repository" --depth 1 + cd "amphp-$repository" + git rev-parse HEAD + php /usr/bin/composer install --no-progress --ignore-platform-reqs + export ASAN_OPTIONS=exitcode=139 + vendor/bin/phpunit || EXIT_CODE=$? + if [ ${EXIT_CODE:-0} -gt 128 ]; then + X=1; + fi + cd .. + done + exit $X - name: Test Laravel if: matrix.branch.ref != 'PHP-8.0' run: | From 84373f0d35bec454bddbb59d8da1122aa1818d0c Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 21 Sep 2023 16:29:39 +0200 Subject: [PATCH 25/29] fix --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b4bbcc2c70fb6..2d7a82f7d88af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,7 +85,7 @@ before_script: # Run PHPs run-tests.php script: - - travis_wait ./travis/test.sh -d opcache.jit=tracing -d opcache.jit_buffer_size=64M -d opcache.jit_max_root_traces=1000000 -d opcache.jit_max_side_traces=1000000 -d opcache.jit_max_exit_counters=1000000 -d opcache.jit_hot_loop=1 -d opcache.jit_hot_func=1 -d opcache.jit_hot_return=1 -d opcache.jit_hot_side_exit=1 + - travis_wait 60 ./travis/test.sh -d opcache.jit=tracing -d opcache.jit_buffer_size=64M -d opcache.jit_max_root_traces=1000000 -d opcache.jit_max_side_traces=1000000 -d opcache.jit_max_exit_counters=1000000 -d opcache.jit_hot_loop=1 -d opcache.jit_hot_func=1 -d opcache.jit_hot_return=1 -d opcache.jit_hot_side_exit=1 - sapi/cli/php -d extension_dir=`pwd`/modules -r 'dl("zend_test");' after_success: From f8375978c66fb9dd9fce662ec8688613e6dd8124 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 22 Sep 2023 09:48:00 +0200 Subject: [PATCH 26/29] Update to upstream phpseclib --- .github/workflows/nightly.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index d95a24b7c2f24..813a071f09084 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -385,8 +385,9 @@ jobs: - name: Test PHPSeclib if: always() run: | - git clone https://github.com/danog/phpseclib --branch=php-nightly --depth 1 + git clone https://github.com/phpseclib/phpseclib --branch=master cd phpseclib + git checkout 259bd9f1e8af11726ed74acf527c2c046549061b export ASAN_OPTIONS=exitcode=139 export PHPSECLIB_ALLOW_JIT=1 php /usr/bin/composer install --no-progress --ignore-platform-reqs From 4caf2d67602347fa7a87082b7c0c042f8792e164 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 22 Sep 2023 12:10:24 +0200 Subject: [PATCH 27/29] Improve workflow --- .github/actions/test-linux/action.yml | 4 ++ .github/workflows/nightly.yml | 23 +++------ .github/workflows/push.yml | 4 +- ext/opcache/tests/jit/bug11917.phpt | 73 --------------------------- 4 files changed, 13 insertions(+), 91 deletions(-) delete mode 100644 ext/opcache/tests/jit/bug11917.phpt diff --git a/.github/actions/test-linux/action.yml b/.github/actions/test-linux/action.yml index d53446db5ee3b..968d04a0c3452 100644 --- a/.github/actions/test-linux/action.yml +++ b/.github/actions/test-linux/action.yml @@ -6,6 +6,9 @@ inputs: runTestsParameters: default: '' required: false + jitType: + default: 'disable' + required: false runs: using: composite steps: @@ -38,6 +41,7 @@ runs: export TEST_PHP_JUNIT=junit.out.xml export STACK_LIMIT_DEFAULTS_CHECK=1 sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \ + -d opcache.jit=${{ inputs.jitType }} \ -d opcache.protect_memory=1 \ -d opcache.jit_buffer_size=64M \ -d opcache.jit_max_root_traces=1000000 \ diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 813a071f09084..275c9119be78d 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -103,11 +103,11 @@ jobs: uses: ./.github/actions/test-linux with: testArtifacts: ${{ matrix.branch.name }}_${{ matrix.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} Tracing JIT + jitType: tracing runTestsParameters: >- ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit=tracing - name: Test OpCache uses: ./.github/actions/test-linux with: @@ -116,7 +116,6 @@ jobs: ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit=disable - name: Test Function JIT # ASAN frequently timeouts. Each test run takes ~90 minutes, we can # avoid running into the 6 hour timeout by skipping the function JIT. @@ -124,11 +123,11 @@ jobs: uses: ./.github/actions/test-linux with: testArtifacts: ${{ matrix.branch.name }}_${{ matrix.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} Function JIT + jitType: function runTestsParameters: >- ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit=function - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files - name: Notify Slack @@ -194,11 +193,11 @@ jobs: - name: Test Tracing JIT uses: ./.github/actions/test-linux with: + jitType: tracing runTestsParameters: >- ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit=tracing - name: Test OpCache uses: ./.github/actions/test-linux with: @@ -206,15 +205,14 @@ jobs: ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit=disable - name: Test Function JIT uses: ./.github/actions/test-linux with: + jitType: function runTestsParameters: >- ${{ matrix.run_tests_parameters }} -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit=function - name: Notify Slack if: failure() uses: ./.github/actions/notify-slack @@ -258,10 +256,10 @@ jobs: uses: ./.github/actions/test-macos with: testArtifacts: ${{ matrix.branch.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} Tracing JIT + jitType: tracing runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit=tracing - name: Test OpCache uses: ./.github/actions/test-macos with: @@ -269,15 +267,14 @@ jobs: runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit=disable - name: Test Function JIT uses: ./.github/actions/test-macos with: testArtifacts: ${{ matrix.branch.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} Function JIT + jitType: function runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit=function - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files - name: Notify Slack @@ -318,10 +315,10 @@ jobs: - name: Test OpCache uses: ./.github/actions/test-linux with: + jitType: tracing runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit=tracing - name: Upload Test Coverage to Codecov.io if: always() run: bash <(curl -s https://codecov.io/bash) @@ -591,7 +588,6 @@ jobs: runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit=disable --file-cache-prime - name: Test File Cache (prime shm, use shm) uses: ./.github/actions/test-linux @@ -599,7 +595,6 @@ jobs: runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit=disable --file-cache-use - name: Test File Cache (prime shm, use file) uses: ./.github/actions/test-linux @@ -607,7 +602,6 @@ jobs: runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit=disable --file-cache-use -d opcache.file_cache_only=1 - name: Test File Cache Only (prime) @@ -616,7 +610,6 @@ jobs: runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit=disable --file-cache-prime -d opcache.file_cache_only=1 - name: Test File Cache Only (use) @@ -625,7 +618,6 @@ jobs: runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit=disable --file-cache-use -d opcache.file_cache_only=1 - name: Verify generated files are up to date @@ -726,7 +718,6 @@ jobs: --msan -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit=disable - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files - name: Notify Slack diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index b8c0a87931233..8db13e0370902 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -126,10 +126,10 @@ jobs: uses: ./.github/actions/test-linux with: testArtifacts: ${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || '' }}_${{ matrix.asan && 'OpCache' || 'Tracing JIT' }} + jitType: ${{ matrix.asan && 'disable' || 'tracing' }} runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - ${{ matrix.asan && '-d opcache.jit=disable' || '-d opcache.jit=tracing' }} ${{ matrix.asan && '--asan -x' || '' }} - name: Verify generated files are up to date if: ${{ !matrix.asan }} @@ -160,10 +160,10 @@ jobs: uses: ./.github/actions/test-macos with: testArtifacts: ${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} Tracing JIT + jitType: tracing runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.jit=tracing - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files WINDOWS: diff --git a/ext/opcache/tests/jit/bug11917.phpt b/ext/opcache/tests/jit/bug11917.phpt deleted file mode 100644 index 637f7261cbc43..0000000000000 --- a/ext/opcache/tests/jit/bug11917.phpt +++ /dev/null @@ -1,73 +0,0 @@ ---TEST-- -Bug #11917 (primitives seem to be passed via reference instead of by value under some conditions when JIT is enabled on windows) ---INI-- -opcache.enable=1 -opcache.enable_cli=1 -opcache.protect_memory=1 -opcache.jit_buffer_size=64M -opcache.jit=1255 -opcache.jit_max_root_traces=1000000 -opcache.jit_max_side_traces=1000000 -opcache.jit_max_exit_counters=1000000 -opcache.jit_hot_loop=1 -opcache.jit_hot_func=1 -opcache.jit_hot_return=1 -opcache.jit_hot_side_exit=1 ---EXTENSIONS-- -opcache ---FILE-- ->= $split; - if (!$overflow) { - $remaining -= $split; - $overflow = $split <= $remaining ? 0 : $split - $remaining; - - if (!$remaining) { - $i++; - $remaining = 31; - $overflow = 0; - } - } elseif (++$i != $len) { - $tempmask = (1 << $overflow) - 1; - $digit |= ($val[$i] & $tempmask) << $remaining; - $val[$i] >>= $overflow; - $remaining = 31 - $overflow; - $overflow = $split <= $remaining ? 0 : $split - $remaining; - } - - $vals[] = $digit; - } - - while ($vals[count($vals) - 1] == 0) { - unset($vals[count($vals) - 1]); - } - - return array_reverse($vals); -} -?> ---EXPECT-- -48207660 -48207660 -48207660 -48207660 From 12281a46dfbd20acedc4d6a09890c90f1b572ec7 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 22 Sep 2023 12:13:25 +0200 Subject: [PATCH 28/29] Remove new tests, move to separate PR --- .github/workflows/nightly.yml | 37 ----------------------------------- 1 file changed, 37 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 275c9119be78d..f769f35fda268 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -379,46 +379,9 @@ jobs: echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini echo memory_limit=-1 >> /etc/php.d/opcache.ini php -v - - name: Test PHPSeclib - if: always() - run: | - git clone https://github.com/phpseclib/phpseclib --branch=master - cd phpseclib - git checkout 259bd9f1e8af11726ed74acf527c2c046549061b - export ASAN_OPTIONS=exitcode=139 - export PHPSECLIB_ALLOW_JIT=1 - php /usr/bin/composer install --no-progress --ignore-platform-reqs - php vendor/bin/paratest --verbose --configuration=tests/phpunit.xml --runner=WrapperRunner || exit $? - git clean -ffdx - - name: Test Psalm - if: matrix.branch.ref != 'PHP-8.0' - run: | - git clone https://github.com/vimeo/psalm --branch=master - cd psalm - git checkout 7428e49b115a2a837aa29cf0fafd0ca902fe2457 - export ASAN_OPTIONS=exitcode=139 - export PSALM_ALLOW_XDEBUG=1 - php /usr/bin/composer install --no-progress --ignore-platform-reqs - php ./psalm --no-cache || exit $? - - name: Test PHPStan - if: matrix.branch.ref != 'PHP-8.0' - run: | - git clone https://github.com/phpstan/phpstan-src - cd phpstan-src - git checkout 1f608dc6a560f4a5accc854add8e005da0e7ceea - sed 's/80299/89999/g' -i conf/config.neon - php /usr/bin/composer install --no-progress --ignore-platform-reqs - export ASAN_OPTIONS=exitcode=139 - php bin/phpstan clear-result-cache - php bin/phpstan || exit $? - name: Test AMPHP if: matrix.branch.ref != 'PHP-8.0' run: | - sudo apt-get update && sudo apt-get install -y libuv1-dev - git clone https://github.com/amphp/ext-uv --depth 1 - cd ext-uv - phpize && ./configure --enable-debug && make -j$(nproc) && sudo make install - cd .. echo extension=uv >> /etc/php.d/uv.ini repositories="amp cache dns file http parallel parser pipeline process serialization socket sync websocket-client websocket-server" X=0 From dbd4005a39d3b99507025f86dc20c40de71afaae Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 3 Oct 2023 10:22:26 +0200 Subject: [PATCH 29/29] Remove stray line --- .github/workflows/nightly.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index f769f35fda268..518543f060a02 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -382,7 +382,6 @@ jobs: - name: Test AMPHP if: matrix.branch.ref != 'PHP-8.0' run: | - echo extension=uv >> /etc/php.d/uv.ini repositories="amp cache dns file http parallel parser pipeline process serialization socket sync websocket-client websocket-server" X=0 for repository in $repositories; do