jit_bugs/bugs/wrap.php

43 lines
967 B
PHP
Raw Normal View History

2023-10-23 23:04:58 +02:00
<?php
2023-11-11 19:04:15 +01:00
$pid = getmypid();
register_shutdown_function(function () use ($pid) {
2023-10-23 23:04:58 +02:00
$status = opcache_get_status(false);
2023-10-24 10:23:08 +02:00
$ok = true;
2023-10-23 23:04:58 +02:00
if ($status["memory_usage"]["free_memory"] < 10*1024*1024) {
echo "Not enough free opcache memory!".PHP_EOL;
2023-10-24 10:23:08 +02:00
$ok = false;
2023-10-23 23:04:58 +02:00
}
if ($status["interned_strings_usage"]["free_memory"] < 1*1024*1024) {
echo "Not enough free interned strings memory!".PHP_EOL;
2023-10-24 10:23:08 +02:00
$ok = false;
2023-10-23 23:04:58 +02:00
}
if ($status["jit"]["buffer_free"] < 10*1024*1024) {
echo "Not enough free JIT memory!".PHP_EOL;
2023-10-24 10:23:08 +02:00
$ok = false;
2023-10-23 23:04:58 +02:00
}
if (!$status["jit"]["on"]) {
echo "JIT is not enabled!".PHP_EOL;
2024-11-19 13:29:53 +01:00
var_dump($status);
2023-10-24 10:23:08 +02:00
$ok = false;
2023-10-23 23:04:58 +02:00
}
unset($status);
2023-11-11 19:04:15 +01:00
while (gc_collect_cycles());
if ($pid === getmypid()) {
`rm -rf /tmp/psalm`;
}
2023-10-24 10:23:08 +02:00
if (!$ok) die(139);
2023-10-23 23:04:58 +02:00
});
$argc--;
array_shift($argv);
$_SERVER['argc']--;
array_shift($_SERVER['argv']);
2023-10-24 10:23:08 +02:00
require $argv[0];