Explicitly pass ssa_op in the places that don't do so yet.
add_operands_to_worklists(&ctx, &op_array->opcodes[op_data], &ssa->ops[op_data], ssa, 0);
}
} else if (may_have_side_effects(op_array, ssa, &op_array->opcodes[i], &ssa->ops[i], ctx.reorder_dtor_effects)
- || zend_may_throw(&op_array->opcodes[i], op_array, ssa)
+ || zend_may_throw(&op_array->opcodes[i], &ssa->ops[i], op_array, ssa)
|| (has_varargs && may_break_varargs(op_array, ssa, &ssa->ops[i]))) {
if (op_array->opcodes[i].opcode == ZEND_NEW
&& op_array->opcodes[i+1].opcode == ZEND_DO_FCALL
}
break;
default:
- if (zend_may_throw(opline, op_array, ssa)) {
+ if (zend_may_throw(opline, ssa_op, op_array, ssa)) {
return 0;
}
break;
free_alloca(worklist, use_heap);
}
-int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, zend_ssa *ssa)
+int zend_may_throw(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, zend_ssa *ssa)
{
uint32_t t1 = OP1_INFO_EX();
uint32_t t2 = OP2_INFO_EX();
return 0;
case ZEND_BIND_GLOBAL:
if ((opline+1)->opcode == ZEND_BIND_GLOBAL) {
- return zend_may_throw_ex(opline + 1, ssa_op + 1, op_array, ssa);
+ return zend_may_throw(opline + 1, ssa_op + 1, op_array, ssa);
}
return 0;
case ZEND_ADD:
return 1;
}
}
-
-int zend_may_throw(const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
-{
- return zend_may_throw_ex(opline, &ssa->ops[opline - op_array->opcodes], op_array, ssa);
-}
int widening,
zend_ssa_var_info *ret);
-int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, zend_ssa *ssa);
-int zend_may_throw(const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa);
+int zend_may_throw(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, zend_ssa *ssa);
int zend_update_type_info(const zend_op_array *op_array,
zend_ssa *ssa,
}
end = ssa->cfg.blocks[b].start + ssa->cfg.blocks[b].len - 1;
for (i = ssa->cfg.blocks[b].start; i <= end; i++) {
+ zend_ssa_op *ssa_op = &ssa->ops[i];
opline = op_array->opcodes + i;
switch (opline->opcode) {
case ZEND_INIT_FCALL:
op2_info, OP2_RANGE(), OP2_REG_ADDR(),
res_use_info, RES_INFO(), res_addr,
send_result,
- zend_may_throw(opline, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
goto done;
res_use_info, res_info, res_addr,
send_result,
(res_info & MAY_BE_LONG) && (res_info & MAY_BE_DOUBLE) && zend_may_overflow(opline, op_array, ssa),
- zend_may_throw(opline, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
goto done;
}
if (!zend_jit_concat(&dasm_state, opline, op_array,
op1_info, op2_info, RES_INFO(), send_result,
- zend_may_throw(opline, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
goto done;
op1_info, op1_def_info, OP1_RANGE(),
op2_info, OP2_RANGE(),
(op1_def_info & MAY_BE_LONG) && (op1_def_info & MAY_BE_DOUBLE) && zend_may_overflow(opline, op_array, ssa),
- zend_may_throw(opline, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
goto done;
if (!zend_jit_assign_dim_op(&dasm_state, opline, op_array,
OP1_INFO(), OP1_DEF_INFO(), OP2_INFO(),
OP1_DATA_INFO(), OP1_DATA_RANGE(),
- zend_may_throw(opline, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
goto done;
}
if (!zend_jit_assign_dim(&dasm_state, opline, op_array,
OP1_INFO(), OP2_INFO(), OP1_DATA_INFO(),
- zend_may_throw(opline, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
goto done;
OP1_DEF_INFO(), OP1_DEF_REG_ADDR(),
OP2_INFO(), op2_addr, op2_def_addr,
res_info, res_addr,
- zend_may_throw(opline, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
goto done;
OP1_INFO(), OP1_REG_ADDR(),
OP2_INFO(), OP2_REG_ADDR(),
res_addr,
- zend_may_throw(opline, op_array, ssa),
+ zend_may_throw(opline, ssa_op, op_array, ssa),
smart_branch_opcode, target_label, target_label2,
NULL)) {
goto jit_failure;
OP1_INFO(), OP1_REG_ADDR(),
OP2_INFO(), OP2_REG_ADDR(),
RES_REG_ADDR(),
- zend_may_throw(opline, op_array, ssa),
+ zend_may_throw(opline, ssa_op, op_array, ssa),
smart_branch_opcode, target_label, target_label2,
NULL)) {
goto jit_failure;
if (!zend_jit_bool_jmpznz(&dasm_state, opline, op_array,
OP1_INFO(), OP1_REG_ADDR(), RES_REG_ADDR(),
-1, -1,
- zend_may_throw(opline, op_array, ssa),
+ zend_may_throw(opline, ssa_op, op_array, ssa),
opline->opcode, NULL)) {
goto jit_failure;
}
if (!zend_jit_bool_jmpznz(&dasm_state, opline, op_array,
OP1_INFO(), OP1_REG_ADDR(), res_addr,
ssa->cfg.blocks[b].successors[0], ssa->cfg.blocks[b].successors[1],
- zend_may_throw(opline, op_array, ssa),
+ zend_may_throw(opline, ssa_op, op_array, ssa),
opline->opcode, NULL)) {
goto jit_failure;
}
}
if (!zend_jit_fetch_dim_read(&dasm_state, opline, op_array,
OP1_INFO(), OP2_INFO(), RES_INFO(),
- zend_may_throw(opline, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
goto done;
}
if (!zend_jit_isset_isempty_dim(&dasm_state, opline, op_array,
OP1_INFO(), OP2_INFO(),
- zend_may_throw(opline, op_array, ssa),
+ zend_may_throw(opline, ssa_op, op_array, ssa),
smart_branch_opcode, target_label, target_label2,
NULL)) {
goto jit_failure;
}
if (!zend_jit_fetch_obj_read(&dasm_state, opline, op_array,
op1_info, ce,
- zend_may_throw(opline, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
goto done;
case ZEND_RECV_INIT:
if (!zend_jit_recv_init(&dasm_state, opline, op_array,
(opline + 1)->opcode != ZEND_RECV_INIT,
- zend_may_throw(opline, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
goto done;
case ZEND_FREE:
case ZEND_FE_FREE:
if (!zend_jit_free(&dasm_state, opline, op_array, OP1_INFO(),
- zend_may_throw(opline, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
goto done;
if (opline == op_array->opcodes ||
opline->opcode != op_array->opcodes[i-1].opcode) {
/* repeatable opcodes */
- if (!zend_jit_handler(&dasm_state, opline, zend_may_throw(opline, op_array, ssa))) {
+ if (!zend_jit_handler(&dasm_state, opline,
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
}
is_terminated = 1;
break;
case ZEND_JMPZNZ:
- if (!zend_jit_handler(&dasm_state, opline, zend_may_throw(opline, op_array, ssa)) ||
+ if (!zend_jit_handler(&dasm_state, opline,
+ zend_may_throw(opline, ssa_op, op_array, ssa)) ||
!zend_jit_cond_jmp(&dasm_state, OP_JMP_ADDR(opline, opline->op2), ssa->cfg.blocks[b].successors[1]) ||
!zend_jit_jmp(&dasm_state, ssa->cfg.blocks[b].successors[0])) {
goto jit_failure;
case ZEND_ASSERT_CHECK:
case ZEND_FE_FETCH_R:
case ZEND_FE_FETCH_RW:
- if (!zend_jit_handler(&dasm_state, opline, zend_may_throw(opline, op_array, ssa)) ||
+ if (!zend_jit_handler(&dasm_state, opline,
+ zend_may_throw(opline, ssa_op, op_array, ssa)) ||
!zend_jit_cond_jmp(&dasm_state, opline + 1, ssa->cfg.blocks[b].successors[0])) {
goto jit_failure;
}
}
break;
default:
- if (!zend_jit_handler(&dasm_state, opline, zend_may_throw(opline, op_array, ssa))) {
+ if (!zend_jit_handler(&dasm_state, opline,
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
}
op2_info, OP2_RANGE_EX(), OP2_REG_ADDR(),
res_use_info, res_info, res_addr,
send_result,
- zend_may_throw_ex(opline, ssa_op, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
goto done;
res_use_info, res_info, res_addr,
send_result,
(res_info & MAY_BE_LONG) && (res_info & (MAY_BE_DOUBLE|MAY_BE_GUARD)) && zend_may_overflow_ex(opline, ssa_op, op_array, ssa),
- zend_may_throw_ex(opline, ssa_op, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
if ((res_info & (MAY_BE_ANY|MAY_BE_GUARD)) == (MAY_BE_LONG|MAY_BE_GUARD)) {
res_info = RES_INFO_EX();
if (!zend_jit_concat(&dasm_state, opline, op_array,
op1_info, op2_info, res_info, send_result,
- zend_may_throw_ex(opline, ssa_op, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
goto done;
op1_info, op1_def_info, OP1_RANGE_EX(),
op2_info, OP2_RANGE_EX(),
(op1_def_info & MAY_BE_LONG) && (op1_def_info & (MAY_BE_DOUBLE|MAY_BE_GUARD)) && zend_may_overflow_ex(opline, ssa_op, op_array, ssa),
- zend_may_throw_ex(opline, ssa_op, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
if ((op1_def_info & (MAY_BE_ANY|MAY_BE_GUARD)) == (MAY_BE_LONG|MAY_BE_GUARD)) {
if (!zend_jit_assign_dim_op(&dasm_state, opline, op_array,
op1_info, op1_def_info, op2_info,
op1_data_info, OP1_DATA_RANGE(),
- zend_may_throw_ex(opline, ssa_op, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
goto done;
CHECK_OP1_DATA_TRACE_TYPE();
if (!zend_jit_assign_dim(&dasm_state, opline, op_array,
op1_info, op2_info, op1_data_info,
- zend_may_throw_ex(opline, ssa_op, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
goto done;
op1_def_info, OP1_DEF_REG_ADDR(),
op2_info, op2_addr, op2_def_addr,
res_info, res_addr,
- zend_may_throw_ex(opline, ssa_op, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
goto done;
op1_info, OP1_REG_ADDR(),
op2_info, OP2_REG_ADDR(),
RES_REG_ADDR(),
- zend_may_throw_ex(opline, ssa_op, op_array, ssa),
+ zend_may_throw(opline, ssa_op, op_array, ssa),
smart_branch_opcode, -1, -1, exit_addr)) {
goto jit_failure;
}
op1_info, OP1_REG_ADDR(),
op2_info, OP2_REG_ADDR(),
RES_REG_ADDR(),
- zend_may_throw_ex(opline, ssa_op, op_array, ssa),
+ zend_may_throw(opline, ssa_op, op_array, ssa),
smart_branch_opcode, -1, -1, exit_addr)) {
goto jit_failure;
}
if (!zend_jit_bool_jmpznz(&dasm_state, opline, op_array,
op1_info, OP1_REG_ADDR(), RES_REG_ADDR(),
-1, -1,
- zend_may_throw_ex(opline, ssa_op, op_array, ssa),
+ zend_may_throw(opline, ssa_op, op_array, ssa),
opline->opcode, NULL)) {
goto jit_failure;
}
if (!zend_jit_bool_jmpznz(&dasm_state, opline, op_array,
op1_info, OP1_REG_ADDR(), res_addr,
-1, -1,
- zend_may_throw_ex(opline, ssa_op, op_array, ssa),
+ zend_may_throw(opline, ssa_op, op_array, ssa),
smart_branch_opcode, exit_addr)) {
goto jit_failure;
}
}
if (!zend_jit_isset_isempty_dim(&dasm_state, opline, op_array,
op1_info, op2_info,
- zend_may_throw_ex(opline, ssa_op, op_array, ssa),
+ zend_may_throw(opline, ssa_op, op_array, ssa),
smart_branch_opcode, -1, -1,
exit_addr)) {
goto jit_failure;
}
if (!zend_jit_fetch_obj_read(&dasm_state, opline, op_array,
op1_info, ce,
- zend_may_throw_ex(opline, ssa_op, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
goto done;
while (1) {
if (!zend_jit_recv_init(&dasm_state, opline, op_array,
(opline + 1)->opcode != ZEND_RECV_INIT,
- zend_may_throw_ex(opline, ssa_op, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
if ((opline+1)->opcode == ZEND_RECV_INIT) {
op1_info = OP1_INFO_EX();
USE_OP1_TRACE_TYPE();
if (!zend_jit_free(&dasm_state, opline, op_array, op1_info,
- zend_may_throw_ex(opline, ssa_op, op_array, ssa))) {
+ zend_may_throw(opline, ssa_op, op_array, ssa))) {
goto jit_failure;
}
goto done;
// TODO: we may need a guard after INIT_NS_FCALL???
case ZEND_INIT_METHOD_CALL:
case ZEND_INIT_DYNAMIC_CALL:
- if (!zend_jit_trace_handler(&dasm_state, op_array, opline, zend_may_throw_ex(opline, ssa_op, op_array, ssa), p + 1)) {
+ if (!zend_jit_trace_handler(&dasm_state, op_array, opline, zend_may_throw(opline, ssa_op, op_array, ssa), p + 1)) {
goto jit_failure;
}
if ((p+1)->op == ZEND_JIT_TRACE_INIT_CALL) {
}
goto done;
case ZEND_INIT_STATIC_METHOD_CALL:
- if (!zend_jit_trace_handler(&dasm_state, op_array, opline, zend_may_throw_ex(opline, ssa_op, op_array, ssa), p + 1)) {
+ if (!zend_jit_trace_handler(&dasm_state, op_array, opline, zend_may_throw(opline, ssa_op, op_array, ssa), p + 1)) {
goto jit_failure;
}
if ((opline->op1_type != IS_CONST
}
goto done;
case ZEND_INIT_USER_CALL:
- if (!zend_jit_trace_handler(&dasm_state, op_array, opline, zend_may_throw_ex(opline, ssa_op, op_array, ssa), p + 1)) {
+ if (!zend_jit_trace_handler(&dasm_state, op_array, opline, zend_may_throw(opline, ssa_op, op_array, ssa), p + 1)) {
goto jit_failure;
}
if (opline->op2_type != IS_CONST
}
goto done;
case ZEND_NEW:
- if (!zend_jit_trace_handler(&dasm_state, op_array, opline, zend_may_throw_ex(opline, ssa_op, op_array, ssa), p + 1)) {
+ if (!zend_jit_trace_handler(&dasm_state, op_array, opline, zend_may_throw(opline, ssa_op, op_array, ssa), p + 1)) {
goto jit_failure;
}
if (opline->op1_type != IS_CONST
}
if (opline->opcode != ZEND_NOP && opline->opcode != ZEND_JMP) {
- if (!zend_jit_trace_handler(&dasm_state, op_array, opline, zend_may_throw_ex(opline, ssa_op, op_array, ssa), p + 1)) {
+ if (!zend_jit_trace_handler(&dasm_state, op_array, opline, zend_may_throw(opline, ssa_op, op_array, ssa), p + 1)) {
goto jit_failure;
}
}
skip = 1;
while (opline != end) {
if (!skip) {
- if (zend_may_throw(opline, op_array, ssa)) {
+ zend_ssa_op *ssa_op = &ssa->ops[opline - op_array->opcodes];
+ if (zend_may_throw(opline, ssa_op, op_array, ssa)) {
return 1;
}
}
return 1;
}
} else {
- if (zend_may_throw(opline, op_array, ssa)) {
+ zend_ssa_op *ssa_op = &ssa->ops[opline - op_array->opcodes];
+ if (zend_may_throw(opline, ssa_op, op_array, ssa)) {
return 1;
}
}
fallback:
/* fallback to subroutine threading */
if (trace) {
- return zend_jit_trace_handler(Dst, op_array, opline, zend_may_throw(opline, op_array, ssa), trace);
+ return zend_jit_trace_handler(Dst, op_array, opline, /* may_throw */ 1, trace);
}
if (opline->opcode == ZEND_DO_FCALL ||
opline->opcode == ZEND_DO_UCALL ||
opline->opcode == ZEND_DO_FCALL_BY_NAME ){
return zend_jit_call(Dst, opline, next_block);
} else {
- return zend_jit_handler(Dst, opline, zend_may_throw(opline, op_array, ssa));
+ return zend_jit_handler(Dst, opline, /* may_throw */ 1);
}
#endif
}