From: Nikita Popov Date: Tue, 22 Apr 2014 15:54:34 +0000 (+0200) Subject: Pass expected array size hint in INIT_ARRAY X-Git-Tag: POST_PHPNG_MERGE~412^2~73 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3d3a55cbcb95a63fa5ce81e6dcbbfffd65e52294;p=php Pass expected array size hint in INIT_ARRAY To avoid unnecessary rehashes --- diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 1288861954..c184de5cc9 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5845,13 +5845,18 @@ void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC) /* {{{ */ void zend_do_init_array(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC) /* {{{ */ { + int op_num = get_next_op_number(CG(active_op_array)); zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); + result->u.op.opline_num = op_num; + opline->opcode = ZEND_INIT_ARRAY; opline->result.var = get_temporary_variable(CG(active_op_array)); opline->result_type = IS_TMP_VAR; - GET_NODE(result, opline->result); + opline->extended_value = is_ref; /* extval = size << 1 | is_ref */ + if (expr) { + opline->extended_value += 1 << 1; SET_NODE(opline->op1, expr); if (offset) { SET_NODE(opline->op2, offset); @@ -5872,16 +5877,17 @@ void zend_do_init_array(znode *result, znode *expr, znode *offset, zend_bool is_ SET_UNUSED(opline->op1); SET_UNUSED(opline->op2); } - opline->extended_value = is_ref; } /* }}} */ void zend_do_add_array_element(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC) /* {{{ */ { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); + zend_op *init_opline = &CG(active_op_array)->opcodes[result->u.op.opline_num]; + init_opline->extended_value += 1 << 1; /* extval = size << 1 | is_first_ref */ opline->opcode = ZEND_ADD_ARRAY_ELEMENT; - SET_NODE(opline->result, result); + COPY_NODE(opline->result, init_opline->result); SET_NODE(opline->op1, expr); if (offset) { SET_NODE(opline->op2, offset); @@ -5902,6 +5908,13 @@ void zend_do_add_array_element(znode *result, znode *expr, znode *offset, zend_b } /* }}} */ +void zend_do_end_array(znode *result, const znode *array_node TSRMLS_DC) /* {{{ */ +{ + zend_op *init_opline = &CG(active_op_array)->opcodes[array_node->u.op.opline_num]; + GET_NODE(result, init_opline->result); +} +/* }}} */ + void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr TSRMLS_DC) /* {{{ */ { zval element; diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 833a1a04a8..c9a8871703 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -582,6 +582,7 @@ void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC); void zend_do_init_array(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC); void zend_do_add_array_element(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC); +void zend_do_end_array(znode *result, const znode *array_node TSRMLS_DC); void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr TSRMLS_DC); void zend_do_list_init(TSRMLS_D); void zend_do_list_end(znode *result, znode *expr TSRMLS_DC); diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 05cfaafc7e..a8dc2676c8 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -1208,8 +1208,8 @@ assignment_list_element: array_pair_list: - /* empty */ { zend_do_init_array(&$$, NULL, NULL, 0 TSRMLS_CC); } - | non_empty_array_pair_list possible_comma { $$ = $1; } + /* empty */ { zend_do_init_array(&$$, NULL, NULL, 0 TSRMLS_CC); zend_do_end_array(&$$, &$$ TSRMLS_CC); } + | non_empty_array_pair_list possible_comma { zend_do_end_array(&$$, &$1 TSRMLS_DC); } ; non_empty_array_pair_list: diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 7b65cd6f4a..2341a95ad6 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -3648,9 +3648,10 @@ ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNUS USE_OPLINE zend_free_op free_op1; zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) && opline->extended_value) { + if ((OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) && is_ref) { expr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -3713,7 +3714,7 @@ ZEND_VM_C_LABEL(num_index): } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) && opline->extended_value) { + if ((OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) && is_ref) { FREE_OP1_VAR_PTR(); } CHECK_EXCEPTION(); @@ -3724,7 +3725,7 @@ ZEND_VM_HANDLER(71, ZEND_INIT_ARRAY, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|VAR|UNUS { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (OP1_TYPE == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if !defined(ZEND_VM_SPEC) || OP1_TYPE != IS_UNUSED diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 512267f9e1..65bd63832a 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -3923,9 +3923,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_O USE_OPLINE zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) { + if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && is_ref) { expr_ptr = NULL; if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -3988,7 +3989,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) { + if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && is_ref) { } CHECK_EXCEPTION(); @@ -3999,7 +4000,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_H { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_CONST == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CONST != IS_UNUSED @@ -4754,9 +4755,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPC USE_OPLINE zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) { + if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && is_ref) { expr_ptr = NULL; if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -4819,7 +4821,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) { + if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && is_ref) { } CHECK_EXCEPTION(); @@ -4830,7 +4832,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HAN { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_CONST == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CONST != IS_UNUSED @@ -5544,9 +5546,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPC USE_OPLINE zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) { + if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && is_ref) { expr_ptr = NULL; if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -5609,7 +5612,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) { + if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && is_ref) { } CHECK_EXCEPTION(); @@ -5620,7 +5623,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAN { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_CONST == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CONST != IS_UNUSED @@ -6176,9 +6179,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_ USE_OPLINE zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) { + if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && is_ref) { expr_ptr = NULL; if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -6241,7 +6245,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) { + if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && is_ref) { } CHECK_EXCEPTION(); @@ -6252,7 +6256,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_ { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_CONST == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CONST != IS_UNUSED @@ -7041,9 +7045,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCO USE_OPLINE zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) { + if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && is_ref) { expr_ptr = NULL; if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -7106,7 +7111,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) { + if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && is_ref) { } CHECK_EXCEPTION(); @@ -7117,7 +7122,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HAND { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_CONST == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CONST != IS_UNUSED @@ -8812,9 +8817,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPC USE_OPLINE zend_free_op free_op1; zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) { + if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && is_ref) { expr_ptr = NULL; if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -8877,7 +8883,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) { + if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && is_ref) { } CHECK_EXCEPTION(); @@ -8888,7 +8894,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAN { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_TMP_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_TMP_VAR != IS_UNUSED @@ -9607,9 +9613,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCOD USE_OPLINE zend_free_op free_op1; zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) { + if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && is_ref) { expr_ptr = NULL; if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -9672,7 +9679,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) { + if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && is_ref) { } CHECK_EXCEPTION(); @@ -9683,7 +9690,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDL { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_TMP_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_TMP_VAR != IS_UNUSED @@ -10397,9 +10404,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD USE_OPLINE zend_free_op free_op1; zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) { + if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && is_ref) { expr_ptr = NULL; if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -10462,7 +10470,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) { + if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && is_ref) { } CHECK_EXCEPTION(); @@ -10473,7 +10481,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDL { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_TMP_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_TMP_VAR != IS_UNUSED @@ -10915,9 +10923,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OP USE_OPLINE zend_free_op free_op1; zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) { + if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && is_ref) { expr_ptr = NULL; if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -10980,7 +10989,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) { + if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && is_ref) { } CHECK_EXCEPTION(); @@ -10991,7 +11000,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HA { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_TMP_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_TMP_VAR != IS_UNUSED @@ -11707,9 +11716,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE USE_OPLINE zend_free_op free_op1; zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) { + if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && is_ref) { expr_ptr = NULL; if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -11772,7 +11782,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) { + if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && is_ref) { } CHECK_EXCEPTION(); @@ -11783,7 +11793,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLE { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_TMP_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_TMP_VAR != IS_UNUSED @@ -15028,9 +15038,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPC USE_OPLINE zend_free_op free_op1; zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) { + if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && is_ref) { expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -15093,7 +15104,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) { + if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && is_ref) { if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);}; } CHECK_EXCEPTION(); @@ -15104,7 +15115,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAN { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_VAR != IS_UNUSED @@ -17098,9 +17109,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCOD USE_OPLINE zend_free_op free_op1; zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) { + if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && is_ref) { expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -17163,7 +17175,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) { + if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && is_ref) { if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);}; } CHECK_EXCEPTION(); @@ -17174,7 +17186,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDL { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_VAR != IS_UNUSED @@ -19229,9 +19241,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD USE_OPLINE zend_free_op free_op1; zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) { + if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && is_ref) { expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -19294,7 +19307,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) { + if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && is_ref) { if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);}; } CHECK_EXCEPTION(); @@ -19305,7 +19318,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_VAR != IS_UNUSED @@ -20613,9 +20626,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OP USE_OPLINE zend_free_op free_op1; zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) { + if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && is_ref) { expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -20678,7 +20692,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) { + if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && is_ref) { if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);}; } CHECK_EXCEPTION(); @@ -20689,7 +20703,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HA { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_VAR != IS_UNUSED @@ -22500,9 +22514,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE USE_OPLINE zend_free_op free_op1; zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) { + if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && is_ref) { expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -22565,7 +22580,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) { + if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && is_ref) { if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);}; } CHECK_EXCEPTION(); @@ -22576,7 +22591,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_VAR != IS_UNUSED @@ -23980,7 +23995,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_ { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_UNUSED == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_UNUSED != IS_UNUSED @@ -25219,7 +25234,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HA { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_UNUSED == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_UNUSED != IS_UNUSED @@ -26460,7 +26475,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HA { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_UNUSED == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_UNUSED != IS_UNUSED @@ -27211,7 +27226,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_UNUSED == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_UNUSED != IS_UNUSED @@ -28188,7 +28203,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAN { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_UNUSED == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_UNUSED != IS_UNUSED @@ -31302,9 +31317,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCO USE_OPLINE zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) { + if ((IS_CV == IS_VAR || IS_CV == IS_CV) && is_ref) { expr_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC); if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -31367,7 +31383,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) { + if ((IS_CV == IS_VAR || IS_CV == IS_CV) && is_ref) { } CHECK_EXCEPTION(); @@ -31378,7 +31394,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAND { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_CV == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CV != IS_UNUSED @@ -33255,9 +33271,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE USE_OPLINE zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) { + if ((IS_CV == IS_VAR || IS_CV == IS_CV) && is_ref) { expr_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC); if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -33320,7 +33337,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) { + if ((IS_CV == IS_VAR || IS_CV == IS_CV) && is_ref) { } CHECK_EXCEPTION(); @@ -33331,7 +33348,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLE { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_CV == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CV != IS_UNUSED @@ -35268,9 +35285,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE USE_OPLINE zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) { + if ((IS_CV == IS_VAR || IS_CV == IS_CV) && is_ref) { expr_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC); if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -35333,7 +35351,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) { + if ((IS_CV == IS_VAR || IS_CV == IS_CV) && is_ref) { } CHECK_EXCEPTION(); @@ -35344,7 +35362,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_CV == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CV != IS_UNUSED @@ -36536,9 +36554,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPC USE_OPLINE zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) { + if ((IS_CV == IS_VAR || IS_CV == IS_CV) && is_ref) { expr_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC); if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -36601,7 +36620,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) { + if ((IS_CV == IS_VAR || IS_CV == IS_CV) && is_ref) { } CHECK_EXCEPTION(); @@ -36612,7 +36631,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAN { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_CV == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CV != IS_UNUSED @@ -38287,9 +38306,10 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_ USE_OPLINE zval *expr_ptr, new_expr; + zend_bool is_ref = opline->extended_value & 1; SAVE_OPLINE(); - if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) { + if ((IS_CV == IS_VAR || IS_CV == IS_CV) && is_ref) { expr_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC); if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) { zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); @@ -38352,7 +38372,7 @@ num_index: } else { zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr); } - if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) { + if ((IS_CV == IS_VAR || IS_CV == IS_CV) && is_ref) { } CHECK_EXCEPTION(); @@ -38363,7 +38383,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER { USE_OPLINE - array_init(EX_VAR(opline->result.var)); + array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); if (IS_CV == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CV != IS_UNUSED