Skip to content

Commit 4f40c20

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Add EG(bailout) consistency assertion Fix faulty zend_try handling in zend_jit_trace()
2 parents b09ac89 + e50cd12 commit 4f40c20

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ PHP NEWS
2222
zend_jit_use_reg). (Arnaud)
2323
. Fixed bug GH-21593 (Borked function JIT JMPNZ smart branch). (ilutov)
2424
. Fixed bug GH-21460 (COND optimization regression). (Dmitry, Arnaud)
25+
. Fixed faulty returns out of zend_try block in zend_jit_trace(). (ilutov)
2526

2627
- OpenSSL:
2728
. Fix memory leak regression in openssl_pbkdf2(). (ndossche)

Zend/zend.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,9 @@ typedef size_t (*zend_write_func_t)(const char *str, size_t str_length);
275275
EG(bailout) = &__bailout; \
276276
if (SETJMP(__bailout)==0) {
277277
#define zend_catch \
278+
ZEND_ASSERT(EG(bailout) == &__bailout); \
278279
} else { \
280+
ZEND_ASSERT(EG(bailout) == &__bailout); \
279281
EG(bailout) = __orig_bailout;
280282
#define zend_end_try() \
281283
} \

ext/opcache/jit/zend_jit_trace.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5203,7 +5203,7 @@ static zend_vm_opcode_handler_t zend_jit_trace(zend_jit_trace_rec *trace_buffer,
52035203
&& ssa->vars[ssa_op->op2_def].use_chain < 0
52045204
&& !ssa->vars[ssa_op->op2_def].phi_use_chain) {
52055205
if (!zend_jit_store_type(&ctx, var_num, type)) {
5206-
return 0;
5206+
goto jit_failure;
52075207
}
52085208
SET_STACK_TYPE(stack, var_num, type, 1);
52095209
}
@@ -5256,7 +5256,7 @@ static zend_vm_opcode_handler_t zend_jit_trace(zend_jit_trace_rec *trace_buffer,
52565256
&& ssa->vars[ssa_op->op1_def].use_chain < 0
52575257
&& !ssa->vars[ssa_op->op1_def].phi_use_chain) {
52585258
if (!zend_jit_store_type(&ctx, var_num, type)) {
5259-
return 0;
5259+
goto jit_failure;
52605260
}
52615261
SET_STACK_TYPE(stack, var_num, type, 1);
52625262
}
@@ -5353,7 +5353,7 @@ static zend_vm_opcode_handler_t zend_jit_trace(zend_jit_trace_rec *trace_buffer,
53535353
&& ssa->vars[ssa_op->op1_def].use_chain < 0
53545354
&& !ssa->vars[ssa_op->op1_def].phi_use_chain) {
53555355
if (!zend_jit_store_type(&ctx, var_num, type)) {
5356-
return 0;
5356+
goto jit_failure;
53575357
}
53585358
SET_STACK_TYPE(stack, var_num, type, 1);
53595359
}
@@ -6613,7 +6613,7 @@ static zend_vm_opcode_handler_t zend_jit_trace(zend_jit_trace_rec *trace_buffer,
66136613
var_num = EX_VAR_TO_NUM(var_num);
66146614

66156615
if (!zend_jit_store_type(&ctx, var_num, type)) {
6616-
return 0;
6616+
goto jit_failure;
66176617
}
66186618
SET_STACK_TYPE(stack, var_num, type, 1);
66196619
}
@@ -7252,7 +7252,7 @@ static zend_vm_opcode_handler_t zend_jit_trace(zend_jit_trace_rec *trace_buffer,
72527252
&& type != STACK_MEM_TYPE(stack, i)
72537253
&& zend_jit_trace_must_store_type(op_array, op_array_ssa, opline - op_array->opcodes, i, type)) {
72547254
if (!zend_jit_store_type(jit, i, type)) {
7255-
return 0;
7255+
goto jit_failure;
72567256
}
72577257
SET_STACK_TYPE(stack, i, type, 1);
72587258
}
@@ -7373,11 +7373,11 @@ static zend_vm_opcode_handler_t zend_jit_trace(zend_jit_trace_rec *trace_buffer,
73737373
zend_string_release(name);
73747374
}
73757375

7376+
jit_cleanup:;
73767377
} zend_catch {
73777378
do_bailout = 1;
73787379
} zend_end_try();
73797380

7380-
jit_cleanup:
73817381
/* Clean up used op_arrays */
73827382
while (num_op_arrays > 0) {
73837383
op_array = op_arrays[--num_op_arrays];

0 commit comments

Comments
 (0)