From: Dmitry Stogov Date: Thu, 5 Jun 2014 14:42:17 +0000 (+0400) Subject: Simplify code X-Git-Tag: POST_PHPNG_MERGE~223 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=730beec16e46f34267b5a876b2a0be2917c32ba4;p=php Simplify code --- diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 471a02976a..95028ffcee 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -579,22 +579,19 @@ static void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "" TSRMLS_CC); } } else if (cur_arg_info->type_hint) { - switch(cur_arg_info->type_hint) { - case IS_ARRAY: - ZVAL_DEREF(arg); - if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) { - zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "" TSRMLS_CC); - } - break; - - case IS_CALLABLE: - if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) { - zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "" TSRMLS_CC); - } - break; - - default: - zend_error(E_ERROR, "Unknown typehint"); + if (cur_arg_info->type_hint == IS_ARRAY) { + ZVAL_DEREF(arg); + if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) { + zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "" TSRMLS_CC); + } + } else if (cur_arg_info->type_hint == IS_CALLABLE) { + if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) { + zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "" TSRMLS_CC); + } +#if ZEND_DEBUG + } else { + zend_error(E_ERROR, "Unknown typehint"); +#endif } } } @@ -623,17 +620,14 @@ static inline int zend_verify_missing_arg_type(zend_function *zf, zend_uint arg_ need_msg = zend_verify_arg_class_kind(cur_arg_info, fetch_type, &class_name, &ce TSRMLS_CC); zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "none", "" TSRMLS_CC); } else if (cur_arg_info->type_hint) { - switch(cur_arg_info->type_hint) { - case IS_ARRAY: - zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", "none", "" TSRMLS_CC); - break; - - case IS_CALLABLE: - zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", "none", "" TSRMLS_CC); - break; - - default: - zend_error(E_ERROR, "Unknown typehint"); + if (cur_arg_info->type_hint == IS_ARRAY) { + zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", "none", "" TSRMLS_CC); + } else if (cur_arg_info->type_hint == IS_CALLABLE) { + zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", "none", "" TSRMLS_CC); +#if ZEND_DEBUG + } else { + zend_error(E_ERROR, "Unknown typehint"); +#endif } } return 0; @@ -1407,17 +1401,14 @@ static inline zend_brk_cont_element* zend_brk_cont(int nest_levels, int array_of if (nest_levels>1) { zend_op *brk_opline = &op_array->opcodes[jmp_to->brk]; - switch (brk_opline->opcode) { - case ZEND_SWITCH_FREE: - if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { - zval_ptr_dtor(EX_VAR(brk_opline->op1.var)); - } - break; - case ZEND_FREE: - if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { - zval_dtor(EX_VAR(brk_opline->op1.var)); - } - break; + if (brk_opline->opcode == ZEND_SWITCH_FREE) { + if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { + zval_ptr_dtor(EX_VAR(brk_opline->op1.var)); + } + } else if (brk_opline->opcode == ZEND_FREE) { + if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { + zval_dtor(EX_VAR(brk_opline->op1.var)); + } } } array_offset = jmp_to->parent; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 554ac2ca80..8aa60ce3cd 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -3460,17 +3460,14 @@ ZEND_VM_HANDLER(100, ZEND_GOTO, ANY, CONST) brk_opline = EX(op_array)->opcodes + el->brk; - switch (brk_opline->opcode) { - case ZEND_SWITCH_FREE: - if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { - zval_ptr_dtor(EX_VAR(brk_opline->op1.var)); - } - break; - case ZEND_FREE: - if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { - zval_dtor(EX_VAR(brk_opline->op1.var)); - } - break; + if (brk_opline->opcode == ZEND_SWITCH_FREE) { + if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { + zval_ptr_dtor(EX_VAR(brk_opline->op1.var)); + } + } else if (brk_opline->opcode == ZEND_FREE) { + if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { + zval_dtor(EX_VAR(brk_opline->op1.var)); + } } ZEND_VM_JMP(opline->op1.jmp_addr); } @@ -4682,49 +4679,48 @@ ZEND_VM_HANDLER(115, ZEND_ISSET_ISEMPTY_DIM_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV if (Z_TYPE_P(container) == IS_ARRAY) { HashTable *ht = Z_ARRVAL_P(container); - zval *value = NULL; + zval *value; zend_string *str; ZEND_VM_C_LABEL(isset_again): - switch (Z_TYPE_P(offset)) { - case IS_DOUBLE: - hval = zend_dval_to_lval(Z_DVAL_P(offset)); - ZEND_VM_C_GOTO(num_index_prop); - case IS_LONG: - hval = Z_LVAL_P(offset); -ZEND_VM_C_LABEL(num_index_prop): - value = zend_hash_index_find(ht, hval); - break; - case IS_STRING: - str = Z_STR_P(offset); - if (OP2_TYPE != IS_CONST) { - if (ZEND_HANDLE_NUMERIC(str, hval)) { - ZEND_VM_C_GOTO(num_index_prop); - } + if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) { + str = Z_STR_P(offset); + if (OP2_TYPE != IS_CONST) { + if (ZEND_HANDLE_NUMERIC(str, hval)) { + ZEND_VM_C_GOTO(num_index_prop); } + } ZEND_VM_C_LABEL(str_index_prop): - value = zend_hash_find_ind(ht, str); - break; - case IS_NULL: - str = STR_EMPTY_ALLOC(); - ZEND_VM_C_GOTO(str_index_prop); - break; - case IS_FALSE: - hval = 0; - ZEND_VM_C_GOTO(num_index_prop); - case IS_TRUE: - hval = 0; - ZEND_VM_C_GOTO(num_index_prop); - case IS_RESOURCE: - hval = Z_RES_HANDLE_P(offset); - ZEND_VM_C_GOTO(num_index_prop); - case IS_REFERENCE: - offset = Z_REFVAL_P(offset); - ZEND_VM_C_GOTO(isset_again); - break; - default: - zend_error(E_WARNING, "Illegal offset type in isset or empty"); - break; + value = zend_hash_find_ind(ht, str); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); +ZEND_VM_C_LABEL(num_index_prop): + value = zend_hash_index_find(ht, hval); + } else { + switch (Z_TYPE_P(offset)) { + case IS_DOUBLE: + hval = zend_dval_to_lval(Z_DVAL_P(offset)); + ZEND_VM_C_GOTO(num_index_prop); + case IS_NULL: + str = STR_EMPTY_ALLOC(); + ZEND_VM_C_GOTO(str_index_prop); + case IS_FALSE: + hval = 0; + ZEND_VM_C_GOTO(num_index_prop); + case IS_TRUE: + hval = 0; + ZEND_VM_C_GOTO(num_index_prop); + case IS_RESOURCE: + hval = Z_RES_HANDLE_P(offset); + ZEND_VM_C_GOTO(num_index_prop); + case IS_REFERENCE: + offset = Z_REFVAL_P(offset); + ZEND_VM_C_GOTO(isset_again); + default: + zend_error(E_WARNING, "Illegal offset type in isset or empty"); + value = NULL; + break; + } } if (opline->extended_value & ZEND_ISSET) { @@ -5255,17 +5251,14 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) catch_op_num >= EX(op_array)->brk_cont_array[i].brk) { zend_op *brk_opline = &EX(op_array)->opcodes[EX(op_array)->brk_cont_array[i].brk]; - switch (brk_opline->opcode) { - case ZEND_SWITCH_FREE: - if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { - zval_ptr_dtor(EX_VAR(brk_opline->op1.var)); - } - break; - case ZEND_FREE: - if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { - zval_dtor(EX_VAR(brk_opline->op1.var)); - } - break; + if (brk_opline->opcode == ZEND_SWITCH_FREE) { + if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { + zval_ptr_dtor(EX_VAR(brk_opline->op1.var)); + } + } else if (brk_opline->opcode == ZEND_FREE) { + if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { + zval_dtor(EX_VAR(brk_opline->op1.var)); + } } } } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index c391cffdb9..1babe8587c 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1265,17 +1265,14 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER catch_op_num >= EX(op_array)->brk_cont_array[i].brk) { zend_op *brk_opline = &EX(op_array)->opcodes[EX(op_array)->brk_cont_array[i].brk]; - switch (brk_opline->opcode) { - case ZEND_SWITCH_FREE: - if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { - zval_ptr_dtor(EX_VAR(brk_opline->op1.var)); - } - break; - case ZEND_FREE: - if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { - zval_dtor(EX_VAR(brk_opline->op1.var)); - } - break; + if (brk_opline->opcode == ZEND_SWITCH_FREE) { + if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { + zval_ptr_dtor(EX_VAR(brk_opline->op1.var)); + } + } else if (brk_opline->opcode == ZEND_FREE) { + if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { + zval_dtor(EX_VAR(brk_opline->op1.var)); + } } } } @@ -1707,17 +1704,14 @@ static int ZEND_FASTCALL ZEND_GOTO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) brk_opline = EX(op_array)->opcodes + el->brk; - switch (brk_opline->opcode) { - case ZEND_SWITCH_FREE: - if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { - zval_ptr_dtor(EX_VAR(brk_opline->op1.var)); - } - break; - case ZEND_FREE: - if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { - zval_dtor(EX_VAR(brk_opline->op1.var)); - } - break; + if (brk_opline->opcode == ZEND_SWITCH_FREE) { + if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { + zval_ptr_dtor(EX_VAR(brk_opline->op1.var)); + } + } else if (brk_opline->opcode == ZEND_FREE) { + if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { + zval_dtor(EX_VAR(brk_opline->op1.var)); + } } ZEND_VM_JMP(opline->op1.jmp_addr); } @@ -16042,49 +16036,48 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_CONST_HANDLER(ZEND if (Z_TYPE_P(container) == IS_ARRAY) { HashTable *ht = Z_ARRVAL_P(container); - zval *value = NULL; + zval *value; zend_string *str; isset_again: - switch (Z_TYPE_P(offset)) { - case IS_DOUBLE: - hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_prop; - case IS_LONG: - hval = Z_LVAL_P(offset); -num_index_prop: - value = zend_hash_index_find(ht, hval); - break; - case IS_STRING: - str = Z_STR_P(offset); - if (IS_CONST != IS_CONST) { - if (ZEND_HANDLE_NUMERIC(str, hval)) { - goto num_index_prop; - } + if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) { + str = Z_STR_P(offset); + if (IS_CONST != IS_CONST) { + if (ZEND_HANDLE_NUMERIC(str, hval)) { + goto num_index_prop; } + } str_index_prop: - value = zend_hash_find_ind(ht, str); - break; - case IS_NULL: - str = STR_EMPTY_ALLOC(); - goto str_index_prop; - break; - case IS_FALSE: - hval = 0; - goto num_index_prop; - case IS_TRUE: - hval = 0; - goto num_index_prop; - case IS_RESOURCE: - hval = Z_RES_HANDLE_P(offset); - goto num_index_prop; - case IS_REFERENCE: - offset = Z_REFVAL_P(offset); - goto isset_again; - break; - default: - zend_error(E_WARNING, "Illegal offset type in isset or empty"); - break; + value = zend_hash_find_ind(ht, str); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); +num_index_prop: + value = zend_hash_index_find(ht, hval); + } else { + switch (Z_TYPE_P(offset)) { + case IS_DOUBLE: + hval = zend_dval_to_lval(Z_DVAL_P(offset)); + goto num_index_prop; + case IS_NULL: + str = STR_EMPTY_ALLOC(); + goto str_index_prop; + case IS_FALSE: + hval = 0; + goto num_index_prop; + case IS_TRUE: + hval = 0; + goto num_index_prop; + case IS_RESOURCE: + hval = Z_RES_HANDLE_P(offset); + goto num_index_prop; + case IS_REFERENCE: + offset = Z_REFVAL_P(offset); + goto isset_again; + default: + zend_error(E_WARNING, "Illegal offset type in isset or empty"); + value = NULL; + break; + } } if (opline->extended_value & ZEND_ISSET) { @@ -18033,49 +18026,48 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_O if (Z_TYPE_P(container) == IS_ARRAY) { HashTable *ht = Z_ARRVAL_P(container); - zval *value = NULL; + zval *value; zend_string *str; isset_again: - switch (Z_TYPE_P(offset)) { - case IS_DOUBLE: - hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_prop; - case IS_LONG: - hval = Z_LVAL_P(offset); -num_index_prop: - value = zend_hash_index_find(ht, hval); - break; - case IS_STRING: - str = Z_STR_P(offset); - if (IS_TMP_VAR != IS_CONST) { - if (ZEND_HANDLE_NUMERIC(str, hval)) { - goto num_index_prop; - } + if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) { + str = Z_STR_P(offset); + if (IS_TMP_VAR != IS_CONST) { + if (ZEND_HANDLE_NUMERIC(str, hval)) { + goto num_index_prop; } + } str_index_prop: - value = zend_hash_find_ind(ht, str); - break; - case IS_NULL: - str = STR_EMPTY_ALLOC(); - goto str_index_prop; - break; - case IS_FALSE: - hval = 0; - goto num_index_prop; - case IS_TRUE: - hval = 0; - goto num_index_prop; - case IS_RESOURCE: - hval = Z_RES_HANDLE_P(offset); - goto num_index_prop; - case IS_REFERENCE: - offset = Z_REFVAL_P(offset); - goto isset_again; - break; - default: - zend_error(E_WARNING, "Illegal offset type in isset or empty"); - break; + value = zend_hash_find_ind(ht, str); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); +num_index_prop: + value = zend_hash_index_find(ht, hval); + } else { + switch (Z_TYPE_P(offset)) { + case IS_DOUBLE: + hval = zend_dval_to_lval(Z_DVAL_P(offset)); + goto num_index_prop; + case IS_NULL: + str = STR_EMPTY_ALLOC(); + goto str_index_prop; + case IS_FALSE: + hval = 0; + goto num_index_prop; + case IS_TRUE: + hval = 0; + goto num_index_prop; + case IS_RESOURCE: + hval = Z_RES_HANDLE_P(offset); + goto num_index_prop; + case IS_REFERENCE: + offset = Z_REFVAL_P(offset); + goto isset_again; + default: + zend_error(E_WARNING, "Illegal offset type in isset or empty"); + value = NULL; + break; + } } if (opline->extended_value & ZEND_ISSET) { @@ -20389,49 +20381,48 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_O if (Z_TYPE_P(container) == IS_ARRAY) { HashTable *ht = Z_ARRVAL_P(container); - zval *value = NULL; + zval *value; zend_string *str; isset_again: - switch (Z_TYPE_P(offset)) { - case IS_DOUBLE: - hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_prop; - case IS_LONG: - hval = Z_LVAL_P(offset); -num_index_prop: - value = zend_hash_index_find(ht, hval); - break; - case IS_STRING: - str = Z_STR_P(offset); - if (IS_VAR != IS_CONST) { - if (ZEND_HANDLE_NUMERIC(str, hval)) { - goto num_index_prop; - } + if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) { + str = Z_STR_P(offset); + if (IS_VAR != IS_CONST) { + if (ZEND_HANDLE_NUMERIC(str, hval)) { + goto num_index_prop; } + } str_index_prop: - value = zend_hash_find_ind(ht, str); - break; - case IS_NULL: - str = STR_EMPTY_ALLOC(); - goto str_index_prop; - break; - case IS_FALSE: - hval = 0; - goto num_index_prop; - case IS_TRUE: - hval = 0; - goto num_index_prop; - case IS_RESOURCE: - hval = Z_RES_HANDLE_P(offset); - goto num_index_prop; - case IS_REFERENCE: - offset = Z_REFVAL_P(offset); - goto isset_again; - break; - default: - zend_error(E_WARNING, "Illegal offset type in isset or empty"); - break; + value = zend_hash_find_ind(ht, str); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); +num_index_prop: + value = zend_hash_index_find(ht, hval); + } else { + switch (Z_TYPE_P(offset)) { + case IS_DOUBLE: + hval = zend_dval_to_lval(Z_DVAL_P(offset)); + goto num_index_prop; + case IS_NULL: + str = STR_EMPTY_ALLOC(); + goto str_index_prop; + case IS_FALSE: + hval = 0; + goto num_index_prop; + case IS_TRUE: + hval = 0; + goto num_index_prop; + case IS_RESOURCE: + hval = Z_RES_HANDLE_P(offset); + goto num_index_prop; + case IS_REFERENCE: + offset = Z_REFVAL_P(offset); + goto isset_again; + default: + zend_error(E_WARNING, "Illegal offset type in isset or empty"); + value = NULL; + break; + } } if (opline->extended_value & ZEND_ISSET) { @@ -23622,49 +23613,48 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OP if (Z_TYPE_P(container) == IS_ARRAY) { HashTable *ht = Z_ARRVAL_P(container); - zval *value = NULL; + zval *value; zend_string *str; isset_again: - switch (Z_TYPE_P(offset)) { - case IS_DOUBLE: - hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_prop; - case IS_LONG: - hval = Z_LVAL_P(offset); -num_index_prop: - value = zend_hash_index_find(ht, hval); - break; - case IS_STRING: - str = Z_STR_P(offset); - if (IS_CV != IS_CONST) { - if (ZEND_HANDLE_NUMERIC(str, hval)) { - goto num_index_prop; - } + if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) { + str = Z_STR_P(offset); + if (IS_CV != IS_CONST) { + if (ZEND_HANDLE_NUMERIC(str, hval)) { + goto num_index_prop; } + } str_index_prop: - value = zend_hash_find_ind(ht, str); - break; - case IS_NULL: - str = STR_EMPTY_ALLOC(); - goto str_index_prop; - break; - case IS_FALSE: - hval = 0; - goto num_index_prop; - case IS_TRUE: - hval = 0; - goto num_index_prop; - case IS_RESOURCE: - hval = Z_RES_HANDLE_P(offset); - goto num_index_prop; - case IS_REFERENCE: - offset = Z_REFVAL_P(offset); - goto isset_again; - break; - default: - zend_error(E_WARNING, "Illegal offset type in isset or empty"); - break; + value = zend_hash_find_ind(ht, str); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); +num_index_prop: + value = zend_hash_index_find(ht, hval); + } else { + switch (Z_TYPE_P(offset)) { + case IS_DOUBLE: + hval = zend_dval_to_lval(Z_DVAL_P(offset)); + goto num_index_prop; + case IS_NULL: + str = STR_EMPTY_ALLOC(); + goto str_index_prop; + case IS_FALSE: + hval = 0; + goto num_index_prop; + case IS_TRUE: + hval = 0; + goto num_index_prop; + case IS_RESOURCE: + hval = Z_RES_HANDLE_P(offset); + goto num_index_prop; + case IS_REFERENCE: + offset = Z_REFVAL_P(offset); + goto isset_again; + default: + zend_error(E_WARNING, "Illegal offset type in isset or empty"); + value = NULL; + break; + } } if (opline->extended_value & ZEND_ISSET) { @@ -25091,49 +25081,48 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_CONST_HANDLER(Z if (Z_TYPE_P(container) == IS_ARRAY) { HashTable *ht = Z_ARRVAL_P(container); - zval *value = NULL; + zval *value; zend_string *str; isset_again: - switch (Z_TYPE_P(offset)) { - case IS_DOUBLE: - hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_prop; - case IS_LONG: - hval = Z_LVAL_P(offset); -num_index_prop: - value = zend_hash_index_find(ht, hval); - break; - case IS_STRING: - str = Z_STR_P(offset); - if (IS_CONST != IS_CONST) { - if (ZEND_HANDLE_NUMERIC(str, hval)) { - goto num_index_prop; - } + if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) { + str = Z_STR_P(offset); + if (IS_CONST != IS_CONST) { + if (ZEND_HANDLE_NUMERIC(str, hval)) { + goto num_index_prop; } + } str_index_prop: - value = zend_hash_find_ind(ht, str); - break; - case IS_NULL: - str = STR_EMPTY_ALLOC(); - goto str_index_prop; - break; - case IS_FALSE: - hval = 0; - goto num_index_prop; - case IS_TRUE: - hval = 0; - goto num_index_prop; - case IS_RESOURCE: - hval = Z_RES_HANDLE_P(offset); - goto num_index_prop; - case IS_REFERENCE: - offset = Z_REFVAL_P(offset); - goto isset_again; - break; - default: - zend_error(E_WARNING, "Illegal offset type in isset or empty"); - break; + value = zend_hash_find_ind(ht, str); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); +num_index_prop: + value = zend_hash_index_find(ht, hval); + } else { + switch (Z_TYPE_P(offset)) { + case IS_DOUBLE: + hval = zend_dval_to_lval(Z_DVAL_P(offset)); + goto num_index_prop; + case IS_NULL: + str = STR_EMPTY_ALLOC(); + goto str_index_prop; + case IS_FALSE: + hval = 0; + goto num_index_prop; + case IS_TRUE: + hval = 0; + goto num_index_prop; + case IS_RESOURCE: + hval = Z_RES_HANDLE_P(offset); + goto num_index_prop; + case IS_REFERENCE: + offset = Z_REFVAL_P(offset); + goto isset_again; + default: + zend_error(E_WARNING, "Illegal offset type in isset or empty"); + value = NULL; + break; + } } if (opline->extended_value & ZEND_ISSET) { @@ -26377,49 +26366,48 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEN if (Z_TYPE_P(container) == IS_ARRAY) { HashTable *ht = Z_ARRVAL_P(container); - zval *value = NULL; + zval *value; zend_string *str; isset_again: - switch (Z_TYPE_P(offset)) { - case IS_DOUBLE: - hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_prop; - case IS_LONG: - hval = Z_LVAL_P(offset); -num_index_prop: - value = zend_hash_index_find(ht, hval); - break; - case IS_STRING: - str = Z_STR_P(offset); - if (IS_TMP_VAR != IS_CONST) { - if (ZEND_HANDLE_NUMERIC(str, hval)) { - goto num_index_prop; - } + if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) { + str = Z_STR_P(offset); + if (IS_TMP_VAR != IS_CONST) { + if (ZEND_HANDLE_NUMERIC(str, hval)) { + goto num_index_prop; } + } str_index_prop: - value = zend_hash_find_ind(ht, str); - break; - case IS_NULL: - str = STR_EMPTY_ALLOC(); - goto str_index_prop; - break; - case IS_FALSE: - hval = 0; - goto num_index_prop; - case IS_TRUE: - hval = 0; - goto num_index_prop; - case IS_RESOURCE: - hval = Z_RES_HANDLE_P(offset); - goto num_index_prop; - case IS_REFERENCE: - offset = Z_REFVAL_P(offset); - goto isset_again; - break; - default: - zend_error(E_WARNING, "Illegal offset type in isset or empty"); - break; + value = zend_hash_find_ind(ht, str); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); +num_index_prop: + value = zend_hash_index_find(ht, hval); + } else { + switch (Z_TYPE_P(offset)) { + case IS_DOUBLE: + hval = zend_dval_to_lval(Z_DVAL_P(offset)); + goto num_index_prop; + case IS_NULL: + str = STR_EMPTY_ALLOC(); + goto str_index_prop; + case IS_FALSE: + hval = 0; + goto num_index_prop; + case IS_TRUE: + hval = 0; + goto num_index_prop; + case IS_RESOURCE: + hval = Z_RES_HANDLE_P(offset); + goto num_index_prop; + case IS_REFERENCE: + offset = Z_REFVAL_P(offset); + goto isset_again; + default: + zend_error(E_WARNING, "Illegal offset type in isset or empty"); + value = NULL; + break; + } } if (opline->extended_value & ZEND_ISSET) { @@ -27665,49 +27653,48 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEN if (Z_TYPE_P(container) == IS_ARRAY) { HashTable *ht = Z_ARRVAL_P(container); - zval *value = NULL; + zval *value; zend_string *str; isset_again: - switch (Z_TYPE_P(offset)) { - case IS_DOUBLE: - hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_prop; - case IS_LONG: - hval = Z_LVAL_P(offset); -num_index_prop: - value = zend_hash_index_find(ht, hval); - break; - case IS_STRING: - str = Z_STR_P(offset); - if (IS_VAR != IS_CONST) { - if (ZEND_HANDLE_NUMERIC(str, hval)) { - goto num_index_prop; - } + if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) { + str = Z_STR_P(offset); + if (IS_VAR != IS_CONST) { + if (ZEND_HANDLE_NUMERIC(str, hval)) { + goto num_index_prop; } + } str_index_prop: - value = zend_hash_find_ind(ht, str); - break; - case IS_NULL: - str = STR_EMPTY_ALLOC(); - goto str_index_prop; - break; - case IS_FALSE: - hval = 0; - goto num_index_prop; - case IS_TRUE: - hval = 0; - goto num_index_prop; - case IS_RESOURCE: - hval = Z_RES_HANDLE_P(offset); - goto num_index_prop; - case IS_REFERENCE: - offset = Z_REFVAL_P(offset); - goto isset_again; - break; - default: - zend_error(E_WARNING, "Illegal offset type in isset or empty"); - break; + value = zend_hash_find_ind(ht, str); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); +num_index_prop: + value = zend_hash_index_find(ht, hval); + } else { + switch (Z_TYPE_P(offset)) { + case IS_DOUBLE: + hval = zend_dval_to_lval(Z_DVAL_P(offset)); + goto num_index_prop; + case IS_NULL: + str = STR_EMPTY_ALLOC(); + goto str_index_prop; + case IS_FALSE: + hval = 0; + goto num_index_prop; + case IS_TRUE: + hval = 0; + goto num_index_prop; + case IS_RESOURCE: + hval = Z_RES_HANDLE_P(offset); + goto num_index_prop; + case IS_REFERENCE: + offset = Z_REFVAL_P(offset); + goto isset_again; + default: + zend_error(E_WARNING, "Illegal offset type in isset or empty"); + value = NULL; + break; + } } if (opline->extended_value & ZEND_ISSET) { @@ -29468,49 +29455,48 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND if (Z_TYPE_P(container) == IS_ARRAY) { HashTable *ht = Z_ARRVAL_P(container); - zval *value = NULL; + zval *value; zend_string *str; isset_again: - switch (Z_TYPE_P(offset)) { - case IS_DOUBLE: - hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_prop; - case IS_LONG: - hval = Z_LVAL_P(offset); -num_index_prop: - value = zend_hash_index_find(ht, hval); - break; - case IS_STRING: - str = Z_STR_P(offset); - if (IS_CV != IS_CONST) { - if (ZEND_HANDLE_NUMERIC(str, hval)) { - goto num_index_prop; - } + if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) { + str = Z_STR_P(offset); + if (IS_CV != IS_CONST) { + if (ZEND_HANDLE_NUMERIC(str, hval)) { + goto num_index_prop; } + } str_index_prop: - value = zend_hash_find_ind(ht, str); - break; - case IS_NULL: - str = STR_EMPTY_ALLOC(); - goto str_index_prop; - break; - case IS_FALSE: - hval = 0; - goto num_index_prop; - case IS_TRUE: - hval = 0; - goto num_index_prop; - case IS_RESOURCE: - hval = Z_RES_HANDLE_P(offset); - goto num_index_prop; - case IS_REFERENCE: - offset = Z_REFVAL_P(offset); - goto isset_again; - break; - default: - zend_error(E_WARNING, "Illegal offset type in isset or empty"); - break; + value = zend_hash_find_ind(ht, str); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); +num_index_prop: + value = zend_hash_index_find(ht, hval); + } else { + switch (Z_TYPE_P(offset)) { + case IS_DOUBLE: + hval = zend_dval_to_lval(Z_DVAL_P(offset)); + goto num_index_prop; + case IS_NULL: + str = STR_EMPTY_ALLOC(); + goto str_index_prop; + case IS_FALSE: + hval = 0; + goto num_index_prop; + case IS_TRUE: + hval = 0; + goto num_index_prop; + case IS_RESOURCE: + hval = Z_RES_HANDLE_P(offset); + goto num_index_prop; + case IS_REFERENCE: + offset = Z_REFVAL_P(offset); + goto isset_again; + default: + zend_error(E_WARNING, "Illegal offset type in isset or empty"); + value = NULL; + break; + } } if (opline->extended_value & ZEND_ISSET) { @@ -32906,49 +32892,48 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_CONST_HANDLER(ZEND_ if (Z_TYPE_P(container) == IS_ARRAY) { HashTable *ht = Z_ARRVAL_P(container); - zval *value = NULL; + zval *value; zend_string *str; isset_again: - switch (Z_TYPE_P(offset)) { - case IS_DOUBLE: - hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_prop; - case IS_LONG: - hval = Z_LVAL_P(offset); -num_index_prop: - value = zend_hash_index_find(ht, hval); - break; - case IS_STRING: - str = Z_STR_P(offset); - if (IS_CONST != IS_CONST) { - if (ZEND_HANDLE_NUMERIC(str, hval)) { - goto num_index_prop; - } + if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) { + str = Z_STR_P(offset); + if (IS_CONST != IS_CONST) { + if (ZEND_HANDLE_NUMERIC(str, hval)) { + goto num_index_prop; } + } str_index_prop: - value = zend_hash_find_ind(ht, str); - break; - case IS_NULL: - str = STR_EMPTY_ALLOC(); - goto str_index_prop; - break; - case IS_FALSE: - hval = 0; - goto num_index_prop; - case IS_TRUE: - hval = 0; - goto num_index_prop; - case IS_RESOURCE: - hval = Z_RES_HANDLE_P(offset); - goto num_index_prop; - case IS_REFERENCE: - offset = Z_REFVAL_P(offset); - goto isset_again; - break; - default: - zend_error(E_WARNING, "Illegal offset type in isset or empty"); - break; + value = zend_hash_find_ind(ht, str); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); +num_index_prop: + value = zend_hash_index_find(ht, hval); + } else { + switch (Z_TYPE_P(offset)) { + case IS_DOUBLE: + hval = zend_dval_to_lval(Z_DVAL_P(offset)); + goto num_index_prop; + case IS_NULL: + str = STR_EMPTY_ALLOC(); + goto str_index_prop; + case IS_FALSE: + hval = 0; + goto num_index_prop; + case IS_TRUE: + hval = 0; + goto num_index_prop; + case IS_RESOURCE: + hval = Z_RES_HANDLE_P(offset); + goto num_index_prop; + case IS_REFERENCE: + offset = Z_REFVAL_P(offset); + goto isset_again; + default: + zend_error(E_WARNING, "Illegal offset type in isset or empty"); + value = NULL; + break; + } } if (opline->extended_value & ZEND_ISSET) { @@ -34780,49 +34765,48 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OP if (Z_TYPE_P(container) == IS_ARRAY) { HashTable *ht = Z_ARRVAL_P(container); - zval *value = NULL; + zval *value; zend_string *str; isset_again: - switch (Z_TYPE_P(offset)) { - case IS_DOUBLE: - hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_prop; - case IS_LONG: - hval = Z_LVAL_P(offset); -num_index_prop: - value = zend_hash_index_find(ht, hval); - break; - case IS_STRING: - str = Z_STR_P(offset); - if (IS_TMP_VAR != IS_CONST) { - if (ZEND_HANDLE_NUMERIC(str, hval)) { - goto num_index_prop; - } + if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) { + str = Z_STR_P(offset); + if (IS_TMP_VAR != IS_CONST) { + if (ZEND_HANDLE_NUMERIC(str, hval)) { + goto num_index_prop; } + } str_index_prop: - value = zend_hash_find_ind(ht, str); - break; - case IS_NULL: - str = STR_EMPTY_ALLOC(); - goto str_index_prop; - break; - case IS_FALSE: - hval = 0; - goto num_index_prop; - case IS_TRUE: - hval = 0; - goto num_index_prop; - case IS_RESOURCE: - hval = Z_RES_HANDLE_P(offset); - goto num_index_prop; - case IS_REFERENCE: - offset = Z_REFVAL_P(offset); - goto isset_again; - break; - default: - zend_error(E_WARNING, "Illegal offset type in isset or empty"); - break; + value = zend_hash_find_ind(ht, str); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); +num_index_prop: + value = zend_hash_index_find(ht, hval); + } else { + switch (Z_TYPE_P(offset)) { + case IS_DOUBLE: + hval = zend_dval_to_lval(Z_DVAL_P(offset)); + goto num_index_prop; + case IS_NULL: + str = STR_EMPTY_ALLOC(); + goto str_index_prop; + case IS_FALSE: + hval = 0; + goto num_index_prop; + case IS_TRUE: + hval = 0; + goto num_index_prop; + case IS_RESOURCE: + hval = Z_RES_HANDLE_P(offset); + goto num_index_prop; + case IS_REFERENCE: + offset = Z_REFVAL_P(offset); + goto isset_again; + default: + zend_error(E_WARNING, "Illegal offset type in isset or empty"); + value = NULL; + break; + } } if (opline->extended_value & ZEND_ISSET) { @@ -37018,49 +37002,48 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OP if (Z_TYPE_P(container) == IS_ARRAY) { HashTable *ht = Z_ARRVAL_P(container); - zval *value = NULL; + zval *value; zend_string *str; isset_again: - switch (Z_TYPE_P(offset)) { - case IS_DOUBLE: - hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_prop; - case IS_LONG: - hval = Z_LVAL_P(offset); -num_index_prop: - value = zend_hash_index_find(ht, hval); - break; - case IS_STRING: - str = Z_STR_P(offset); - if (IS_VAR != IS_CONST) { - if (ZEND_HANDLE_NUMERIC(str, hval)) { - goto num_index_prop; - } + if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) { + str = Z_STR_P(offset); + if (IS_VAR != IS_CONST) { + if (ZEND_HANDLE_NUMERIC(str, hval)) { + goto num_index_prop; } + } str_index_prop: - value = zend_hash_find_ind(ht, str); - break; - case IS_NULL: - str = STR_EMPTY_ALLOC(); - goto str_index_prop; - break; - case IS_FALSE: - hval = 0; - goto num_index_prop; - case IS_TRUE: - hval = 0; - goto num_index_prop; - case IS_RESOURCE: - hval = Z_RES_HANDLE_P(offset); - goto num_index_prop; - case IS_REFERENCE: - offset = Z_REFVAL_P(offset); - goto isset_again; - break; - default: - zend_error(E_WARNING, "Illegal offset type in isset or empty"); - break; + value = zend_hash_find_ind(ht, str); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); +num_index_prop: + value = zend_hash_index_find(ht, hval); + } else { + switch (Z_TYPE_P(offset)) { + case IS_DOUBLE: + hval = zend_dval_to_lval(Z_DVAL_P(offset)); + goto num_index_prop; + case IS_NULL: + str = STR_EMPTY_ALLOC(); + goto str_index_prop; + case IS_FALSE: + hval = 0; + goto num_index_prop; + case IS_TRUE: + hval = 0; + goto num_index_prop; + case IS_RESOURCE: + hval = Z_RES_HANDLE_P(offset); + goto num_index_prop; + case IS_REFERENCE: + offset = Z_REFVAL_P(offset); + goto isset_again; + default: + zend_error(E_WARNING, "Illegal offset type in isset or empty"); + value = NULL; + break; + } } if (opline->extended_value & ZEND_ISSET) { @@ -39999,49 +39982,48 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPC if (Z_TYPE_P(container) == IS_ARRAY) { HashTable *ht = Z_ARRVAL_P(container); - zval *value = NULL; + zval *value; zend_string *str; isset_again: - switch (Z_TYPE_P(offset)) { - case IS_DOUBLE: - hval = zend_dval_to_lval(Z_DVAL_P(offset)); - goto num_index_prop; - case IS_LONG: - hval = Z_LVAL_P(offset); -num_index_prop: - value = zend_hash_index_find(ht, hval); - break; - case IS_STRING: - str = Z_STR_P(offset); - if (IS_CV != IS_CONST) { - if (ZEND_HANDLE_NUMERIC(str, hval)) { - goto num_index_prop; - } + if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) { + str = Z_STR_P(offset); + if (IS_CV != IS_CONST) { + if (ZEND_HANDLE_NUMERIC(str, hval)) { + goto num_index_prop; } + } str_index_prop: - value = zend_hash_find_ind(ht, str); - break; - case IS_NULL: - str = STR_EMPTY_ALLOC(); - goto str_index_prop; - break; - case IS_FALSE: - hval = 0; - goto num_index_prop; - case IS_TRUE: - hval = 0; - goto num_index_prop; - case IS_RESOURCE: - hval = Z_RES_HANDLE_P(offset); - goto num_index_prop; - case IS_REFERENCE: - offset = Z_REFVAL_P(offset); - goto isset_again; - break; - default: - zend_error(E_WARNING, "Illegal offset type in isset or empty"); - break; + value = zend_hash_find_ind(ht, str); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); +num_index_prop: + value = zend_hash_index_find(ht, hval); + } else { + switch (Z_TYPE_P(offset)) { + case IS_DOUBLE: + hval = zend_dval_to_lval(Z_DVAL_P(offset)); + goto num_index_prop; + case IS_NULL: + str = STR_EMPTY_ALLOC(); + goto str_index_prop; + case IS_FALSE: + hval = 0; + goto num_index_prop; + case IS_TRUE: + hval = 0; + goto num_index_prop; + case IS_RESOURCE: + hval = Z_RES_HANDLE_P(offset); + goto num_index_prop; + case IS_REFERENCE: + offset = Z_REFVAL_P(offset); + goto isset_again; + default: + zend_error(E_WARNING, "Illegal offset type in isset or empty"); + value = NULL; + break; + } } if (opline->extended_value & ZEND_ISSET) {