]> granicus.if.org Git - php/commitdiff
Manual CSE to avoid double read
authorDmitry Stogov <dmitry@zend.com>
Fri, 11 Sep 2015 11:13:41 +0000 (14:13 +0300)
committerDmitry Stogov <dmitry@zend.com>
Fri, 11 Sep 2015 11:13:41 +0000 (14:13 +0300)
Zend/zend_vm_def.h
Zend/zend_vm_execute.h

index faff4a1978e6ac37951e7079e655c02ee13279c9..60c0b73b657ee975da5ef1e021e30a8801c5690c 100644 (file)
@@ -4167,15 +4167,16 @@ ZEND_VM_HANDLER(116, ZEND_SEND_VAL_EX, CONST|TMP, ANY)
        USE_OPLINE
        zval *value, *arg;
        zend_free_op free_op1;
+       uint32_t arg_num = opline->op2.num;
 
-       if (EXPECTED(opline->op2.num <= MAX_ARG_FLAG_NUM)) {
-               if (QUICK_ARG_MUST_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
+       if (EXPECTED(arg_num <= MAX_ARG_FLAG_NUM)) {
+               if (QUICK_ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
                        ZEND_VM_C_GOTO(send_val_by_ref);
                }
-       } else if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
+       } else if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
 ZEND_VM_C_LABEL(send_val_by_ref):
                SAVE_OPLINE();
-               zend_throw_error(NULL, "Cannot pass parameter %d by reference", opline->op2.num);
+               zend_throw_error(NULL, "Cannot pass parameter %d by reference", arg_num);
                FREE_UNFETCHED_OP1();
                arg = ZEND_CALL_VAR(EX(call), opline->result.var);
                ZVAL_UNDEF(arg);
@@ -4308,12 +4309,13 @@ ZEND_VM_HANDLER(66, ZEND_SEND_VAR_EX, VAR|CV, ANY)
        USE_OPLINE
        zval *varptr, *arg;
        zend_free_op free_op1;
+       uint32_t arg_num = opline->op2.num;
 
-       if (EXPECTED(opline->op2.num <= MAX_ARG_FLAG_NUM)) {
-               if (QUICK_ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
+       if (EXPECTED(arg_num <= MAX_ARG_FLAG_NUM)) {
+               if (QUICK_ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
                        ZEND_VM_C_GOTO(send_var_by_ref);
                }
-       } else if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
+       } else if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
 ZEND_VM_C_LABEL(send_var_by_ref):
                ZEND_VM_DISPATCH_TO_HANDLER(ZEND_SEND_REF);
        }
index 717b6701763456573e4f82fa3a142e6f5ae0b375..b1c1b36cf3be4fbcd857ab4d3c69066946a0e795 100644 (file)
@@ -3278,15 +3278,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_CONST_HANDLER
        USE_OPLINE
        zval *value, *arg;
 
+       uint32_t arg_num = opline->op2.num;
 
-       if (EXPECTED(opline->op2.num <= MAX_ARG_FLAG_NUM)) {
-               if (QUICK_ARG_MUST_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
+       if (EXPECTED(arg_num <= MAX_ARG_FLAG_NUM)) {
+               if (QUICK_ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
                        goto send_val_by_ref;
                }
-       } else if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
+       } else if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
 send_val_by_ref:
                SAVE_OPLINE();
-               zend_throw_error(NULL, "Cannot pass parameter %d by reference", opline->op2.num);
+               zend_throw_error(NULL, "Cannot pass parameter %d by reference", arg_num);
 
                arg = ZEND_CALL_VAR(EX(call), opline->result.var);
                ZVAL_UNDEF(arg);
@@ -11901,15 +11902,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_TMP_HANDLER(Z
        USE_OPLINE
        zval *value, *arg;
        zend_free_op free_op1;
+       uint32_t arg_num = opline->op2.num;
 
-       if (EXPECTED(opline->op2.num <= MAX_ARG_FLAG_NUM)) {
-               if (QUICK_ARG_MUST_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
+       if (EXPECTED(arg_num <= MAX_ARG_FLAG_NUM)) {
+               if (QUICK_ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
                        goto send_val_by_ref;
                }
-       } else if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
+       } else if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
 send_val_by_ref:
                SAVE_OPLINE();
-               zend_throw_error(NULL, "Cannot pass parameter %d by reference", opline->op2.num);
+               zend_throw_error(NULL, "Cannot pass parameter %d by reference", arg_num);
                zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
                arg = ZEND_CALL_VAR(EX(call), opline->result.var);
                ZVAL_UNDEF(arg);
@@ -15237,12 +15239,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_EX_SPEC_VAR_HANDLER(Z
        USE_OPLINE
        zval *varptr, *arg;
        zend_free_op free_op1;
+       uint32_t arg_num = opline->op2.num;
 
-       if (EXPECTED(opline->op2.num <= MAX_ARG_FLAG_NUM)) {
-               if (QUICK_ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
+       if (EXPECTED(arg_num <= MAX_ARG_FLAG_NUM)) {
+               if (QUICK_ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
                        goto send_var_by_ref;
                }
-       } else if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
+       } else if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
 send_var_by_ref:
                ZEND_VM_TAIL_CALL(ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
        }
@@ -28616,12 +28619,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_EX_SPEC_CV_HANDLER(ZE
        USE_OPLINE
        zval *varptr, *arg;
 
+       uint32_t arg_num = opline->op2.num;
 
-       if (EXPECTED(opline->op2.num <= MAX_ARG_FLAG_NUM)) {
-               if (QUICK_ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
+       if (EXPECTED(arg_num <= MAX_ARG_FLAG_NUM)) {
+               if (QUICK_ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
                        goto send_var_by_ref;
                }
-       } else if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
+       } else if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
 send_var_by_ref:
                ZEND_VM_TAIL_CALL(ZEND_SEND_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
        }