Re: Opcache crashes. Was: [PHP-WIN] 64 bit platform improvements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jan Ehrhardt in php.windows (Thu, 02 Jan 2014 17:16:33 +0100):
>This made it easy to switch the second PHP version and test when the
>500-error occurs. A bit to my surprise it only happens for the NTS
>versions of PHP 5.4 and PHP 5.5. The NTS version of PHP 5.3 runs without
>problems with the opcache form git-head.
>
>And all the TS versions of 5.3/5.4/5.5 do not produce an error 500.

I was not able to debug what goes wrong, so I took another road:
reverting the patch that did the harm by bits and pieces. This was the
patch:

https://github.com/zendtech/ZendOptimizerPlus/commit/b73b6a5559d6ca4925a09ed284a4e93be06726ed

I divided the patch over three pieces, that had to do with the functions
that were called: replace_tmp_by_const(), update_op1_const() and
update_op2_const();

Reverting the calls to replace_tmp_by_const still errored, but reverting
the three calls to update_op1_const() made the Drupal7 site work again!

There were three calls to update_op1_const() in the patch, so I divided
the patch once again into three pieces. Reverting only 1 of the three
calls was no good, but reverting both changes in Optimizer/block_pass.c
did the trick. By chance, those two changes are at the top of the patch
(because they are the only changes in block_pass.c).

Looking at update_op1_const() in zend_optimizer.c also provided a clue
as to why the patch did no harm in 5.3, but let 5.4 and 5.5 stumble: a
lot of the code was only executed #if ZEND_EXTENSION_API_NO >
PHP_5_3_X_API_NO ...

So, I still do not know what goes wrong, but now I do know which part of
the code does the harm. Dmitry: below the third call to
update_op1_const() there was a 'break;' and the remark 'TMP_VAR may be
used only once'. Just wondering: are multiple calls from block_pass to
update_op1_const() allowed?

Jan

Patch to revert the changes:

diff --git a/Optimizer/block_pass.c b/Optimizer/block_pass.c
index fefbfaa..ce44a35 100644
--- a/Optimizer/block_pass.c
+++ b/Optimizer/block_pass.c
@@ -1034,9 +1034,10 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
 
 				literal_dtor(&ZEND_OP1_LITERAL(opline));
 				literal_dtor(&ZEND_OP2_LITERAL(opline));
-				opline->opcode = ZEND_QM_ASSIGN;
+				ZEND_OP1_LITERAL(opline) = result;
 				SET_UNUSED(opline->op2);
-				update_op1_const(op_array, opline, &result TSRMLS_CC);
+
+				opline->opcode = ZEND_QM_ASSIGN;
 			}
 			EG(error_reporting) = er;
 		} else if ((opline->opcode == ZEND_BOOL ||
@@ -1060,8 +1061,8 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
 			}
 			PZ_SET_REFCOUNT_P(&result, 1);
 			PZ_UNSET_ISREF_P(&result);
+			ZEND_OP1_LITERAL(opline) = result;
 			opline->opcode = ZEND_QM_ASSIGN;
-			update_op1_const(op_array, opline, &result TSRMLS_CC);
 		} else if ((opline->opcode == ZEND_RETURN || opline->opcode == ZEND_EXIT) &&
 					ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
 				   	VAR_SOURCE(opline->op1) &&

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux