mirror of
https://github.com/php/php-src.git
synced 2024-11-27 11:53:33 +08:00
Remove FREE_UNFETCHED concept
In master normal FREE_OPs work like FREE_UNFETCHED_OP used to, so there is no point in keeping this distinction anymore, it's just confusing.
This commit is contained in:
parent
c05bfa362b
commit
613a56d1cb
@ -162,9 +162,6 @@ ZEND_API const zend_internal_function zend_pass_function = {
|
||||
zval_ptr_dtor_nogc(EX_VAR(var)); \
|
||||
}
|
||||
|
||||
#define FREE_UNFETCHED_OP(type, var) \
|
||||
FREE_OP(type, var)
|
||||
|
||||
#define FREE_OP_VAR_PTR(type, var) \
|
||||
FREE_OP(type, var)
|
||||
|
||||
@ -2903,7 +2900,7 @@ static zend_never_inline int zend_fetch_static_property_address_ex(zval **retval
|
||||
if (EXPECTED((ce = CACHED_PTR(cache_slot)) == NULL)) {
|
||||
ce = zend_fetch_class_by_name(Z_STR_P(class_name), Z_STR_P(class_name + 1), ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
|
||||
if (UNEXPECTED(ce == NULL)) {
|
||||
FREE_UNFETCHED_OP(op1_type, opline->op1.var);
|
||||
FREE_OP(op1_type, opline->op1.var);
|
||||
return FAILURE;
|
||||
}
|
||||
if (UNEXPECTED(op1_type != IS_CONST)) {
|
||||
@ -2914,7 +2911,7 @@ static zend_never_inline int zend_fetch_static_property_address_ex(zval **retval
|
||||
if (EXPECTED(op2_type == IS_UNUSED)) {
|
||||
ce = zend_fetch_class(NULL, opline->op2.num);
|
||||
if (UNEXPECTED(ce == NULL)) {
|
||||
FREE_UNFETCHED_OP(op1_type, opline->op1.var);
|
||||
FREE_OP(op1_type, opline->op1.var);
|
||||
return FAILURE;
|
||||
}
|
||||
} else {
|
||||
|
@ -1095,7 +1095,7 @@ ZEND_VM_HANDLER(29, ZEND_ASSIGN_STATIC_PROP_OP, ANY, ANY, OP)
|
||||
|
||||
if (UNEXPECTED(zend_fetch_static_property_address(&prop, &prop_info, (opline+1)->extended_value, BP_VAR_RW, 0 OPLINE_CC EXECUTE_DATA_CC) != SUCCESS)) {
|
||||
UNDEF_RESULT();
|
||||
FREE_UNFETCHED_OP_DATA();
|
||||
FREE_OP_DATA();
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
||||
@ -1935,8 +1935,8 @@ ZEND_VM_COLD_HELPER(zend_use_tmp_in_write_context_helper, ANY, ANY)
|
||||
|
||||
SAVE_OPLINE();
|
||||
zend_throw_error(NULL, "Cannot use temporary expression in write context");
|
||||
FREE_UNFETCHED_OP2();
|
||||
FREE_UNFETCHED_OP1();
|
||||
FREE_OP2();
|
||||
FREE_OP1();
|
||||
ZVAL_UNDEF(EX_VAR(opline->result.var));
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
@ -1947,8 +1947,8 @@ ZEND_VM_COLD_HELPER(zend_use_undef_in_read_context_helper, ANY, ANY)
|
||||
|
||||
SAVE_OPLINE();
|
||||
zend_throw_error(NULL, "Cannot use [] for reading");
|
||||
FREE_UNFETCHED_OP2();
|
||||
FREE_UNFETCHED_OP1();
|
||||
FREE_OP2();
|
||||
FREE_OP1();
|
||||
ZVAL_UNDEF(EX_VAR(opline->result.var));
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
@ -2480,7 +2480,7 @@ ZEND_VM_HANDLER(25, ZEND_ASSIGN_STATIC_PROP, ANY, ANY, CACHE_SLOT, SPEC(OP_DATA=
|
||||
SAVE_OPLINE();
|
||||
|
||||
if (zend_fetch_static_property_address(&prop, &prop_info, opline->extended_value, BP_VAR_W, 0 OPLINE_CC EXECUTE_DATA_CC) != SUCCESS) {
|
||||
FREE_UNFETCHED_OP_DATA();
|
||||
FREE_OP_DATA();
|
||||
UNDEF_RESULT();
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
@ -2578,7 +2578,7 @@ ZEND_VM_C_LABEL(try_assign_dim_array):
|
||||
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
|
||||
if (OP2_TYPE == IS_UNUSED) {
|
||||
zend_use_new_element_for_string();
|
||||
FREE_UNFETCHED_OP_DATA();
|
||||
FREE_OP_DATA();
|
||||
UNDEF_RESULT();
|
||||
} else {
|
||||
dim = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||
@ -2591,7 +2591,7 @@ ZEND_VM_C_LABEL(try_assign_dim_array):
|
||||
&& ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr))
|
||||
&& !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) {
|
||||
dim = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||
FREE_UNFETCHED_OP_DATA();
|
||||
FREE_OP_DATA();
|
||||
UNDEF_RESULT();
|
||||
} else {
|
||||
ZVAL_ARR(object_ptr, zend_new_array(8));
|
||||
@ -2601,7 +2601,7 @@ ZEND_VM_C_LABEL(try_assign_dim_array):
|
||||
zend_use_scalar_as_array();
|
||||
dim = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||
ZEND_VM_C_LABEL(assign_dim_error):
|
||||
FREE_UNFETCHED_OP_DATA();
|
||||
FREE_OP_DATA();
|
||||
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
}
|
||||
@ -2716,7 +2716,7 @@ ZEND_VM_HANDLER(33, ZEND_ASSIGN_STATIC_PROP_REF, ANY, ANY, CACHE_SLOT|SRC)
|
||||
SAVE_OPLINE();
|
||||
|
||||
if (zend_fetch_static_property_address(&prop, &prop_info, opline->extended_value & ~ZEND_RETURNS_FUNCTION, BP_VAR_W, 0 OPLINE_CC EXECUTE_DATA_CC) != SUCCESS) {
|
||||
FREE_UNFETCHED_OP_DATA();
|
||||
FREE_OP_DATA();
|
||||
UNDEF_RESULT();
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
@ -3521,7 +3521,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, UNUSED|CLASS_FETCH|CONST|VAR,
|
||||
if (UNEXPECTED(ce == NULL)) {
|
||||
ce = zend_fetch_class_by_name(Z_STR_P(RT_CONSTANT(opline, opline->op1)), Z_STR_P(RT_CONSTANT(opline, opline->op1) + 1), ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
|
||||
if (UNEXPECTED(ce == NULL)) {
|
||||
FREE_UNFETCHED_OP2();
|
||||
FREE_OP2();
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
if (OP2_TYPE != IS_CONST) {
|
||||
@ -3531,7 +3531,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, UNUSED|CLASS_FETCH|CONST|VAR,
|
||||
} else if (OP1_TYPE == IS_UNUSED) {
|
||||
ce = zend_fetch_class(NULL, opline->op1.num);
|
||||
if (UNEXPECTED(ce == NULL)) {
|
||||
FREE_UNFETCHED_OP2();
|
||||
FREE_OP2();
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
} else {
|
||||
@ -4519,7 +4519,7 @@ ZEND_VM_COLD_HELPER(zend_cannot_pass_by_ref_helper, ANY, ANY)
|
||||
|
||||
SAVE_OPLINE();
|
||||
zend_throw_error(NULL, "Cannot pass parameter %d by reference", arg_num);
|
||||
FREE_UNFETCHED_OP1();
|
||||
FREE_OP1();
|
||||
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
|
||||
ZVAL_UNDEF(arg);
|
||||
HANDLE_EXCEPTION();
|
||||
@ -4929,7 +4929,7 @@ ZEND_VM_HANDLER(119, ZEND_SEND_ARRAY, ANY, ANY, NUM)
|
||||
}
|
||||
}
|
||||
zend_type_error("call_user_func_array(): Argument #2 ($args) must be of type array, %s given", zend_zval_type_name(args));
|
||||
FREE_UNFETCHED_OP2();
|
||||
FREE_OP2();
|
||||
FREE_OP1();
|
||||
HANDLE_EXCEPTION();
|
||||
} else {
|
||||
@ -5947,7 +5947,7 @@ ZEND_VM_COLD_HANDLER(179, ZEND_UNSET_STATIC_PROP, ANY, ANY, CACHE_SLOT)
|
||||
if (UNEXPECTED(ce == NULL)) {
|
||||
ce = zend_fetch_class_by_name(Z_STR_P(RT_CONSTANT(opline, opline->op2)), Z_STR_P(RT_CONSTANT(opline, opline->op2) + 1), ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
|
||||
if (UNEXPECTED(ce == NULL)) {
|
||||
FREE_UNFETCHED_OP1();
|
||||
FREE_OP1();
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
/*CACHE_PTR(opline->extended_value, ce);*/
|
||||
@ -5955,7 +5955,7 @@ ZEND_VM_COLD_HANDLER(179, ZEND_UNSET_STATIC_PROP, ANY, ANY, CACHE_SLOT)
|
||||
} else if (OP2_TYPE == IS_UNUSED) {
|
||||
ce = zend_fetch_class(NULL, opline->op2.num);
|
||||
if (UNEXPECTED(ce == NULL)) {
|
||||
FREE_UNFETCHED_OP1();
|
||||
FREE_OP1();
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
} else {
|
||||
@ -7497,8 +7497,8 @@ ZEND_VM_COLD_HELPER(zend_yield_in_closed_generator_helper, ANY, ANY)
|
||||
|
||||
SAVE_OPLINE();
|
||||
zend_throw_error(NULL, "Cannot yield from finally in a force-closed generator");
|
||||
FREE_UNFETCHED_OP2();
|
||||
FREE_UNFETCHED_OP1();
|
||||
FREE_OP2();
|
||||
FREE_OP1();
|
||||
UNDEF_RESULT();
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
@ -765,7 +765,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_OP_SPEC_HAN
|
||||
|
||||
if (UNEXPECTED(zend_fetch_static_property_address(&prop, &prop_info, (opline+1)->extended_value, BP_VAR_RW, 0 OPLINE_CC EXECUTE_DATA_CC) != SUCCESS)) {
|
||||
UNDEF_RESULT();
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
||||
@ -903,8 +903,8 @@ static zend_never_inline ZEND_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_us
|
||||
|
||||
SAVE_OPLINE();
|
||||
zend_throw_error(NULL, "Cannot use temporary expression in write context");
|
||||
FREE_UNFETCHED_OP(opline->op2_type, opline->op2.var);
|
||||
FREE_UNFETCHED_OP(opline->op1_type, opline->op1.var);
|
||||
FREE_OP(opline->op2_type, opline->op2.var);
|
||||
FREE_OP(opline->op1_type, opline->op1.var);
|
||||
ZVAL_UNDEF(EX_VAR(opline->result.var));
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
@ -915,8 +915,8 @@ static zend_never_inline ZEND_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_us
|
||||
|
||||
SAVE_OPLINE();
|
||||
zend_throw_error(NULL, "Cannot use [] for reading");
|
||||
FREE_UNFETCHED_OP(opline->op2_type, opline->op2.var);
|
||||
FREE_UNFETCHED_OP(opline->op1_type, opline->op1.var);
|
||||
FREE_OP(opline->op2_type, opline->op2.var);
|
||||
FREE_OP(opline->op1_type, opline->op1.var);
|
||||
ZVAL_UNDEF(EX_VAR(opline->result.var));
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
@ -1054,7 +1054,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_REF_SPEC_HA
|
||||
SAVE_OPLINE();
|
||||
|
||||
if (zend_fetch_static_property_address(&prop, &prop_info, opline->extended_value & ~ZEND_RETURNS_FUNCTION, BP_VAR_W, 0 OPLINE_CC EXECUTE_DATA_CC) != SUCCESS) {
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
UNDEF_RESULT();
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
@ -1794,7 +1794,7 @@ static zend_never_inline ZEND_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_ca
|
||||
|
||||
SAVE_OPLINE();
|
||||
zend_throw_error(NULL, "Cannot pass parameter %d by reference", arg_num);
|
||||
FREE_UNFETCHED_OP(opline->op1_type, opline->op1.var);
|
||||
FREE_OP(opline->op1_type, opline->op1.var);
|
||||
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
|
||||
ZVAL_UNDEF(arg);
|
||||
HANDLE_EXCEPTION();
|
||||
@ -1968,7 +1968,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_ARRAY_SPEC_HANDLER(ZEND_O
|
||||
}
|
||||
}
|
||||
zend_type_error("call_user_func_array(): Argument #2 ($args) must be of type array, %s given", zend_zval_type_name(args));
|
||||
FREE_UNFETCHED_OP(opline->op2_type, opline->op2.var);
|
||||
FREE_OP(opline->op2_type, opline->op2.var);
|
||||
FREE_OP(opline->op1_type, opline->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
} else {
|
||||
@ -2228,7 +2228,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_STATIC_PROP
|
||||
if (UNEXPECTED(ce == NULL)) {
|
||||
ce = zend_fetch_class_by_name(Z_STR_P(RT_CONSTANT(opline, opline->op2)), Z_STR_P(RT_CONSTANT(opline, opline->op2) + 1), ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
|
||||
if (UNEXPECTED(ce == NULL)) {
|
||||
FREE_UNFETCHED_OP(opline->op1_type, opline->op1.var);
|
||||
FREE_OP(opline->op1_type, opline->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
/*CACHE_PTR(opline->extended_value, ce);*/
|
||||
@ -2236,7 +2236,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_STATIC_PROP
|
||||
} else if (opline->op2_type == IS_UNUSED) {
|
||||
ce = zend_fetch_class(NULL, opline->op2.num);
|
||||
if (UNEXPECTED(ce == NULL)) {
|
||||
FREE_UNFETCHED_OP(opline->op1_type, opline->op1.var);
|
||||
FREE_OP(opline->op1_type, opline->op1.var);
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
} else {
|
||||
@ -2621,8 +2621,8 @@ static zend_never_inline ZEND_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_yi
|
||||
|
||||
SAVE_OPLINE();
|
||||
zend_throw_error(NULL, "Cannot yield from finally in a force-closed generator");
|
||||
FREE_UNFETCHED_OP(opline->op2_type, opline->op2.var);
|
||||
FREE_UNFETCHED_OP(opline->op1_type, opline->op1.var);
|
||||
FREE_OP(opline->op2_type, opline->op2.var);
|
||||
FREE_OP(opline->op1_type, opline->op1.var);
|
||||
UNDEF_RESULT();
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
@ -494,28 +494,6 @@ $op2_free_op_var_ptr = array(
|
||||
"TMPVARCV" => "???",
|
||||
);
|
||||
|
||||
$op1_free_unfetched = array(
|
||||
"ANY" => "FREE_UNFETCHED_OP(opline->op1_type, opline->op1.var)",
|
||||
"TMP" => "zval_ptr_dtor_nogc(EX_VAR(opline->op1.var))",
|
||||
"VAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op1.var))",
|
||||
"CONST" => "",
|
||||
"UNUSED" => "",
|
||||
"CV" => "",
|
||||
"TMPVAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op1.var))",
|
||||
"TMPVARCV" => "???",
|
||||
);
|
||||
|
||||
$op2_free_unfetched = array(
|
||||
"ANY" => "FREE_UNFETCHED_OP(opline->op2_type, opline->op2.var)",
|
||||
"TMP" => "zval_ptr_dtor_nogc(EX_VAR(opline->op2.var))",
|
||||
"VAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op2.var))",
|
||||
"CONST" => "",
|
||||
"UNUSED" => "",
|
||||
"CV" => "",
|
||||
"TMPVAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op2.var))",
|
||||
"TMPVARCV" => "???",
|
||||
);
|
||||
|
||||
$op_data_type = array(
|
||||
"ANY" => "(opline+1)->op1_type",
|
||||
"TMP" => "IS_TMP_VAR",
|
||||
@ -582,17 +560,6 @@ $op_data_free_op_var_ptr = array(
|
||||
"TMPVARCV" => "???",
|
||||
);
|
||||
|
||||
$op_data_free_unfetched = array(
|
||||
"ANY" => "FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var)",
|
||||
"TMP" => "zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var))",
|
||||
"VAR" => "zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var))",
|
||||
"CONST" => "",
|
||||
"UNUSED" => "",
|
||||
"CV" => "",
|
||||
"TMPVAR" => "zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var))",
|
||||
"TMPVARCV" => "???",
|
||||
);
|
||||
|
||||
$list = array(); // list of opcode handlers and helpers in original order
|
||||
$opcodes = array(); // opcode handlers by code
|
||||
$helpers = array(); // opcode helpers by name
|
||||
@ -786,8 +753,6 @@ function gen_code($f, $spec, $kind, $code, $op1, $op2, $name, $extra_spec=null)
|
||||
"/FREE_OP2_IF_VAR\(\)/" => $op2_free_op_if_var[$op2],
|
||||
"/FREE_OP1_VAR_PTR\(\)/" => $op1_free_op_var_ptr[$op1],
|
||||
"/FREE_OP2_VAR_PTR\(\)/" => $op2_free_op_var_ptr[$op2],
|
||||
"/FREE_UNFETCHED_OP1\(\)/" => $op1_free_unfetched[$op1],
|
||||
"/FREE_UNFETCHED_OP2\(\)/" => $op2_free_unfetched[$op2],
|
||||
"/\!ZEND_VM_SPEC/m" => ($op1!="ANY"||$op2!="ANY")?"0":"1",
|
||||
"/ZEND_VM_SPEC/m" => ($op1!="ANY"||$op2!="ANY")?"1":"0",
|
||||
"/ZEND_VM_C_LABEL\(\s*([A-Za-z_]*)\s*\)/m" => "\\1".(($spec && $kind != ZEND_VM_KIND_CALL)?("_SPEC".$prefix[$op1].$prefix[$op2].extra_spec_name($extra_spec)):""),
|
||||
@ -802,7 +767,6 @@ function gen_code($f, $spec, $kind, $code, $op1, $op2, $name, $extra_spec=null)
|
||||
"/GET_OP_DATA_ZVAL_PTR_PTR\(([^)]*)\)/" => $op_data_get_zval_ptr_ptr[isset($extra_spec['OP_DATA']) ? $extra_spec['OP_DATA'] : "ANY"],
|
||||
"/FREE_OP_DATA\(\)/" => $op_data_free_op[isset($extra_spec['OP_DATA']) ? $extra_spec['OP_DATA'] : "ANY"],
|
||||
"/FREE_OP_DATA_VAR_PTR\(\)/" => $op_data_free_op_var_ptr[isset($extra_spec['OP_DATA']) ? $extra_spec['OP_DATA'] : "ANY"],
|
||||
"/FREE_UNFETCHED_OP_DATA\(\)/" => $op_data_free_unfetched[isset($extra_spec['OP_DATA']) ? $extra_spec['OP_DATA'] : "ANY"],
|
||||
"/RETURN_VALUE_USED\(opline\)/" => isset($extra_spec['RETVAL']) ? $extra_spec['RETVAL'] : "RETURN_VALUE_USED(opline)",
|
||||
"/arg_num <= MAX_ARG_FLAG_NUM/" => isset($extra_spec['QUICK_ARG']) ? $extra_spec['QUICK_ARG'] : "arg_num <= MAX_ARG_FLAG_NUM",
|
||||
"/ZEND_VM_SMART_BRANCH\(\s*([^,)]*)\s*,\s*([^)]*)\s*\)/" => isset($extra_spec['SMART_BRANCH']) ?
|
||||
|
Loading…
Reference in New Issue
Block a user