11--TEST--
2- FPM: OPcache PersistentStatic class blob survives dynamic method statics with JIT enabled across requests
2+ FPM: OPcache PinnedStatic class blob survives dynamic method statics with JIT enabled across requests
33--SKIPIF--
44<?php
55include __DIR__ . '/skipif.inc ' ;
2525
2626$ code = <<<'PHP'
2727<?php
28- function persistent_static_seed (string $logFile): int
28+ function pinned_static_seed (string $logFile): int
2929{
3030 file_put_contents($logFile, "seed\n", FILE_APPEND);
3131 return 1;
3232}
3333
34- function persistent_static_jit_on (): int
34+ function pinned_static_jit_on (): int
3535{
3636 return (int) (opcache_get_status()['jit']['on'] ?? false);
3737}
3838
39- #[OPcache\PersistentStatic ]
39+ #[OPcache\PinnedStatic ]
4040class JitCombinedBlobState
4141{
4242 public static int $count = 0;
4343 public static array $bag = [];
4444
4545 public static function nextValue(string $logFile): int
4646 {
47- static $value = persistent_static_seed ($logFile);
47+ static $value = pinned_static_seed ($logFile);
4848
4949 return ++$value;
5050 }
5151}
5252
5353$request = (int) ($_GET['request'] ?? 1);
54- $logFile = __DIR__ . '/persistent_static_fpm_006 .log';
54+ $logFile = __DIR__ . '/pinned_static_fpm_006 .log';
5555
5656if ($request === 1) {
5757 @unlink($logFile);
@@ -65,12 +65,12 @@ if ($request === 1) {
6565 JitCombinedBlobState::$bag['numbers'][] = 10;
6666 JitCombinedBlobState::$bag['numbers'][] = 11;
6767
68- echo persistent_static_jit_on (), ',', $last, ',', JitCombinedBlobState::$count, ',', array_sum(JitCombinedBlobState::$bag['numbers']), ',', count(file($logFile, FILE_IGNORE_NEW_LINES));
68+ echo pinned_static_jit_on (), ',', $last, ',', JitCombinedBlobState::$count, ',', array_sum(JitCombinedBlobState::$bag['numbers']), ',', count(file($logFile, FILE_IGNORE_NEW_LINES));
6969 return;
7070}
7171
7272if ($request === 2) {
73- echo persistent_static_jit_on (), ',', JitCombinedBlobState::$count, ',', array_sum(JitCombinedBlobState::$bag['numbers']), ',', OPcache\persistent_cache_info ()->entry_count, ',', count(file($logFile, FILE_IGNORE_NEW_LINES)), "\n";
73+ echo pinned_static_jit_on (), ',', JitCombinedBlobState::$count, ',', array_sum(JitCombinedBlobState::$bag['numbers']), ',', OPcache\pinned_cache_info ()->entry_count, ',', count(file($logFile, FILE_IGNORE_NEW_LINES)), "\n";
7474
7575 $last = 0;
7676 for ($i = 0; $i < 4; $i++) {
@@ -83,13 +83,13 @@ if ($request === 2) {
8383 return;
8484}
8585
86- echo persistent_static_jit_on (), ',', JitCombinedBlobState::$count, ',', array_sum(JitCombinedBlobState::$bag['numbers']), ',', OPcache\persistent_cache_info ()->entry_count, ',', count(file($logFile, FILE_IGNORE_NEW_LINES));
86+ echo pinned_static_jit_on (), ',', JitCombinedBlobState::$count, ',', array_sum(JitCombinedBlobState::$bag['numbers']), ',', OPcache\pinned_cache_info ()->entry_count, ',', count(file($logFile, FILE_IGNORE_NEW_LINES));
8787PHP;
8888
8989$ tester = new FPM \Tester ($ cfg , $ code );
9090$ tester ->start (iniEntries: [
9191 'opcache.enable ' => '1 ' ,
92- 'opcache.static_cache.persistent_size_mb ' => '32 ' ,
92+ 'opcache.static_cache.pinned_size_mb ' => '32 ' ,
9393 'opcache.file_update_protection ' => '0 ' ,
9494 'opcache.jit ' => 'tracing ' ,
9595 'opcache.jit_buffer_size ' => '64M ' ,
117117<?php
118118require_once __DIR__ . '/tester.inc ' ;
119119FPM \Tester::clean ();
120- @unlink (__DIR__ . '/persistent_static_fpm_006 .log ' );
120+ @unlink (__DIR__ . '/pinned_static_fpm_006 .log ' );
121121?>
0 commit comments