com php-src: Avoid useles copy ctor: Zend/zend_vm_def.h Zend/zend_vm_execute.h
| From: | Dmitry Stogov | Date: | Mon, 21 Apr 2014 09:19:52 +0000 |
| Subject: | com php-src: Avoid useles copy ctor: Zend/zend_vm_def.h Zend/zend_vm_execute.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77339@lists.php.net to get a copy of this message | ||
Commit: e9f4d822b0c794cceaf71b68b37977bb3b6212a3
Author: Dmitry Stogov <dmitry@zend.com> Mon, 21 Apr 2014 13:19:52 +0400
Parents: 54d9ad53f4797733b41bf2c65bd2c2cb5a1938b6
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e9f4d822b0c794cceaf71b68b37977bb3b6212a3
Log:
Avoid useles copy ctor
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 e3b58bc..81f000d 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -2863,13 +2863,14 @@ ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY)
}
zend_exception_save(TSRMLS_C);
- /* Not sure if a complete copy is what we want here */
- ZVAL_COPY_VALUE(&exception, value);
- if (!IS_OP1_TMP_FREE()) {
- zval_opt_copy_ctor(&exception);
+ if (OP1_TYPE == IS_CONST) {
+ ZVAL_DUP(&exception, value);
+ value = &exception;
+ } else if (OP1_TYPE != IS_TMP_VAR) {
+ if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- zend_throw_exception_object(&exception TSRMLS_CC);
+ zend_throw_exception_object(value TSRMLS_CC);
zend_exception_restore(TSRMLS_C);
FREE_OP1_IF_VAR();
HANDLE_EXCEPTION();
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 482ea31..29a9821 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -2638,13 +2638,14 @@ static int ZEND_FASTCALL
ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS
}
zend_exception_save(TSRMLS_C);
- /* Not sure if a complete copy is what we want here */
- ZVAL_COPY_VALUE(&exception, value);
- if (!0) {
- zval_opt_copy_ctor(&exception);
+ if (IS_CONST == IS_CONST) {
+ ZVAL_DUP(&exception, value);
+ value = &exception;
+ } else if (IS_CONST != IS_TMP_VAR) {
+ if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- zend_throw_exception_object(&exception TSRMLS_CC);
+ zend_throw_exception_object(value TSRMLS_CC);
zend_exception_restore(TSRMLS_C);
HANDLE_EXCEPTION();
@@ -7585,13 +7586,14 @@ static int ZEND_FASTCALL
ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
zend_exception_save(TSRMLS_C);
- /* Not sure if a complete copy is what we want here */
- ZVAL_COPY_VALUE(&exception, value);
- if (!1) {
- zval_opt_copy_ctor(&exception);
+ if (IS_TMP_VAR == IS_CONST) {
+ ZVAL_DUP(&exception, value);
+ value = &exception;
+ } else if (IS_TMP_VAR != IS_TMP_VAR) {
+ if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- zend_throw_exception_object(&exception TSRMLS_CC);
+ zend_throw_exception_object(value TSRMLS_CC);
zend_exception_restore(TSRMLS_C);
HANDLE_EXCEPTION();
@@ -12454,13 +12456,14 @@ static int ZEND_FASTCALL
ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
zend_exception_save(TSRMLS_C);
- /* Not sure if a complete copy is what we want here */
- ZVAL_COPY_VALUE(&exception, value);
- if (!0) {
- zval_opt_copy_ctor(&exception);
+ if (IS_VAR == IS_CONST) {
+ ZVAL_DUP(&exception, value);
+ value = &exception;
+ } else if (IS_VAR != IS_TMP_VAR) {
+ if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- zend_throw_exception_object(&exception TSRMLS_CC);
+ zend_throw_exception_object(value TSRMLS_CC);
zend_exception_restore(TSRMLS_C);
zval_ptr_dtor_nogc(free_op1.var);
HANDLE_EXCEPTION();
@@ -28986,13 +28989,14 @@ static int ZEND_FASTCALL
ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
zend_exception_save(TSRMLS_C);
- /* Not sure if a complete copy is what we want here */
- ZVAL_COPY_VALUE(&exception, value);
- if (!0) {
- zval_opt_copy_ctor(&exception);
+ if (IS_CV == IS_CONST) {
+ ZVAL_DUP(&exception, value);
+ value = &exception;
+ } else if (IS_CV != IS_TMP_VAR) {
+ if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- zend_throw_exception_object(&exception TSRMLS_CC);
+ zend_throw_exception_object(value TSRMLS_CC);
zend_exception_restore(TSRMLS_C);
HANDLE_EXCEPTION();