Commit 3070be2b527 for php

commit 3070be2b527d1065180f871018188aa5474e3c82
Author: Nora Dossche <7771979+ndossche@users.noreply.github.com>
Date:   Sat Oct 10 12:24:29 2026 +0200

    Use ZEND_OPCACHE_SHM_REATTACHMENT more commonly (#24085)

diff --git a/Zend/Optimizer/zend_optimizer.c b/Zend/Optimizer/zend_optimizer.c
index 6d5b5f541a9..db5cd03a4e4 100644
--- a/Zend/Optimizer/zend_optimizer.c
+++ b/Zend/Optimizer/zend_optimizer.c
@@ -108,7 +108,7 @@ zend_result zend_optimizer_eval_special_func_call(

 		if (func && func->type == ZEND_INTERNAL_FUNCTION
 				&& func->module->type == MODULE_PERSISTENT
-#ifdef ZEND_WIN32
+#ifdef ZEND_OPCACHE_SHM_REATTACHMENT
 				&& func->module->handle == NULL
 #endif
 		) {
@@ -129,7 +129,7 @@ zend_result zend_optimizer_eval_special_func_call(
 		}

 		if (m->type == MODULE_PERSISTENT
-#ifdef ZEND_WIN32
+#ifdef ZEND_OPCACHE_SHM_REATTACHMENT
 			&& m->handle == NULL
 #endif
 		) {
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index 22787d6af30..375acc45d6a 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -390,8 +390,8 @@ static void track_class_dependency(zend_class_entry *ce, zend_string *class_name
 		return;
 	}

-#ifndef ZEND_WIN32
-	/* On non-Windows systems, internal classes are always the same,
+#ifndef ZEND_OPCACHE_SHM_REATTACHMENT
+	/* On systems without reattachment, internal classes are always the same,
 	 * so there is no need to explicitly track them. */
 	if (ce->type == ZEND_INTERNAL_CLASS) {
 		return;
@@ -3619,7 +3619,7 @@ ZEND_API zend_class_entry *zend_do_link_class(zend_class_entry *ce, zend_string
 		}
 	}

-#ifndef ZEND_WIN32
+#ifndef ZEND_OPCACHE_SHM_REATTACHMENT
 	if (ce->ce_flags & ZEND_ACC_ENUM) {
 		/* We will add internal methods. */
 		is_cacheable = false;
diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c
index 80d3287a420..e5d26096984 100644
--- a/ext/opcache/jit/zend_jit.c
+++ b/ext/opcache/jit/zend_jit.c
@@ -709,7 +709,7 @@ static bool zend_jit_class_may_be_modified(const zend_class_entry *ce, const zen
 	uint32_t i;

 	if (ce->type == ZEND_INTERNAL_CLASS) {
-#ifdef _WIN32
+#ifdef ZEND_OPCACHE_SHM_REATTACHMENT
 		/* ASLR */
 		return 1;
 #else
@@ -757,7 +757,7 @@ static bool zend_jit_class_may_be_modified(const zend_class_entry *ce, const zen
 static bool zend_jit_may_be_modified(const zend_function *func, const zend_op_array *called_from)
 {
 	if (func->type == ZEND_INTERNAL_FUNCTION) {
-#ifdef _WIN32
+#ifdef ZEND_OPCACHE_SHM_REATTACHMENT
 		/* ASLR */
 		return 1;
 #else
diff --git a/ext/opcache/jit/zend_jit_ir.c b/ext/opcache/jit/zend_jit_ir.c
index c0cc673d25d..eec5434cde7 100644
--- a/ext/opcache/jit/zend_jit_ir.c
+++ b/ext/opcache/jit/zend_jit_ir.c
@@ -8555,7 +8555,7 @@ static int zend_jit_push_call_frame(zend_jit_ctx *jit, const zend_op *opline, co
 			if_enough_stack = ir_IF(ref);
 			ir_IF_FALSE_cold(if_enough_stack);

-#ifdef _WIN32
+#ifdef ZEND_OPCACHE_SHM_REATTACHMENT
 			if (0) {
 #else
 			if (opline->opcode == ZEND_INIT_FCALL && func && func->type == ZEND_INTERNAL_FUNCTION) {
@@ -8604,7 +8604,7 @@ static int zend_jit_push_call_frame(zend_jit_ctx *jit, const zend_op *opline, co
 		// JIT: ZEND_SET_CALL_INFO(call, 0, call_info);
 		ir_STORE(jit_CALL(rx, This.u1.type_info), ir_CONST_U32(IS_UNDEF | ZEND_CALL_NESTED_FUNCTION));
 	}
-#ifdef _WIN32
+#ifdef ZEND_OPCACHE_SHM_REATTACHMENT
 	if (0) {
 #else
 	if (opline->opcode == ZEND_INIT_FCALL && func && func->type == ZEND_INTERNAL_FUNCTION) {
@@ -8741,7 +8741,7 @@ static int zend_jit_func_guard(zend_jit_ctx *jit, ir_ref func_ref, const zend_fu
 				ir_LOAD_A(ir_ADD_OFFSET(func_ref, offsetof(zend_op_array, opcodes))),
 				ir_CONST_ADDR(opcodes)),
 			ir_CONST_ADDR(exit_addr));
-#ifdef ZEND_WIN32
+#ifdef ZEND_OPCACHE_SHM_REATTACHMENT
 	} else if (func->type == ZEND_INTERNAL_FUNCTION) {
 		// ASLR may cause different addresses in different workers. Check for the internal function handler.
 		// JIT: if (call->func.internal_function.handler != handler) goto exit_addr;
@@ -8814,7 +8814,7 @@ static int zend_jit_init_fcall(zend_jit_ctx *jit, const zend_op *opline, uint32_
 	if (!func
 	 && trace
 	 && trace->op == ZEND_JIT_TRACE_INIT_CALL) {
-#ifdef _WIN32
+#ifdef ZEND_OPCACHE_SHM_REATTACHMENT
 		/* ASLR */
 		if (trace->func->type != ZEND_INTERNAL_FUNCTION) {
 			func = (zend_function*)trace->func;
@@ -8824,7 +8824,7 @@ static int zend_jit_init_fcall(zend_jit_ctx *jit, const zend_op *opline, uint32_
 #endif
 	}

-#ifdef _WIN32
+#ifdef ZEND_OPCACHE_SHM_REATTACHMENT
 	if (0) {
 #else
 	if (opline->opcode == ZEND_INIT_FCALL
@@ -10065,7 +10065,7 @@ static int zend_jit_do_fcall(zend_jit_ctx *jit, const zend_op *opline, const zen
 	if (trace && !func) {
 		if (trace->op == ZEND_JIT_TRACE_DO_ICALL) {
 			ZEND_ASSERT(!trace->func || trace->func->type == ZEND_INTERNAL_FUNCTION);
-#ifndef ZEND_WIN32
+#ifndef ZEND_OPCACHE_SHM_REATTACHMENT
 			// TODO: ASLR may cause different addresses in different workers ???
 			func = trace->func;
 			if (JIT_G(current_frame) &&