com php-src: Explain the disabled optimization pattern: ext/opcache/Optimizer/pass2.c
| From: | Dmitry Stogov | Date: | Wed, 09 Dec 2015 19:22:07 +0000 |
| Subject: | com php-src: Explain the disabled optimization pattern: ext/opcache/Optimizer/pass2.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-90190@lists.php.net to get a copy of this message | ||
Commit: 7fd7734e5872872e7e739bce3e074f463927ba25
Author: Dmitry Stogov <dmitry@zend.com> Wed, 9 Dec 2015 22:22:07 +0300
Parents: e80791e16133564f5ba5b03047a313a1e3e40e3f
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7fd7734e5872872e7e739bce3e074f463927ba25
Log:
Explain the disabled optimization pattern
Changed paths:
M ext/opcache/Optimizer/pass2.c
Diff:
diff --git a/ext/opcache/Optimizer/pass2.c b/ext/opcache/Optimizer/pass2.c
index 3573c10..b61d799 100644
--- a/ext/opcache/Optimizer/pass2.c
+++ b/ext/opcache/Optimizer/pass2.c
@@ -114,14 +114,21 @@ void zend_optimizer_pass2(zend_op_array *op_array)
case ZEND_JMPZ_EX:
case ZEND_JMPNZ_EX:
/* convert Ti = JMPZ_EX(Ti, L) to JMPZ(Ti, L) */
- if (0 && /* FIXME: temporary disable unsafe pattern */
- ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
+#if 0
+ /* Disabled unsafe pattern: in conjunction with
+ * ZEND_VM_SMART_BRANCH() this may improperly eliminate
+ * assignment to Ti.
+ */
+ if (ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
ZEND_RESULT_TYPE(opline) == IS_TMP_VAR &&
ZEND_OP1(opline).var == ZEND_RESULT(opline).var) {
opline->opcode -= 3;
+ SET_UNUSED(opline->result);
+ } else
+#endif
/* convert Ti = JMPZ_EX(C, L) => Ti = QM_ASSIGN(C)
in case we know it wouldn't jump */
- } else if (ZEND_OP1_TYPE(opline) == IS_CONST) {
+ if (ZEND_OP1_TYPE(opline) == IS_CONST) {
int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(opline));
if (opline->opcode == ZEND_JMPZ_EX) {
should_jmp = !should_jmp;