From ef6db9fd38378a89ae15ac036f0bb338f7d6f3bb Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 18 Sep 2023 10:34:35 +0200 Subject: [PATCH 01/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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/40] 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 ef71bd578f7483e02fabbab5195d4deb00d27dae Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 22 Sep 2023 12:14:20 +0200 Subject: [PATCH 29/40] Add phpseclib, Psalm, PHPStan, UV+AMP nightly tests --- .github/workflows/nightly.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index f769f35fda268..275c9119be78d 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -379,9 +379,46 @@ 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 2df24e0fac3b82beb76b171ded95fae212cb2b67 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sun, 8 Oct 2023 13:33:12 +0200 Subject: [PATCH 30/40] Tweak flags --- .cirrus.yml | 1 + .github/actions/test-linux/action.yml | 1 + .github/actions/test-macos/action.yml | 1 + .github/scripts/windows/test_task.bat | 2 +- .github/workflows/nightly.yml | 1 + .travis.yml | 2 +- 6 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index c9d6342b50f8a..d333ff2afe8e0 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -225,6 +225,7 @@ arm_task: -d opcache.jit_hot_func=1 -d opcache.jit_hot_return=1 -d opcache.jit_hot_side_exit=1 + -d opcache.file_update_protection=0 -d opcache.jit=tracing -P -q -x -j2 -g FAIL,BORK,LEAK,XLEAK diff --git a/.github/actions/test-linux/action.yml b/.github/actions/test-linux/action.yml index c3c6953692e35..ea14e3fc13c90 100644 --- a/.github/actions/test-linux/action.yml +++ b/.github/actions/test-linux/action.yml @@ -51,6 +51,7 @@ runs: -d opcache.jit_hot_func=1 \ -d opcache.jit_hot_return=1 \ -d opcache.jit_hot_side_exit=1 \ + -d opcache.file_update_protection=0 \ -j$(/usr/bin/nproc) \ -g FAIL,BORK,LEAK,XLEAK \ --no-progress \ diff --git a/.github/actions/test-macos/action.yml b/.github/actions/test-macos/action.yml index c9d403773007c..adaed364967f8 100644 --- a/.github/actions/test-macos/action.yml +++ b/.github/actions/test-macos/action.yml @@ -30,6 +30,7 @@ runs: -d opcache.jit_hot_func=1 \ -d opcache.jit_hot_return=1 \ -d opcache.jit_hot_side_exit=1 \ + -d opcache.file_update_protection=0 \ -j$(sysctl -n hw.ncpu) \ -g FAIL,BORK,LEAK,XLEAK \ --no-progress \ diff --git a/.github/scripts/windows/test_task.bat b/.github/scripts/windows/test_task.bat index 330e2e9c2e57b..6f51d36baa5be 100644 --- a/.github/scripts/windows/test_task.bat +++ b/.github/scripts/windows/test_task.bat @@ -84,7 +84,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=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 +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 -d opcache.file_update_protection=0 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 6d25f032c9e15..12874344494ec 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -387,6 +387,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 opcache.file_update_protection=0 >> /etc/php.d/opcache.ini echo memory_limit=-1 >> /etc/php.d/opcache.ini php -v - name: Test PHPSeclib diff --git a/.travis.yml b/.travis.yml index 2d7a82f7d88af..067c3b6ac43a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,7 +85,7 @@ before_script: # Run PHPs run-tests.php script: - - 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 + - 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 -d opcache.file_update_protection=0 - sapi/cli/php -d extension_dir=`pwd`/modules -r 'dl("zend_test");' after_success: From 7877d96b9e12419c663e4bee6c6edde3b601cbe9 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 9 Oct 2023 12:48:28 +0200 Subject: [PATCH 31/40] Update config --- .cirrus.yml | 3 +++ .github/actions/test-linux/action.yml | 2 ++ .github/actions/test-macos/action.yml | 2 ++ .github/scripts/windows/test_task.bat | 2 +- .github/workflows/nightly.yml | 2 ++ .travis.yml | 2 +- run-tests.php | 2 ++ 7 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index d333ff2afe8e0..1c5ff9f5de479 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -206,6 +206,7 @@ arm_task: -d opcache.enable_cli=1 -d opcache.jit_buffer_size=64M -d opcache.jit=function + -d opcache.file_update_protection=0 -P -q -x -j2 -g FAIL,BORK,LEAK,XLEAK --no-progress @@ -226,6 +227,8 @@ arm_task: -d opcache.jit_hot_return=1 -d opcache.jit_hot_side_exit=1 -d opcache.file_update_protection=0 + -d opcache.jit_blacklist_root_trace=255 + -d opcache.jit_blacklist_side_trace=255 -d opcache.jit=tracing -P -q -x -j2 -g FAIL,BORK,LEAK,XLEAK diff --git a/.github/actions/test-linux/action.yml b/.github/actions/test-linux/action.yml index ea14e3fc13c90..120ac5c3e0c0b 100644 --- a/.github/actions/test-linux/action.yml +++ b/.github/actions/test-linux/action.yml @@ -51,6 +51,8 @@ runs: -d opcache.jit_hot_func=1 \ -d opcache.jit_hot_return=1 \ -d opcache.jit_hot_side_exit=1 \ + -d opcache.jit_blacklist_root_trace=255 \ + -d opcache.jit_blacklist_side_trace=255 \ -d opcache.file_update_protection=0 \ -j$(/usr/bin/nproc) \ -g FAIL,BORK,LEAK,XLEAK \ diff --git a/.github/actions/test-macos/action.yml b/.github/actions/test-macos/action.yml index adaed364967f8..77bb9a0c68818 100644 --- a/.github/actions/test-macos/action.yml +++ b/.github/actions/test-macos/action.yml @@ -30,6 +30,8 @@ runs: -d opcache.jit_hot_func=1 \ -d opcache.jit_hot_return=1 \ -d opcache.jit_hot_side_exit=1 \ + -d opcache.jit_blacklist_root_trace=255 \ + -d opcache.jit_blacklist_side_trace=255 \ -d opcache.file_update_protection=0 \ -j$(sysctl -n hw.ncpu) \ -g FAIL,BORK,LEAK,XLEAK \ diff --git a/.github/scripts/windows/test_task.bat b/.github/scripts/windows/test_task.bat index 6f51d36baa5be..6c8eea2751a28 100644 --- a/.github/scripts/windows/test_task.bat +++ b/.github/scripts/windows/test_task.bat @@ -84,7 +84,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=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 -d opcache.file_update_protection=0 +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 -d opcache.file_update_protection=0 -d opcache.jit_blacklist_root_trace=255 -d opcache.jit_blacklist_side_trace=255 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 12874344494ec..df1d8357b06b2 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -387,6 +387,8 @@ 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 opcache.jit_blacklist_root_trace=255 >> /etc/php.d/opcache.ini + echo opcache.jit_blacklist_side_trace=255 >> /etc/php.d/opcache.ini echo opcache.file_update_protection=0 >> /etc/php.d/opcache.ini echo memory_limit=-1 >> /etc/php.d/opcache.ini php -v diff --git a/.travis.yml b/.travis.yml index 067c3b6ac43a4..f2e29b89812c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,7 +85,7 @@ before_script: # Run PHPs run-tests.php script: - - 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 -d opcache.file_update_protection=0 + - 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 -d opcache.file_update_protection=0 -d opcache.jit_blacklist_root_trace=255 -d opcache.jit_blacklist_side_trace=255 - sapi/cli/php -d extension_dir=`pwd`/modules -r 'dl("zend_test");' after_success: diff --git a/run-tests.php b/run-tests.php index e12912ca4aa71..f2d526cbdf470 100755 --- a/run-tests.php +++ b/run-tests.php @@ -306,6 +306,8 @@ function main(): void 'opcache.jit_hot_func=1', 'opcache.jit_hot_return=1', 'opcache.jit_hot_side_exit=1', + 'opcache.jit_blacklist_root_trace=255', + 'opcache.jit_blacklist_side_trace=255', 'zend.assertions=1', 'zend.exception_ignore_args=0', 'zend.exception_string_param_max_len=15', From e62d3d9939c666c5a45ae17ce5d4f90d29c73856 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 10 Oct 2023 11:53:40 +0200 Subject: [PATCH 32/40] Update config --- .github/workflows/nightly.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index df1d8357b06b2..4450669315f7c 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -390,6 +390,8 @@ jobs: echo opcache.jit_blacklist_root_trace=255 >> /etc/php.d/opcache.ini echo opcache.jit_blacklist_side_trace=255 >> /etc/php.d/opcache.ini echo opcache.file_update_protection=0 >> /etc/php.d/opcache.ini + echo opcache.memory_consumption=2G >> /etc/php.d/opcache.ini + echo opcache.max_accelerated_files=1000000 >> /etc/php.d/opcache.ini echo memory_limit=-1 >> /etc/php.d/opcache.ini php -v - name: Test PHPSeclib @@ -402,7 +404,6 @@ jobs: 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: | @@ -410,16 +411,18 @@ jobs: cd psalm git checkout 7428e49b115a2a837aa29cf0fafd0ca902fe2457 export ASAN_OPTIONS=exitcode=139 + # Needed to avoid overwriting JIT config export PSALM_ALLOW_XDEBUG=1 php /usr/bin/composer install --no-progress --ignore-platform-reqs + php ../.github/patch.php ./psalm 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 + git checkout d02cc99d4480a203a2dbe54a5ded2da016266b11 + sed 's/80399/89999/g' -i conf/parametersSchema.neon php /usr/bin/composer install --no-progress --ignore-platform-reqs export ASAN_OPTIONS=exitcode=139 php bin/phpstan clear-result-cache @@ -427,12 +430,6 @@ 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) && 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 @@ -442,6 +439,7 @@ jobs: git rev-parse HEAD php /usr/bin/composer install --no-progress --ignore-platform-reqs export ASAN_OPTIONS=exitcode=139 + php ../.github/patch.php vendor/bin/phpunit vendor/bin/phpunit || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then X=1; @@ -459,6 +457,7 @@ jobs: # Hack to disable a test that hangs php -r '$c = file_get_contents("tests/Filesystem/FilesystemTest.php"); $c = str_replace("*/\n public function testSharedGet()", "* @group skip\n */\n public function testSharedGet()", $c); file_put_contents("tests/Filesystem/FilesystemTest.php", $c);' export ASAN_OPTIONS=exitcode=139 + php ../.github/patch.php vendor/bin/phpunit php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 @@ -475,6 +474,7 @@ jobs: git rev-parse HEAD php /usr/bin/composer install --no-progress --ignore-platform-reqs export ASAN_OPTIONS=exitcode=139 + php ../.github/patch.php vendor/bin/phpunit vendor/bin/phpunit || EXIT_CODE=$? if [ $[EXIT_CODE:-0} -gt 128 ]; then X=1; @@ -490,6 +490,7 @@ jobs: git rev-parse HEAD php /usr/bin/composer install --no-progress --ignore-platform-reqs export ASAN_OPTIONS=exitcode=139 + php ../.github/patch.php vendor/bin/phpunit vendor/bin/phpunit || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 @@ -508,8 +509,10 @@ jobs: php -r '$c = file_get_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php"); $c = str_replace("*/\n public function testCastNonTrailingCharPointer()", "* @group skip\n */\n public function testCastNonTrailingCharPointer()", $c); file_put_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php", $c);' export ASAN_OPTIONS=exitcode=139 export SYMFONY_DEPRECATIONS_HELPER=max[total]=999 + PATCH_PATH=$(realpath ../.github/patch.php) X=0 for component in $(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n'); do + php $PATCH_PATH vendor/bin/phpunit php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient --exclude-group skip || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then X=1; @@ -524,6 +527,7 @@ jobs: git rev-parse HEAD export ASAN_OPTIONS=exitcode=139 php /usr/bin/composer install --no-progress --ignore-platform-reqs + php ../.github/patch.php ./phpunit php ./phpunit || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 @@ -548,6 +552,7 @@ jobs: sed -i 's/youremptytestdbnamehere/test/g' wp-tests-config.php sed -i 's/yourusernamehere/root/g' wp-tests-config.php sed -i 's/yourpasswordhere/root/g' wp-tests-config.php + php ../.github/patch.php vendor/bin/phpunit php vendor/bin/phpunit || EXIT_CODE=$? if [ $EXIT_CODE -gt 128 ]; then exit 1 From 39e6c89fc93f842e691db42648c70002da04ca0a Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 10 Oct 2023 11:56:57 +0200 Subject: [PATCH 33/40] Add patch script --- .github/patch.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/patch.php diff --git a/.github/patch.php b/.github/patch.php new file mode 100644 index 0000000000000..f071c7c53f59d --- /dev/null +++ b/.github/patch.php @@ -0,0 +1,28 @@ + Date: Tue, 10 Oct 2023 12:29:42 +0200 Subject: [PATCH 34/40] Fix --- .github/workflows/nightly.yml | 37 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 4450669315f7c..c028a3d75095e 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -394,16 +394,6 @@ jobs: echo opcache.max_accelerated_files=1000000 >> /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 $? - name: Test Psalm if: matrix.branch.ref != 'PHP-8.0' run: | @@ -414,7 +404,7 @@ jobs: # Needed to avoid overwriting JIT config export PSALM_ALLOW_XDEBUG=1 php /usr/bin/composer install --no-progress --ignore-platform-reqs - php ../.github/patch.php ./psalm + php $GITHUB_WORKSPACE/.github/patch.php ./psalm php ./psalm --no-cache || exit $? - name: Test PHPStan if: matrix.branch.ref != 'PHP-8.0' @@ -439,7 +429,7 @@ jobs: git rev-parse HEAD php /usr/bin/composer install --no-progress --ignore-platform-reqs export ASAN_OPTIONS=exitcode=139 - php ../.github/patch.php vendor/bin/phpunit + php $GITHUB_WORKSPACE/.github/patch.php vendor/bin/phpunit vendor/bin/phpunit || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then X=1; @@ -457,7 +447,7 @@ jobs: # Hack to disable a test that hangs php -r '$c = file_get_contents("tests/Filesystem/FilesystemTest.php"); $c = str_replace("*/\n public function testSharedGet()", "* @group skip\n */\n public function testSharedGet()", $c); file_put_contents("tests/Filesystem/FilesystemTest.php", $c);' export ASAN_OPTIONS=exitcode=139 - php ../.github/patch.php vendor/bin/phpunit + php $GITHUB_WORKSPACE/.github/patch.php vendor/bin/phpunit php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 @@ -474,7 +464,7 @@ jobs: git rev-parse HEAD php /usr/bin/composer install --no-progress --ignore-platform-reqs export ASAN_OPTIONS=exitcode=139 - php ../.github/patch.php vendor/bin/phpunit + php $GITHUB_WORKSPACE/.github/patch.php vendor/bin/phpunit vendor/bin/phpunit || EXIT_CODE=$? if [ $[EXIT_CODE:-0} -gt 128 ]; then X=1; @@ -490,7 +480,7 @@ jobs: git rev-parse HEAD php /usr/bin/composer install --no-progress --ignore-platform-reqs export ASAN_OPTIONS=exitcode=139 - php ../.github/patch.php vendor/bin/phpunit + php $GITHUB_WORKSPACE/.github/patch.php vendor/bin/phpunit vendor/bin/phpunit || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 @@ -509,16 +499,25 @@ jobs: php -r '$c = file_get_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php"); $c = str_replace("*/\n public function testCastNonTrailingCharPointer()", "* @group skip\n */\n public function testCastNonTrailingCharPointer()", $c); file_put_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php", $c);' export ASAN_OPTIONS=exitcode=139 export SYMFONY_DEPRECATIONS_HELPER=max[total]=999 - PATCH_PATH=$(realpath ../.github/patch.php) X=0 for component in $(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n'); do - php $PATCH_PATH vendor/bin/phpunit + php $GITHUB_WORKSPACE/.github/patch.php vendor/bin/phpunit php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient --exclude-group skip || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then X=1; fi done exit $X + - 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 $? - name: Test PHPUnit if: always() run: | @@ -527,7 +526,7 @@ jobs: git rev-parse HEAD export ASAN_OPTIONS=exitcode=139 php /usr/bin/composer install --no-progress --ignore-platform-reqs - php ../.github/patch.php ./phpunit + php $GITHUB_WORKSPACE/.github/patch.php ./phpunit php ./phpunit || EXIT_CODE=$? if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 @@ -552,7 +551,7 @@ jobs: sed -i 's/youremptytestdbnamehere/test/g' wp-tests-config.php sed -i 's/yourusernamehere/root/g' wp-tests-config.php sed -i 's/yourpasswordhere/root/g' wp-tests-config.php - php ../.github/patch.php vendor/bin/phpunit + php $GITHUB_WORKSPACE/.github/patch.php vendor/bin/phpunit php vendor/bin/phpunit || EXIT_CODE=$? if [ $EXIT_CODE -gt 128 ]; then exit 1 From a336ed7a827606ab87137a7d9cc3a661bc53e77a Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 10 Oct 2023 13:36:28 +0200 Subject: [PATCH 35/40] Fixup --- .github/patch.php | 11 ++++------- .github/workflows/nightly.yml | 24 ++++++++---------------- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/.github/patch.php b/.github/patch.php index f071c7c53f59d..f4ec3cac68353 100644 --- a/.github/patch.php +++ b/.github/patch.php @@ -1,7 +1,5 @@ Date: Tue, 10 Oct 2023 14:14:24 +0200 Subject: [PATCH 36/40] Fixes --- .github/patch.php | 2 +- .github/workflows/nightly.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/patch.php b/.github/patch.php index f4ec3cac68353..2ac5da522e9f5 100644 --- a/.github/patch.php +++ b/.github/patch.php @@ -1,7 +1,7 @@ Date: Tue, 10 Oct 2023 15:04:42 +0200 Subject: [PATCH 37/40] Fixup --- .github/patch.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/patch.php b/.github/patch.php index 2ac5da522e9f5..aee9289492c19 100644 --- a/.github/patch.php +++ b/.github/patch.php @@ -4,22 +4,34 @@ $status = opcache_get_status(false); var_dump($status); + $ok = true; if ($status["memory_usage"]["free_memory"] < 10*1024) { echo "Not enough free opcache memory!".PHP_EOL; - die(130); + $ok = false; } if ($status["interned_strings_usage"]["free_memory"] < 1*1024) { echo "Not enough free interned strings memory!".PHP_EOL; - die(130); + $ok = false; } if ($status["jit"]["buffer_free"] < 10*1024) { echo "Not enough free JIT memory!".PHP_EOL; - die(130); + $ok = false; + } + if (!$status["jit"]["on"]) { + echo "JIT is not enabled!".PHP_EOL; + $ok = false; } unset($status); - gc_collect_cycles(); + + if (!$ok) die(130); }); -require $argv[1]; +$argc--; +array_shift($argv); + +$_SERVER['argc']--; +array_shift($_SERVER['argv']); + +require $argv[0]; From ab27c26634854dac9fb8c190650938933f61ae3a Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 10 Oct 2023 15:11:44 +0200 Subject: [PATCH 38/40] Improve limits --- .github/patch.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/patch.php b/.github/patch.php index aee9289492c19..3c76dd1a9649b 100644 --- a/.github/patch.php +++ b/.github/patch.php @@ -5,15 +5,15 @@ var_dump($status); $ok = true; - if ($status["memory_usage"]["free_memory"] < 10*1024) { + if ($status["memory_usage"]["free_memory"] < 10*1024*1024) { echo "Not enough free opcache memory!".PHP_EOL; $ok = false; } - if ($status["interned_strings_usage"]["free_memory"] < 1*1024) { + if ($status["interned_strings_usage"]["free_memory"] < 1*1024*1024) { echo "Not enough free interned strings memory!".PHP_EOL; $ok = false; } - if ($status["jit"]["buffer_free"] < 10*1024) { + if ($status["jit"]["buffer_free"] < 10*1024*1024) { echo "Not enough free JIT memory!".PHP_EOL; $ok = false; } From b474ce3b77dd57c1784a76ecb81fee88ff098bf0 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 10 Oct 2023 17:07:59 +0200 Subject: [PATCH 39/40] Fixup counters --- .cirrus.yml | 6 +++--- .github/actions/test-linux/action.yml | 6 +++--- .github/actions/test-macos/action.yml | 6 +++--- .github/scripts/windows/test_task.bat | 2 +- .github/workflows/nightly.yml | 8 ++++---- .travis.yml | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 1c5ff9f5de479..13b9f33ea44e3 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -219,9 +219,9 @@ arm_task: -d zend_extension=opcache.so -d opcache.enable_cli=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_max_root_traces=100000 + -d opcache.jit_max_side_traces=100000 + -d opcache.jit_max_exit_counters=100000 -d opcache.jit_hot_loop=1 -d opcache.jit_hot_func=1 -d opcache.jit_hot_return=1 diff --git a/.github/actions/test-linux/action.yml b/.github/actions/test-linux/action.yml index 120ac5c3e0c0b..3e4e5864aef5c 100644 --- a/.github/actions/test-linux/action.yml +++ b/.github/actions/test-linux/action.yml @@ -44,9 +44,9 @@ runs: -d opcache.jit=${{ inputs.jitType }} \ -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_max_root_traces=100000 \ + -d opcache.jit_max_side_traces=100000 \ + -d opcache.jit_max_exit_counters=100000 \ -d opcache.jit_hot_loop=1 \ -d opcache.jit_hot_func=1 \ -d opcache.jit_hot_return=1 \ diff --git a/.github/actions/test-macos/action.yml b/.github/actions/test-macos/action.yml index 77bb9a0c68818..577af5b3bd31a 100644 --- a/.github/actions/test-macos/action.yml +++ b/.github/actions/test-macos/action.yml @@ -23,9 +23,9 @@ runs: -d opcache.jit=${{ inputs.jitType }} \ -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_max_root_traces=100000 \ + -d opcache.jit_max_side_traces=100000 \ + -d opcache.jit_max_exit_counters=100000 \ -d opcache.jit_hot_loop=1 \ -d opcache.jit_hot_func=1 \ -d opcache.jit_hot_return=1 \ diff --git a/.github/scripts/windows/test_task.bat b/.github/scripts/windows/test_task.bat index 467b381e6a4c6..494259998e317 100644 --- a/.github/scripts/windows/test_task.bat +++ b/.github/scripts/windows/test_task.bat @@ -83,7 +83,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=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 -d opcache.file_update_protection=0 -d opcache.jit_blacklist_root_trace=255 -d opcache.jit_blacklist_side_trace=255 +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=100000 -d opcache.jit_max_side_traces=100000 -d opcache.jit_max_exit_counters=100000 -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 -d opcache.file_update_protection=0 -d opcache.jit_blacklist_root_trace=255 -d opcache.jit_blacklist_side_trace=255 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 9bbc82c25679a..bb497ac749d3e 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -380,9 +380,9 @@ 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_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_max_root_traces=100000 >> /etc/php.d/opcache.ini + echo opcache.jit_max_side_traces=100000 >> /etc/php.d/opcache.ini + echo opcache.jit_max_exit_counters=100000 >> /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 @@ -391,7 +391,7 @@ jobs: echo opcache.jit_blacklist_side_trace=255 >> /etc/php.d/opcache.ini echo opcache.file_update_protection=0 >> /etc/php.d/opcache.ini echo opcache.memory_consumption=2G >> /etc/php.d/opcache.ini - echo opcache.max_accelerated_files=1000000 >> /etc/php.d/opcache.ini + echo opcache.max_accelerated_files=100000 >> /etc/php.d/opcache.ini echo memory_limit=-1 >> /etc/php.d/opcache.ini php -v - name: Test Psalm diff --git a/.travis.yml b/.travis.yml index f2e29b89812c0..4f95bea8bca03 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,7 +85,7 @@ before_script: # Run PHPs run-tests.php script: - - 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 -d opcache.file_update_protection=0 -d opcache.jit_blacklist_root_trace=255 -d opcache.jit_blacklist_side_trace=255 + - travis_wait 60 ./travis/test.sh -d opcache.jit=tracing -d opcache.jit_buffer_size=64M -d opcache.jit_max_root_traces=100000 -d opcache.jit_max_side_traces=100000 -d opcache.jit_max_exit_counters=100000 -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.file_update_protection=0 -d opcache.jit_blacklist_root_trace=255 -d opcache.jit_blacklist_side_trace=255 - sapi/cli/php -d extension_dir=`pwd`/modules -r 'dl("zend_test");' after_success: From a76d75f849caa03a689cb38e515b8f601bfb4e09 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 10 Oct 2023 17:55:03 +0200 Subject: [PATCH 40/40] Increase interned strings buffer size --- .github/workflows/nightly.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index bb497ac749d3e..f2cfa36158e72 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -391,6 +391,7 @@ jobs: echo opcache.jit_blacklist_side_trace=255 >> /etc/php.d/opcache.ini echo opcache.file_update_protection=0 >> /etc/php.d/opcache.ini echo opcache.memory_consumption=2G >> /etc/php.d/opcache.ini + echo opcache.interned_strings_buffer=64 >> /etc/php.d/opcache.ini echo opcache.max_accelerated_files=100000 >> /etc/php.d/opcache.ini echo memory_limit=-1 >> /etc/php.d/opcache.ini php -v