@@ -1640,8 +1640,14 @@ static size_t tsrm_tls_offset;
1640
1640
1641
1641
#if defined (__CET__) && (__CET__ & 1) != 0
1642
1642
# define ENDBR_PADDING 4
1643
+ /* Keep 16 exit points in a single code block */
1644
+ # define ZEND_JIT_EXIT_POINTS_SPACING 8 // endbr + push byte + short jmp = bytes
1645
+ # define ZEND_JIT_EXIT_POINTS_PER_GROUP 16 // number of continuous exit points
1643
1646
#else
1644
1647
# define ENDBR_PADDING 0
1648
+ /* Keep 32 exit points in a single code block */
1649
+ # define ZEND_JIT_EXIT_POINTS_SPACING 4 // push byte + short jmp = bytes
1650
+ # define ZEND_JIT_EXIT_POINTS_PER_GROUP 32 // number of continuous exit points
1645
1651
#endif
1646
1652
1647
1653
static bool reuse_ip = 0;
@@ -2605,18 +2611,16 @@ static int zend_jit_trace_escape_stub(dasm_State **Dst)
2605
2611
return 1;
2606
2612
}
2607
2613
2608
- /* Keep 32 exit points in a single code block */
2609
- #define ZEND_JIT_EXIT_POINTS_SPACING 4 // push byte + short jmp = bytes
2610
- #define ZEND_JIT_EXIT_POINTS_PER_GROUP 32 // number of continuous exit points
2611
-
2612
2614
static int zend_jit_trace_exit_group_stub(dasm_State **Dst, uint32_t n)
2613
2615
{
2614
2616
uint32_t i;
2615
2617
2616
2618
for (i = 0; i < ZEND_JIT_EXIT_POINTS_PER_GROUP - 1; i++) {
2619
+ | ENDBR
2617
2620
| push byte i
2618
- | .byte 0xeb, (4 *(ZEND_JIT_EXIT_POINTS_PER_GROUP-i)-6 ) // jmp >1
2621
+ | .byte 0xeb, (ZEND_JIT_EXIT_POINTS_SPACING *(ZEND_JIT_EXIT_POINTS_PER_GROUP-i)-ZEND_JIT_EXIT_POINTS_SPACING -2 ) // jmp >1
2619
2622
}
2623
+ | ENDBR
2620
2624
| push byte i
2621
2625
|// 1:
2622
2626
| add aword [r4], n
@@ -3126,6 +3130,7 @@ static int zend_jit_set_ip(dasm_State **Dst, const zend_op *opline)
3126
3130
3127
3131
static int zend_jit_set_ip_ex(dasm_State **Dst, const zend_op *opline, bool set_ip_reg)
3128
3132
{
3133
+ | ENDBR
3129
3134
if (last_valid_opline == opline) {
3130
3135
zend_jit_use_last_valid_opline();
3131
3136
} else if (GCC_GLOBAL_REGS && last_valid_opline) {
@@ -3214,6 +3219,7 @@ static int zend_jit_check_exception_undef_result(dasm_State **Dst, const zend_op
3214
3219
3215
3220
static int zend_jit_trace_begin(dasm_State **Dst, uint32_t trace_num, zend_jit_trace_info *parent, uint32_t exit_num)
3216
3221
{
3222
+ | ENDBR
3217
3223
zend_regset regset = ZEND_REGSET_SCRATCH;
3218
3224
3219
3225
#if ZTS
@@ -15026,13 +15032,15 @@ static int zend_jit_switch(dasm_State **Dst, const zend_op *opline, const zend_o
15026
15032
} while (count);
15027
15033
|.code
15028
15034
|3:
15035
+ | ENDBR
15029
15036
} else {
15030
15037
| LOAD_ADDR FCARG1a, jumptable
15031
15038
| EXT_CALL zend_hash_index_find, r0
15032
15039
if (!zend_jit_hash_jmp(Dst, opline, op_array, ssa, jumptable, default_b, default_label, next_opline, trace_info)) {
15033
15040
return 0;
15034
15041
}
15035
15042
|3:
15043
+ | ENDBR
15036
15044
}
15037
15045
}
15038
15046
} else if (opline->opcode == ZEND_SWITCH_STRING) {
@@ -15074,6 +15082,7 @@ static int zend_jit_switch(dasm_State **Dst, const zend_op *opline, const zend_o
15074
15082
return 0;
15075
15083
}
15076
15084
|3:
15085
+ | ENDBR
15077
15086
}
15078
15087
} else if (opline->opcode == ZEND_MATCH) {
15079
15088
if (op1_info & (MAY_BE_LONG|MAY_BE_STRING)) {
0 commit comments