summaryrefslogtreecommitdiff
path: root/ext/opcache
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2016-09-09 17:11:25 +0200
committerNikita Popov <nikic@php.net>2016-09-09 17:11:25 +0200
commit9a0bb40670747cf33602f391e162fae18c9b3722 (patch)
tree318248e2197018afe8a1d91a3b532835a2c5d3b8 /ext/opcache
parent3a9d45a12bf300d575a436a5d90cd4dc4c5c0c4a (diff)
downloadphp-git-9a0bb40670747cf33602f391e162fae18c9b3722.tar.gz
Remove handling for defined() and strlen() in opcache
These are converted by the compiler into DEFINED and STRLEN, no need to handle the function forms.
Diffstat (limited to 'ext/opcache')
-rw-r--r--ext/opcache/Optimizer/block_pass.c12
-rw-r--r--ext/opcache/Optimizer/pass1_5.c34
2 files changed, 1 insertions, 45 deletions
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index e36c533d37..100862cb1f 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -284,7 +284,6 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
#if 0
/* pre-evaluate functions:
constant(x)
- defined(x)
function_exists(x)
extension_loaded(x)
BAD: interacts badly with Accelerator
@@ -301,16 +300,7 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
zval *arg = &OPLINE_OP1_LITERAL(sv);
char *fname = FUNCTION_CACHE->funcs[Z_LVAL(ZEND_OP1_LITERAL(fcall))].function_name;
int flen = FUNCTION_CACHE->funcs[Z_LVAL(ZEND_OP1_LITERAL(fcall))].name_len;
- if(flen == sizeof("defined")-1 && zend_binary_strcasecmp(fname, flen, "defined", sizeof("defined")-1) == 0) {
- zval c;
- if(zend_optimizer_get_persistent_constant(Z_STR_P(arg), &c, 0 ELS_CC) != 0) {
- literal_dtor(arg);
- MAKE_NOP(sv);
- MAKE_NOP(fcall);
- LITERAL_BOOL(opline->op1, 1);
- ZEND_OP1_TYPE(opline) = IS_CONST;
- }
- } else if((flen == sizeof("function_exists")-1 && zend_binary_strcasecmp(fname, flen, "function_exists", sizeof("function_exists")-1) == 0) ||
+ if((flen == sizeof("function_exists")-1 && zend_binary_strcasecmp(fname, flen, "function_exists", sizeof("function_exists")-1) == 0) ||
(flen == sizeof("is_callable")-1 && zend_binary_strcasecmp(fname, flen, "is_callable", sizeof("is_callable")-1) == 0)
) {
zend_function *function;
diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c
index e8399ccc90..ea9c5c1323 100644
--- a/ext/opcache/Optimizer/pass1_5.c
+++ b/ext/opcache/Optimizer/pass1_5.c
@@ -436,7 +436,6 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
}
/* pre-evaluate constant functions:
- defined(x)
constant(x)
function_exists(x)
is_callable(x)
@@ -518,24 +517,6 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
MAKE_NOP(opline);
break;
}
- } else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("defined")-1 &&
- !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
- "defined", sizeof("defined")-1) &&
- !zend_optimizer_is_disabled_func("defined", sizeof("defined") - 1)) {
- zval t;
-
- if (zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(send1_opline)), &t, 0)) {
-
- ZVAL_TRUE(&t);
- if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t)) {
- literal_dtor(&ZEND_OP2_LITERAL(init_opline));
- MAKE_NOP(init_opline);
- literal_dtor(&ZEND_OP1_LITERAL(send1_opline));
- MAKE_NOP(send1_opline);
- MAKE_NOP(opline);
- break;
- }
- }
} else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("constant")-1 &&
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
"constant", sizeof("constant")-1) &&
@@ -552,21 +533,6 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
break;
}
}
- } else if ((CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN) == 0 &&
- Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("strlen") - 1 &&
- !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)), "strlen", sizeof("strlen") - 1) &&
- !zend_optimizer_is_disabled_func("strlen", sizeof("strlen") - 1)) {
- zval t;
-
- ZVAL_LONG(&t, Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)));
- if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t)) {
- literal_dtor(&ZEND_OP2_LITERAL(init_opline));
- MAKE_NOP(init_opline);
- literal_dtor(&ZEND_OP1_LITERAL(send1_opline));
- MAKE_NOP(send1_opline);
- MAKE_NOP(opline);
- break;
- }
/* dirname(IS_CONST/IS_STRING) -> IS_CONST/IS_STRING */
} else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("dirname")-1 &&
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),