From d2c3f8900098ba300963223db4876a805ec33c17 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 17 Jan 2024 18:23:17 +0100 Subject: [PATCH] Do not use JIT on windows --- src/Psalm/Internal/Cli/Psalm.php | 3 ++- src/Psalm/Internal/Fork/PsalmRestarter.php | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Psalm/Internal/Cli/Psalm.php b/src/Psalm/Internal/Cli/Psalm.php index 8ca086c47fd..a37cb8a828a 100644 --- a/src/Psalm/Internal/Cli/Psalm.php +++ b/src/Psalm/Internal/Cli/Psalm.php @@ -45,6 +45,7 @@ use function array_values; use function chdir; use function count; +use function defined; use function extension_loaded; use function file_exists; use function file_put_contents; @@ -898,7 +899,7 @@ private static function restart(array $options, int $threads, Progress $progress // If Xdebug is enabled, restart without it $ini_handler->check(); - if (!function_exists('opcache_get_status')) { + if (!function_exists('opcache_get_status') && !defined('PHP_WINDOWS_VERSION_MAJOR')) { $progress->write(PHP_EOL . 'Install the opcache extension to make use of JIT for a 20%+ performance boost!' . PHP_EOL . PHP_EOL); diff --git a/src/Psalm/Internal/Fork/PsalmRestarter.php b/src/Psalm/Internal/Fork/PsalmRestarter.php index e25f5627e78..1550c787e07 100644 --- a/src/Psalm/Internal/Fork/PsalmRestarter.php +++ b/src/Psalm/Internal/Fork/PsalmRestarter.php @@ -10,6 +10,7 @@ use function array_merge; use function array_splice; use function assert; +use function defined; use function extension_loaded; use function file_get_contents; use function file_put_contents; @@ -81,7 +82,7 @@ protected function requiresRestart($default): bool $opcache_loaded = extension_loaded('opcache') || extension_loaded('Zend OPcache'); - if ($opcache_loaded) { + if ($opcache_loaded && !defined('PHP_WINDOWS_VERSION_MAJOR')) { // restart to enable JIT if it's not configured in the optimal way foreach (self::REQUIRED_OPCACHE_SETTINGS as $ini_name => $required_value) { $value = (string) ini_get("opcache.$ini_name"); @@ -155,7 +156,7 @@ protected function restart($command): void // executed in the parent process (before restart) // if it wasn't loaded then we apparently don't have opcache installed and there's no point trying // to tweak it - if ($opcache_loaded) { + if ($opcache_loaded && !defined('PHP_WINDOWS_VERSION_MAJOR')) { $additional_options = []; foreach (self::REQUIRED_OPCACHE_SETTINGS as $key => $value) { $additional_options []= "-dopcache.{$key}={$value}";