Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions profiling/src/allocation/allocation_ge84.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use core::{cell::Cell, ptr};
use lazy_static::lazy_static;
use libc::{c_char, c_void, size_t};
use log::{debug, error, trace, warn};
use std::sync::atomic::Ordering::Relaxed;
use std::sync::atomic::Ordering::SeqCst;

#[derive(Copy, Clone)]
Expand Down Expand Up @@ -143,8 +144,11 @@ lazy_static! {
}

pub fn first_rinit_should_disable_due_to_jit() -> bool {
if *JIT_ENABLED && zend::PHP_VERSION_ID >= 80400 {
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");
if *JIT_ENABLED
&& zend::PHP_VERSION_ID >= 80400
&& (80400..80406).contains(&crate::RUNTIME_PHP_VERSION_ID.load(Relaxed))
{
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");
true
} else {
false
Expand Down
4 changes: 3 additions & 1 deletion profiling/tests/phpt/jit_03.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ we make sure to disable allocation profiling when we detect the JIT is enabled.
<?php
if (PHP_VERSION_ID < 80400)
echo "skip: PHP Version < 8.4 are not affected", PHP_EOL;
if (PHP_VERSION_ID >= 80407)
echo "skip: fixed since PHP version 8.4.7", PHP_EOL;
if (!extension_loaded('datadog-profiling'))
echo "skip: test requires datadog-profiling", PHP_EOL;
if (php_uname("s") === "Darwin")
Expand All @@ -27,5 +29,5 @@ opcache.jit_buffer_size=4M
echo "Done.", PHP_EOL;
?>
--EXPECTF--
%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
%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
%ADone.%a
Loading