summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2016-04-12 22:53:01 +0300
committerDmitry Stogov <dmitry@zend.com>2016-04-12 22:53:01 +0300
commit23b65bf7322f8f624543db7a0152a432ea2b53c2 (patch)
tree5c6110046fb2f5557291d9a92a15cbaafe026b9a
parent43b16180232bb94a9557228bf25da65cdc921b37 (diff)
downloadphp-git-23b65bf7322f8f624543db7a0152a432ea2b53c2.tar.gz
Reuse zend_fetch_dimension_address_read() for FETCH_LIST
-rw-r--r--Zend/zend_execute.c13
-rw-r--r--Zend/zend_vm_def.h89
-rw-r--r--Zend/zend_vm_execute.h773
3 files changed, 25 insertions, 850 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index be01bc7fc8..52e4f5bc35 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -1765,7 +1765,7 @@ static zend_never_inline void zend_fetch_dimension_address_UNSET(zval *result, z
zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_UNSET);
}
-static zend_always_inline void zend_fetch_dimension_address_read(zval *result, zval *container, zval *dim, int dim_type, int type)
+static zend_always_inline void zend_fetch_dimension_address_read(zval *result, zval *container, zval *dim, int dim_type, int type, int support_strings)
{
zval *retval;
@@ -1780,7 +1780,7 @@ try_array:
goto try_array;
}
}
- if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) {
+ if (support_strings && EXPECTED(Z_TYPE_P(container) == IS_STRING)) {
zend_long offset;
try_string_offset:
@@ -1862,12 +1862,17 @@ try_string_offset:
static zend_never_inline void zend_fetch_dimension_address_read_R(zval *result, zval *container, zval *dim, int dim_type)
{
- zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R);
+ zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R, 1);
}
static zend_never_inline void zend_fetch_dimension_address_read_IS(zval *result, zval *container, zval *dim, int dim_type)
{
- zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_IS);
+ zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_IS, 1);
+}
+
+static zend_never_inline void zend_fetch_dimension_address_read_LIST(zval *result, zval *container, zval *dim)
+{
+ zend_fetch_dimension_address_read(result, container, dim, IS_TMP_VAR, BP_VAR_R, 0);
}
ZEND_API void zend_fetch_dimension_by_zval(zval *result, zval *container, zval *dim)
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 26cee42d41..ad77fe0c57 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -2065,95 +2065,12 @@ ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV)
ZEND_VM_HANDLER(98, ZEND_FETCH_LIST, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1;
- zend_free_op free_op2;
+ zend_free_op free_op1, free_op2;
zval *container;
- zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
SAVE_OPLINE();
- container = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
-
-ZEND_VM_C_LABEL(try_fetch_list):
- if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
- zval *value;
- zend_string *str;
- zend_ulong hval;
-
-ZEND_VM_C_LABEL(assign_again_list):
- if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
- hval = Z_LVAL_P(offset);
-ZEND_VM_C_LABEL(num_index_list):
- value = zend_hash_index_find(Z_ARRVAL_P(container), hval);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined offset: " ZEND_ULONG_FMT, hval);
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
- str = Z_STR_P(offset);
-
- if (ZEND_HANDLE_NUMERIC(str, hval)) {
- ZEND_VM_C_GOTO(num_index_list);
- }
-
-ZEND_VM_C_LABEL(str_index_list):
- value = zend_hash_find(Z_ARRVAL_P(container), str);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(str));
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(str != Z_STR_P(offset))) {
- zend_string_release(str);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) {
- offset = Z_REFVAL_P(offset);
- ZEND_VM_C_GOTO(assign_again_list);
- } else if (Z_TYPE_P(offset) == IS_NULL) {
- str = ZSTR_EMPTY_ALLOC();
- ZEND_VM_C_GOTO(str_index_list);
- } else if (Z_TYPE_P(offset) == IS_DOUBLE) {
- hval = zend_dval_to_lval(Z_DVAL_P(offset));
- ZEND_VM_C_GOTO(num_index_list);
- } else if (Z_TYPE_P(offset) == IS_FALSE) {
- hval = 0;
- ZEND_VM_C_GOTO(num_index_list);
- } else if (Z_TYPE_P(offset) == IS_TRUE) {
- hval = 1;
- ZEND_VM_C_GOTO(num_index_list);
- } else if (Z_TYPE_P(offset) == IS_RESOURCE) {
- zend_error(E_NOTICE, "Resource ID#%pd used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(offset), Z_RES_HANDLE_P(offset));
- hval = Z_RES_HANDLE_P(offset);
- ZEND_VM_C_GOTO(num_index_list);
- } else {
- zend_error(E_WARNING, "Illegal offset type");
- }
- } else if (OP1_TYPE != IS_CONST &&
- UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) &&
- EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) {
- zval *result = EX_VAR(opline->result.var);
- zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, offset, BP_VAR_R, result);
-
- if (retval) {
- if (result != retval) {
- ZVAL_COPY(result, retval);
- }
- } else {
- ZVAL_NULL(result);
- }
- } else if ((OP1_TYPE & (IS_VAR|IS_CV)) && Z_TYPE_P(container) == IS_REFERENCE) {
- container = Z_REFVAL_P(container);
- ZEND_VM_C_GOTO(try_fetch_list);
- } else {
- if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- GET_OP1_UNDEF_CV(container, BP_VAR_R);
- }
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
+ container = GET_OP1_ZVAL_PTR(BP_VAR_R);
+ zend_fetch_dimension_address_read_LIST(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R));
FREE_OP2();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index a96933389f..2b8cb15eac 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -5300,94 +5300,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_SPEC_CONST_CONST_HA
{
USE_OPLINE
-
zval *container;
- zval *offset = EX_CONSTANT(opline->op2);
SAVE_OPLINE();
container = EX_CONSTANT(opline->op1);
-
-try_fetch_list:
- if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
- zval *value;
- zend_string *str;
- zend_ulong hval;
-
-assign_again_list:
- if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
- hval = Z_LVAL_P(offset);
-num_index_list:
- value = zend_hash_index_find(Z_ARRVAL_P(container), hval);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined offset: " ZEND_ULONG_FMT, hval);
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
- str = Z_STR_P(offset);
-
- if (ZEND_HANDLE_NUMERIC(str, hval)) {
- goto num_index_list;
- }
-
-str_index_list:
- value = zend_hash_find(Z_ARRVAL_P(container), str);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(str));
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(str != Z_STR_P(offset))) {
- zend_string_release(str);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) {
- offset = Z_REFVAL_P(offset);
- goto assign_again_list;
- } else if (Z_TYPE_P(offset) == IS_NULL) {
- str = ZSTR_EMPTY_ALLOC();
- goto str_index_list;
- } else if (Z_TYPE_P(offset) == IS_DOUBLE) {
- hval = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_FALSE) {
- hval = 0;
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_TRUE) {
- hval = 1;
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_RESOURCE) {
- zend_error(E_NOTICE, "Resource ID#%pd used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(offset), Z_RES_HANDLE_P(offset));
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_list;
- } else {
- zend_error(E_WARNING, "Illegal offset type");
- }
- } else if (IS_CONST != IS_CONST &&
- UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) &&
- EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) {
- zval *result = EX_VAR(opline->result.var);
- zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, offset, BP_VAR_R, result);
-
- if (retval) {
- if (result != retval) {
- ZVAL_COPY(result, retval);
- }
- } else {
- ZVAL_NULL(result);
- }
- } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_TYPE_P(container) == IS_REFERENCE) {
- container = Z_REFVAL_P(container);
- goto try_fetch_list;
- } else {
- if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- GET_OP1_UNDEF_CV(container, BP_VAR_R);
- }
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
+ zend_fetch_dimension_address_read_LIST(EX_VAR(opline->result.var), container, EX_CONSTANT(opline->op2));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -9141,94 +9058,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_SPEC_CONST_CV_HANDL
{
USE_OPLINE
-
zval *container;
- zval *offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
SAVE_OPLINE();
container = EX_CONSTANT(opline->op1);
-
-try_fetch_list:
- if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
- zval *value;
- zend_string *str;
- zend_ulong hval;
-
-assign_again_list:
- if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
- hval = Z_LVAL_P(offset);
-num_index_list:
- value = zend_hash_index_find(Z_ARRVAL_P(container), hval);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined offset: " ZEND_ULONG_FMT, hval);
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
- str = Z_STR_P(offset);
-
- if (ZEND_HANDLE_NUMERIC(str, hval)) {
- goto num_index_list;
- }
-
-str_index_list:
- value = zend_hash_find(Z_ARRVAL_P(container), str);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(str));
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(str != Z_STR_P(offset))) {
- zend_string_release(str);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) {
- offset = Z_REFVAL_P(offset);
- goto assign_again_list;
- } else if (Z_TYPE_P(offset) == IS_NULL) {
- str = ZSTR_EMPTY_ALLOC();
- goto str_index_list;
- } else if (Z_TYPE_P(offset) == IS_DOUBLE) {
- hval = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_FALSE) {
- hval = 0;
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_TRUE) {
- hval = 1;
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_RESOURCE) {
- zend_error(E_NOTICE, "Resource ID#%pd used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(offset), Z_RES_HANDLE_P(offset));
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_list;
- } else {
- zend_error(E_WARNING, "Illegal offset type");
- }
- } else if (IS_CONST != IS_CONST &&
- UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) &&
- EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) {
- zval *result = EX_VAR(opline->result.var);
- zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, offset, BP_VAR_R, result);
-
- if (retval) {
- if (result != retval) {
- ZVAL_COPY(result, retval);
- }
- } else {
- ZVAL_NULL(result);
- }
- } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_TYPE_P(container) == IS_REFERENCE) {
- container = Z_REFVAL_P(container);
- goto try_fetch_list;
- } else {
- if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- GET_OP1_UNDEF_CV(container, BP_VAR_R);
- }
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
+ zend_fetch_dimension_address_read_LIST(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -11062,95 +10896,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CONST_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_free_op free_op2;
zval *container;
- zval *offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
SAVE_OPLINE();
container = EX_CONSTANT(opline->op1);
-
-try_fetch_list:
- if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
- zval *value;
- zend_string *str;
- zend_ulong hval;
-
-assign_again_list:
- if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
- hval = Z_LVAL_P(offset);
-num_index_list:
- value = zend_hash_index_find(Z_ARRVAL_P(container), hval);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined offset: " ZEND_ULONG_FMT, hval);
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
- str = Z_STR_P(offset);
-
- if (ZEND_HANDLE_NUMERIC(str, hval)) {
- goto num_index_list;
- }
-
-str_index_list:
- value = zend_hash_find(Z_ARRVAL_P(container), str);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(str));
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(str != Z_STR_P(offset))) {
- zend_string_release(str);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) {
- offset = Z_REFVAL_P(offset);
- goto assign_again_list;
- } else if (Z_TYPE_P(offset) == IS_NULL) {
- str = ZSTR_EMPTY_ALLOC();
- goto str_index_list;
- } else if (Z_TYPE_P(offset) == IS_DOUBLE) {
- hval = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_FALSE) {
- hval = 0;
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_TRUE) {
- hval = 1;
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_RESOURCE) {
- zend_error(E_NOTICE, "Resource ID#%pd used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(offset), Z_RES_HANDLE_P(offset));
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_list;
- } else {
- zend_error(E_WARNING, "Illegal offset type");
- }
- } else if (IS_CONST != IS_CONST &&
- UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) &&
- EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) {
- zval *result = EX_VAR(opline->result.var);
- zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, offset, BP_VAR_R, result);
-
- if (retval) {
- if (result != retval) {
- ZVAL_COPY(result, retval);
- }
- } else {
- ZVAL_NULL(result);
- }
- } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_TYPE_P(container) == IS_REFERENCE) {
- container = Z_REFVAL_P(container);
- goto try_fetch_list;
- } else {
- if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- GET_OP1_UNDEF_CV(container, BP_VAR_R);
- }
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
+ zend_fetch_dimension_address_read_LIST(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2));
zval_ptr_dtor_nogc(free_op2);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -37946,94 +37697,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_SPEC_CV_CONST_HANDL
{
USE_OPLINE
-
zval *container;
- zval *offset = EX_CONSTANT(opline->op2);
SAVE_OPLINE();
- container = _get_zval_ptr_cv_undef(execute_data, opline->op1.var);
-
-try_fetch_list:
- if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
- zval *value;
- zend_string *str;
- zend_ulong hval;
-
-assign_again_list:
- if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
- hval = Z_LVAL_P(offset);
-num_index_list:
- value = zend_hash_index_find(Z_ARRVAL_P(container), hval);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined offset: " ZEND_ULONG_FMT, hval);
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
- str = Z_STR_P(offset);
-
- if (ZEND_HANDLE_NUMERIC(str, hval)) {
- goto num_index_list;
- }
-
-str_index_list:
- value = zend_hash_find(Z_ARRVAL_P(container), str);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(str));
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(str != Z_STR_P(offset))) {
- zend_string_release(str);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) {
- offset = Z_REFVAL_P(offset);
- goto assign_again_list;
- } else if (Z_TYPE_P(offset) == IS_NULL) {
- str = ZSTR_EMPTY_ALLOC();
- goto str_index_list;
- } else if (Z_TYPE_P(offset) == IS_DOUBLE) {
- hval = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_FALSE) {
- hval = 0;
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_TRUE) {
- hval = 1;
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_RESOURCE) {
- zend_error(E_NOTICE, "Resource ID#%pd used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(offset), Z_RES_HANDLE_P(offset));
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_list;
- } else {
- zend_error(E_WARNING, "Illegal offset type");
- }
- } else if (IS_CV != IS_CONST &&
- UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) &&
- EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) {
- zval *result = EX_VAR(opline->result.var);
- zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, offset, BP_VAR_R, result);
-
- if (retval) {
- if (result != retval) {
- ZVAL_COPY(result, retval);
- }
- } else {
- ZVAL_NULL(result);
- }
- } else if ((IS_CV & (IS_VAR|IS_CV)) && Z_TYPE_P(container) == IS_REFERENCE) {
- container = Z_REFVAL_P(container);
- goto try_fetch_list;
- } else {
- if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- GET_OP1_UNDEF_CV(container, BP_VAR_R);
- }
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
+ container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var);
+ zend_fetch_dimension_address_read_LIST(EX_VAR(opline->result.var), container, EX_CONSTANT(opline->op2));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -44448,94 +44116,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_SPEC_CV_CV_HANDLER(
{
USE_OPLINE
-
zval *container;
- zval *offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
SAVE_OPLINE();
- container = _get_zval_ptr_cv_undef(execute_data, opline->op1.var);
-
-try_fetch_list:
- if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
- zval *value;
- zend_string *str;
- zend_ulong hval;
-
-assign_again_list:
- if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
- hval = Z_LVAL_P(offset);
-num_index_list:
- value = zend_hash_index_find(Z_ARRVAL_P(container), hval);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined offset: " ZEND_ULONG_FMT, hval);
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
- str = Z_STR_P(offset);
-
- if (ZEND_HANDLE_NUMERIC(str, hval)) {
- goto num_index_list;
- }
-
-str_index_list:
- value = zend_hash_find(Z_ARRVAL_P(container), str);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(str));
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(str != Z_STR_P(offset))) {
- zend_string_release(str);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) {
- offset = Z_REFVAL_P(offset);
- goto assign_again_list;
- } else if (Z_TYPE_P(offset) == IS_NULL) {
- str = ZSTR_EMPTY_ALLOC();
- goto str_index_list;
- } else if (Z_TYPE_P(offset) == IS_DOUBLE) {
- hval = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_FALSE) {
- hval = 0;
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_TRUE) {
- hval = 1;
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_RESOURCE) {
- zend_error(E_NOTICE, "Resource ID#%pd used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(offset), Z_RES_HANDLE_P(offset));
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_list;
- } else {
- zend_error(E_WARNING, "Illegal offset type");
- }
- } else if (IS_CV != IS_CONST &&
- UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) &&
- EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) {
- zval *result = EX_VAR(opline->result.var);
- zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, offset, BP_VAR_R, result);
-
- if (retval) {
- if (result != retval) {
- ZVAL_COPY(result, retval);
- }
- } else {
- ZVAL_NULL(result);
- }
- } else if ((IS_CV & (IS_VAR|IS_CV)) && Z_TYPE_P(container) == IS_REFERENCE) {
- container = Z_REFVAL_P(container);
- goto try_fetch_list;
- } else {
- if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- GET_OP1_UNDEF_CV(container, BP_VAR_R);
- }
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
+ container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var);
+ zend_fetch_dimension_address_read_LIST(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -48125,95 +47710,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_TMPVAR
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_free_op free_op2;
zval *container;
- zval *offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
SAVE_OPLINE();
- container = _get_zval_ptr_cv_undef(execute_data, opline->op1.var);
-
-try_fetch_list:
- if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
- zval *value;
- zend_string *str;
- zend_ulong hval;
-
-assign_again_list:
- if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
- hval = Z_LVAL_P(offset);
-num_index_list:
- value = zend_hash_index_find(Z_ARRVAL_P(container), hval);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined offset: " ZEND_ULONG_FMT, hval);
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
- str = Z_STR_P(offset);
-
- if (ZEND_HANDLE_NUMERIC(str, hval)) {
- goto num_index_list;
- }
-
-str_index_list:
- value = zend_hash_find(Z_ARRVAL_P(container), str);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(str));
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(str != Z_STR_P(offset))) {
- zend_string_release(str);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) {
- offset = Z_REFVAL_P(offset);
- goto assign_again_list;
- } else if (Z_TYPE_P(offset) == IS_NULL) {
- str = ZSTR_EMPTY_ALLOC();
- goto str_index_list;
- } else if (Z_TYPE_P(offset) == IS_DOUBLE) {
- hval = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_FALSE) {
- hval = 0;
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_TRUE) {
- hval = 1;
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_RESOURCE) {
- zend_error(E_NOTICE, "Resource ID#%pd used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(offset), Z_RES_HANDLE_P(offset));
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_list;
- } else {
- zend_error(E_WARNING, "Illegal offset type");
- }
- } else if (IS_CV != IS_CONST &&
- UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) &&
- EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) {
- zval *result = EX_VAR(opline->result.var);
- zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, offset, BP_VAR_R, result);
-
- if (retval) {
- if (result != retval) {
- ZVAL_COPY(result, retval);
- }
- } else {
- ZVAL_NULL(result);
- }
- } else if ((IS_CV & (IS_VAR|IS_CV)) && Z_TYPE_P(container) == IS_REFERENCE) {
- container = Z_REFVAL_P(container);
- goto try_fetch_list;
- } else {
- if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- GET_OP1_UNDEF_CV(container, BP_VAR_R);
- }
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
+ container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var);
+ zend_fetch_dimension_address_read_LIST(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2));
zval_ptr_dtor_nogc(free_op2);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -51464,94 +50966,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_SPEC_TMPVAR_CONST_H
{
USE_OPLINE
zend_free_op free_op1;
-
zval *container;
- zval *offset = EX_CONSTANT(opline->op2);
SAVE_OPLINE();
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
-
-try_fetch_list:
- if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
- zval *value;
- zend_string *str;
- zend_ulong hval;
-
-assign_again_list:
- if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
- hval = Z_LVAL_P(offset);
-num_index_list:
- value = zend_hash_index_find(Z_ARRVAL_P(container), hval);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined offset: " ZEND_ULONG_FMT, hval);
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
- str = Z_STR_P(offset);
-
- if (ZEND_HANDLE_NUMERIC(str, hval)) {
- goto num_index_list;
- }
-
-str_index_list:
- value = zend_hash_find(Z_ARRVAL_P(container), str);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(str));
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(str != Z_STR_P(offset))) {
- zend_string_release(str);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) {
- offset = Z_REFVAL_P(offset);
- goto assign_again_list;
- } else if (Z_TYPE_P(offset) == IS_NULL) {
- str = ZSTR_EMPTY_ALLOC();
- goto str_index_list;
- } else if (Z_TYPE_P(offset) == IS_DOUBLE) {
- hval = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_FALSE) {
- hval = 0;
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_TRUE) {
- hval = 1;
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_RESOURCE) {
- zend_error(E_NOTICE, "Resource ID#%pd used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(offset), Z_RES_HANDLE_P(offset));
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_list;
- } else {
- zend_error(E_WARNING, "Illegal offset type");
- }
- } else if ((IS_TMP_VAR|IS_VAR) != IS_CONST &&
- UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) &&
- EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) {
- zval *result = EX_VAR(opline->result.var);
- zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, offset, BP_VAR_R, result);
-
- if (retval) {
- if (result != retval) {
- ZVAL_COPY(result, retval);
- }
- } else {
- ZVAL_NULL(result);
- }
- } else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && Z_TYPE_P(container) == IS_REFERENCE) {
- container = Z_REFVAL_P(container);
- goto try_fetch_list;
- } else {
- if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- GET_OP1_UNDEF_CV(container, BP_VAR_R);
- }
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
+ zend_fetch_dimension_address_read_LIST(EX_VAR(opline->result.var), container, EX_CONSTANT(opline->op2));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -53808,94 +53227,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_SPEC_TMPVAR_CV_HAND
{
USE_OPLINE
zend_free_op free_op1;
-
zval *container;
- zval *offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
SAVE_OPLINE();
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
-
-try_fetch_list:
- if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
- zval *value;
- zend_string *str;
- zend_ulong hval;
-
-assign_again_list:
- if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
- hval = Z_LVAL_P(offset);
-num_index_list:
- value = zend_hash_index_find(Z_ARRVAL_P(container), hval);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined offset: " ZEND_ULONG_FMT, hval);
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
- str = Z_STR_P(offset);
-
- if (ZEND_HANDLE_NUMERIC(str, hval)) {
- goto num_index_list;
- }
-
-str_index_list:
- value = zend_hash_find(Z_ARRVAL_P(container), str);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(str));
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(str != Z_STR_P(offset))) {
- zend_string_release(str);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) {
- offset = Z_REFVAL_P(offset);
- goto assign_again_list;
- } else if (Z_TYPE_P(offset) == IS_NULL) {
- str = ZSTR_EMPTY_ALLOC();
- goto str_index_list;
- } else if (Z_TYPE_P(offset) == IS_DOUBLE) {
- hval = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_FALSE) {
- hval = 0;
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_TRUE) {
- hval = 1;
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_RESOURCE) {
- zend_error(E_NOTICE, "Resource ID#%pd used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(offset), Z_RES_HANDLE_P(offset));
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_list;
- } else {
- zend_error(E_WARNING, "Illegal offset type");
- }
- } else if ((IS_TMP_VAR|IS_VAR) != IS_CONST &&
- UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) &&
- EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) {
- zval *result = EX_VAR(opline->result.var);
- zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, offset, BP_VAR_R, result);
-
- if (retval) {
- if (result != retval) {
- ZVAL_COPY(result, retval);
- }
- } else {
- ZVAL_NULL(result);
- }
- } else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && Z_TYPE_P(container) == IS_REFERENCE) {
- container = Z_REFVAL_P(container);
- goto try_fetch_list;
- } else {
- if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- GET_OP1_UNDEF_CV(container, BP_VAR_R);
- }
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
+ zend_fetch_dimension_address_read_LIST(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -55055,95 +54391,12 @@ fetch_obj_is_no_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
- zend_free_op free_op2;
+ zend_free_op free_op1, free_op2;
zval *container;
- zval *offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
SAVE_OPLINE();
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
-
-try_fetch_list:
- if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
- zval *value;
- zend_string *str;
- zend_ulong hval;
-
-assign_again_list:
- if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
- hval = Z_LVAL_P(offset);
-num_index_list:
- value = zend_hash_index_find(Z_ARRVAL_P(container), hval);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined offset: " ZEND_ULONG_FMT, hval);
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
- str = Z_STR_P(offset);
-
- if (ZEND_HANDLE_NUMERIC(str, hval)) {
- goto num_index_list;
- }
-
-str_index_list:
- value = zend_hash_find(Z_ARRVAL_P(container), str);
-
- if (UNEXPECTED(value == NULL)) {
- zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(str));
- ZVAL_NULL(EX_VAR(opline->result.var));
- } else {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(str != Z_STR_P(offset))) {
- zend_string_release(str);
- }
- } else if (EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) {
- offset = Z_REFVAL_P(offset);
- goto assign_again_list;
- } else if (Z_TYPE_P(offset) == IS_NULL) {
- str = ZSTR_EMPTY_ALLOC();
- goto str_index_list;
- } else if (Z_TYPE_P(offset) == IS_DOUBLE) {
- hval = zend_dval_to_lval(Z_DVAL_P(offset));
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_FALSE) {
- hval = 0;
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_TRUE) {
- hval = 1;
- goto num_index_list;
- } else if (Z_TYPE_P(offset) == IS_RESOURCE) {
- zend_error(E_NOTICE, "Resource ID#%pd used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(offset), Z_RES_HANDLE_P(offset));
- hval = Z_RES_HANDLE_P(offset);
- goto num_index_list;
- } else {
- zend_error(E_WARNING, "Illegal offset type");
- }
- } else if ((IS_TMP_VAR|IS_VAR) != IS_CONST &&
- UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) &&
- EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) {
- zval *result = EX_VAR(opline->result.var);
- zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, offset, BP_VAR_R, result);
-
- if (retval) {
- if (result != retval) {
- ZVAL_COPY(result, retval);
- }
- } else {
- ZVAL_NULL(result);
- }
- } else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && Z_TYPE_P(container) == IS_REFERENCE) {
- container = Z_REFVAL_P(container);
- goto try_fetch_list;
- } else {
- if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- GET_OP1_UNDEF_CV(container, BP_VAR_R);
- }
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
+ zend_fetch_dimension_address_read_LIST(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2));
zval_ptr_dtor_nogc(free_op2);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}