Skip to content

Commit e06d45d

Browse files
feat(profiling) re-enable allocation profiling with JIT for PHP 8.4.7 (#3277)
1 parent 781ccd6 commit e06d45d

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

profiling/src/allocation/allocation_ge84.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use core::{cell::Cell, ptr};
77
use lazy_static::lazy_static;
88
use libc::{c_char, c_void, size_t};
99
use log::{debug, error, trace, warn};
10+
use std::sync::atomic::Ordering::Relaxed;
1011
use std::sync::atomic::Ordering::SeqCst;
1112

1213
#[derive(Copy, Clone)]
@@ -143,8 +144,11 @@ lazy_static! {
143144
}
144145

145146
pub fn first_rinit_should_disable_due_to_jit() -> bool {
146-
if *JIT_ENABLED && zend::PHP_VERSION_ID >= 80400 {
147-
error!("Memory allocation profiling will be disabled as long as JIT is active. To enable allocation profiling disable JIT. See https://github.com/DataDog/dd-trace-php/pull/3199");
147+
if *JIT_ENABLED
148+
&& zend::PHP_VERSION_ID >= 80400
149+
&& (80400..80406).contains(&crate::RUNTIME_PHP_VERSION_ID.load(Relaxed))
150+
{
151+
error!("Memory allocation profiling will be disabled as long as JIT is active. To enable allocation profiling disable JIT or upgrade PHP to at least version 8.4.7. See https://github.com/DataDog/dd-trace-php/pull/3199");
148152
true
149153
} else {
150154
false

profiling/tests/phpt/jit_03.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ we make sure to disable allocation profiling when we detect the JIT is enabled.
88
<?php
99
if (PHP_VERSION_ID < 80400)
1010
echo "skip: PHP Version < 8.4 are not affected", PHP_EOL;
11+
if (PHP_VERSION_ID >= 80407)
12+
echo "skip: fixed since PHP version 8.4.7", PHP_EOL;
1113
if (!extension_loaded('datadog-profiling'))
1214
echo "skip: test requires datadog-profiling", PHP_EOL;
1315
if (php_uname("s") === "Darwin")
@@ -27,5 +29,5 @@ opcache.jit_buffer_size=4M
2729
echo "Done.", PHP_EOL;
2830
?>
2931
--EXPECTF--
30-
%aMemory allocation profiling will be disabled as long as JIT is active. To enable allocation profiling disable JIT. See https://github.com/DataDog/dd-trace-php/pull/3199
32+
%aMemory allocation profiling will be disabled as long as JIT is active. To enable allocation profiling disable JIT or upgrade PHP to at least version 8.4.7. See https://github.com/DataDog/dd-trace-php/pull/3199
3133
%ADone.%a

0 commit comments

Comments
 (0)