@@ -162,6 +162,7 @@ static void ir_refs_add(ir_refs *refs, ir_ref ref)
162
162
static size_t zend_jit_trace_prologue_size = (size_t)-1;
163
163
#if defined(IR_TARGET_X86) || defined(IR_TARGET_X64)
164
164
static uint32_t allowed_opt_flags = 0;
165
+ static uint32_t default_mflags = 0;
165
166
#endif
166
167
static bool delayed_call_chain = 0; // TODO: remove this var (use jit->delayed_call_level) ???
167
168
@@ -2609,6 +2610,7 @@ static void zend_jit_init_ctx(zend_jit_ctx *jit, uint32_t flags)
2609
2610
jit->ctx.ret_type = -1;
2610
2611
2611
2612
#if defined(IR_TARGET_X86) || defined(IR_TARGET_X64)
2613
+ jit->ctx.mflags |= default_mflags;
2612
2614
if (JIT_G(opt_flags) & allowed_opt_flags & ZEND_JIT_CPU_AVX) {
2613
2615
jit->ctx.mflags |= IR_X86_AVX;
2614
2616
}
@@ -3154,6 +3156,9 @@ static void zend_jit_setup(void)
3154
3156
if (zend_cpu_supports_avx()) {
3155
3157
allowed_opt_flags |= ZEND_JIT_CPU_AVX;
3156
3158
}
3159
+ if (zend_cpu_supports_cldemote()) {
3160
+ default_mflags |= IR_X86_CLDEMOTE;
3161
+ }
3157
3162
#endif
3158
3163
#ifdef ZTS
3159
3164
#if defined(IR_TARGET_AARCH64)
@@ -15663,6 +15668,10 @@ static void *zend_jit_finish(zend_jit_ctx *jit)
15663
15668
} else if (jit->trace) {
15664
15669
jit->ctx.deoptimization_exits = jit->trace->exit_count;
15665
15670
jit->ctx.get_exit_addr = zend_jit_trace_get_exit_addr;
15671
+ #endif
15672
+ } else {
15673
+ #if defined(IR_TARGET_X86) || defined(IR_TARGET_X64)
15674
+ jit->ctx.flags |= IR_GEN_CACHE_DEMOTE;
15666
15675
#endif
15667
15676
}
15668
15677
@@ -15747,12 +15756,6 @@ static void *zend_jit_finish(zend_jit_ctx *jit)
15747
15756
}
15748
15757
15749
15758
zend_jit_trace_add_code(entry, size);
15750
-
15751
- #if ZEND_JIT_SUPPORT_CLDEMOTE
15752
- if (cpu_support_cldemote) {
15753
- shared_cacheline_demote((uintptr_t)entry, size);
15754
- }
15755
- #endif
15756
15759
}
15757
15760
}
15758
15761
0 commit comments