com php-src: Send by reference without duplication: Zend/zend_vm_def.h Zend/zend_vm_execute.h

From: Date: Wed, 17 Jan 2018 15:50:18 +0000
Subject: com php-src: Send by reference without duplication: Zend/zend_vm_def.h Zend/zend_vm_execute.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-100948@lists.php.net to get a copy of this message
Commit: a87a2f464b813ac2f1474d1fe0da78c33020c5c3 Author: Dmitry Stogov <dmitry@zend.com> Wed, 17 Jan 2018 18:50:18 +0300 Parents: de79001bef9f870908f9d029889141431aa9642d Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a87a2f464b813ac2f1474d1fe0da78c33020c5c3 Log: Send by reference without duplication Changed paths: M Zend/zend_vm_def.h M Zend/zend_vm_execute.h Diff: diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 407194e..5d129a9 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -4404,19 +4404,19 @@ ZEND_VM_C_LABEL(send_again): top = ZEND_CALL_ARG(EX(call), arg_num); if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) { - if (Z_REFCOUNT_P(args) == 1) { - if (Z_ISREF_P(arg)) { - Z_ADDREF_P(arg); - } else { - ZVAL_MAKE_REF_EX(arg, 2); - } + if (Z_ISREF_P(arg)) { + Z_ADDREF_P(arg); + ZVAL_REF(top, Z_REF_P(arg)); + } else if (OP1_TYPE & (IS_VAR|IS_CV)) { + /* array is already separated above */ + ZVAL_MAKE_REF_EX(arg, 2); ZVAL_REF(top, Z_REF_P(arg)); } else { - ZVAL_DUP(top, arg); + Z_TRY_ADDREF_P(arg); + ZVAL_NEW_REF(top, arg); } - } else if (Z_ISREF_P(arg)) { - ZVAL_COPY(top, Z_REFVAL_P(arg)); } else { + ZVAL_DEREF(arg); ZVAL_COPY(top, arg); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index dfa5306..c7b1487 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1234,19 +1234,19 @@ send_again: top = ZEND_CALL_ARG(EX(call), arg_num); if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) { - if (Z_REFCOUNT_P(args) == 1) { - if (Z_ISREF_P(arg)) { - Z_ADDREF_P(arg); - } else { - ZVAL_MAKE_REF_EX(arg, 2); - } + if (Z_ISREF_P(arg)) { + Z_ADDREF_P(arg); + ZVAL_REF(top, Z_REF_P(arg)); + } else if (opline->op1_type & (IS_VAR|IS_CV)) { + /* array is already separated above */ + ZVAL_MAKE_REF_EX(arg, 2); ZVAL_REF(top, Z_REF_P(arg)); } else { - ZVAL_DUP(top, arg); + Z_TRY_ADDREF_P(arg); + ZVAL_NEW_REF(top, arg); } - } else if (Z_ISREF_P(arg)) { - ZVAL_COPY(top, Z_REFVAL_P(arg)); } else { + ZVAL_DEREF(arg); ZVAL_COPY(top, arg); }

« previous php.cvs (#100948) next »