Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c
index 1302e4b..2c4301e 100644
--- a/ext/opcache/Optimizer/pass1_5.c
+++ b/ext/opcache/Optimizer/pass1_5.c
@@ -248,9 +248,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
zval c;
if (!zend_get_persistent_constant(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), &c, 1 TSRMLS_CC)) {
- if (!*constants || !zend_optimizer_get_collected_constant(*constants, &ZEND_OP2_LITERAL(opline), &c)) {
- break;
- }
+ break;
}
if (Z_TYPE(c) == IS_CONSTANT_AST) {
break;
@@ -336,27 +334,6 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
break;
case ZEND_DO_FCALL:
- /* define("name", scalar); */
- if (collect_constants &&
- opline->extended_value == 2 &&
- ZEND_OP1_TYPE(opline) == IS_CONST &&
- Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING &&
- Z_STRLEN(ZEND_OP1_LITERAL(opline)) == sizeof("define")-1 &&
- zend_binary_strcasecmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)), "define", sizeof("define")-1) == 0 &&
- (opline-1)->opcode == ZEND_SEND_VAL &&
- ZEND_OP1_TYPE(opline-1) == IS_CONST &&
- (Z_TYPE(ZEND_OP1_LITERAL(opline-1)) <= IS_BOOL ||
- Z_TYPE(ZEND_OP1_LITERAL(opline-1)) == IS_STRING) &&
- (opline-2)->opcode == ZEND_SEND_VAL &&
- ZEND_OP1_TYPE(opline-2) == IS_CONST &&
- Z_TYPE(ZEND_OP1_LITERAL(opline-2)) == IS_STRING) {
- zend_optimizer_collect_constant(constants, &ZEND_OP1_LITERAL(opline-2), &ZEND_OP1_LITERAL(opline-1));
- break;
- } else {
- /* don't colllect constants after any other function call */
- collect_constants = 0;
- }
-
/* pre-evaluate constant functions:
defined(x)
constant(x)
@@ -482,17 +459,6 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
}
}
break;
-#if ZEND_EXTENSION_API_NO > PHP_5_2_X_API_NO
- case ZEND_DECLARE_CONST:
- if (collect_constants &&
- Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING &&
- (Z_TYPE(ZEND_OP2_LITERAL(opline)) <= IS_BOOL ||
- Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING)) {
- zend_optimizer_collect_constant(constants, &ZEND_OP1_LITERAL(opline), &ZEND_OP2_LITERAL(opline));
- }
- break;
-#endif
-
case ZEND_RETURN:
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
case ZEND_RETURN_BY_REF:
diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c
index c48d5a6..b0f3883 100644
--- a/ext/opcache/Optimizer/zend_optimizer.c
+++ b/ext/opcache/Optimizer/zend_optimizer.c
@@ -35,31 +35,6 @@ static void zend_optimizer_zval_dtor_wrapper(zval *zvalue)
zval_dtor(zvalue);
}
-static void zend_optimizer_collect_constant(HashTable **constants, zval *name, zval* value)
-{
- zval val;
-
- if (!*constants) {
- *constants = emalloc(sizeof(HashTable));
- zend_hash_init(*constants, 16, NULL, (void (*)(void *))zend_optimizer_zval_dtor_wrapper, 0);
- }
- val = *value;
- zval_copy_ctor(&val);
- zend_hash_add(*constants, Z_STRVAL_P(name), Z_STRLEN_P(name)+1, (void**)&val, sizeof(zval), NULL);
-}
-
-static int zend_optimizer_get_collected_constant(HashTable *constants, zval *name, zval* value)
-{
- zval *val;
-
- if (zend_hash_find(constants, Z_STRVAL_P(name), Z_STRLEN_P(name)+1, (void**)&val) == SUCCESS) {
- *value = *val;
- zval_copy_ctor(value);
- return 1;
- }
- return 0;
-}
-
#if ZEND_EXTENSION_API_NO >= PHP_5_5_X_API_NO
static int zend_optimizer_lookup_cv(zend_op_array *op_array, char* name, int name_len)
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.