Skip to content

Commit 159725d

Browse files
committed
Merge branch 'PHP-8.5'
* PHP-8.5: Add EG(bailout) consistency assertion Fix faulty zend_try handling in zend_jit_trace()
2 parents 43f1cd0 + 4f40c20 commit 159725d

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Zend/zend.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,9 @@ typedef size_t (*zend_write_func_t)(const char *str, size_t str_length);
281281
EG(bailout) = &__bailout; \
282282
if (SETJMP(__bailout)==0) {
283283
#define zend_catch \
284+
ZEND_ASSERT(EG(bailout) == &__bailout); \
284285
} else { \
286+
ZEND_ASSERT(EG(bailout) == &__bailout); \
285287
EG(bailout) = __orig_bailout;
286288
#define zend_end_try() \
287289
} \

ext/opcache/jit/zend_jit_trace.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5218,7 +5218,7 @@ static zend_vm_opcode_handler_t zend_jit_trace(zend_jit_trace_rec *trace_buffer,
52185218
&& ssa->vars[ssa_op->op2_def].use_chain < 0
52195219
&& !ssa->vars[ssa_op->op2_def].phi_use_chain) {
52205220
if (!zend_jit_store_type(&ctx, var_num, type)) {
5221-
return 0;
5221+
goto jit_failure;
52225222
}
52235223
SET_STACK_TYPE(stack, var_num, type, 1);
52245224
}
@@ -5271,7 +5271,7 @@ static zend_vm_opcode_handler_t zend_jit_trace(zend_jit_trace_rec *trace_buffer,
52715271
&& ssa->vars[ssa_op->op1_def].use_chain < 0
52725272
&& !ssa->vars[ssa_op->op1_def].phi_use_chain) {
52735273
if (!zend_jit_store_type(&ctx, var_num, type)) {
5274-
return 0;
5274+
goto jit_failure;
52755275
}
52765276
SET_STACK_TYPE(stack, var_num, type, 1);
52775277
}
@@ -5368,7 +5368,7 @@ static zend_vm_opcode_handler_t zend_jit_trace(zend_jit_trace_rec *trace_buffer,
53685368
&& ssa->vars[ssa_op->op1_def].use_chain < 0
53695369
&& !ssa->vars[ssa_op->op1_def].phi_use_chain) {
53705370
if (!zend_jit_store_type(&ctx, var_num, type)) {
5371-
return 0;
5371+
goto jit_failure;
53725372
}
53735373
SET_STACK_TYPE(stack, var_num, type, 1);
53745374
}
@@ -6627,7 +6627,7 @@ static zend_vm_opcode_handler_t zend_jit_trace(zend_jit_trace_rec *trace_buffer,
66276627
var_num = EX_VAR_TO_NUM(var_num);
66286628

66296629
if (!zend_jit_store_type(&ctx, var_num, type)) {
6630-
return 0;
6630+
goto jit_failure;
66316631
}
66326632
SET_STACK_TYPE(stack, var_num, type, 1);
66336633
}
@@ -7266,7 +7266,7 @@ static zend_vm_opcode_handler_t zend_jit_trace(zend_jit_trace_rec *trace_buffer,
72667266
&& type != STACK_MEM_TYPE(stack, i)
72677267
&& zend_jit_trace_must_store_type(op_array, op_array_ssa, opline - op_array->opcodes, i, type)) {
72687268
if (!zend_jit_store_type(jit, i, type)) {
7269-
return 0;
7269+
goto jit_failure;
72707270
}
72717271
SET_STACK_TYPE(stack, i, type, 1);
72727272
}
@@ -7387,11 +7387,11 @@ static zend_vm_opcode_handler_t zend_jit_trace(zend_jit_trace_rec *trace_buffer,
73877387
zend_string_release(name);
73887388
}
73897389

7390+
jit_cleanup:;
73907391
} zend_catch {
73917392
do_bailout = 1;
73927393
} zend_end_try();
73937394

7394-
jit_cleanup:
73957395
/* Clean up used op_arrays */
73967396
while (num_op_arrays > 0) {
73977397
op_array = op_arrays[--num_op_arrays];

0 commit comments

Comments
 (0)