Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 0 additions & 53 deletions Zend/Optimizer/block_pass.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,59 +344,6 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
}
break;

#if 0
/* pre-evaluate functions:
constant(x)
function_exists(x)
extension_loaded(x)
BAD: interacts badly with Accelerator
*/
if((opline->op1_type & IS_VAR) &&
VAR_SOURCE(opline->op1) && VAR_SOURCE(opline->op1)->opcode == ZEND_DO_CF_FCALL &&
VAR_SOURCE(opline->op1)->extended_value == 1) {
zend_op *fcall = VAR_SOURCE(opline->op1);
zend_op *sv = fcall-1;
if(sv >= block->start_opline && sv->opcode == ZEND_SEND_VAL &&
sv->op1_type == IS_CONST && Z_TYPE(OPLINE_OP1_LITERAL(sv)) == IS_STRING &&
Z_LVAL(OPLINE_OP2_LITERAL(sv)) == 1
) {
zval *arg = &OPLINE_OP1_LITERAL(sv);
char *fname = FUNCTION_CACHE->funcs[Z_LVAL(ZEND_OP1_LITERAL(fcall))].function_name;
size_t flen = FUNCTION_CACHE->funcs[Z_LVAL(ZEND_OP1_LITERAL(fcall))].name_len;
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;
if((function = zend_hash_find_ptr(EG(function_table), Z_STR_P(arg))) != NULL) {
literal_dtor(arg);
MAKE_NOP(sv);
MAKE_NOP(fcall);
LITERAL_BOOL(opline->op1, 1);
opline->op1_type = IS_CONST;
}
} else if(flen == sizeof("constant")-1 && zend_binary_strcasecmp(fname, flen, "constant", sizeof("constant")-1) == 0) {
zval c;
if (zend_optimizer_get_persistent_constant(Z_STR_P(arg), &c, true ELS_CC)) {
literal_dtor(arg);
MAKE_NOP(sv);
MAKE_NOP(fcall);
ZEND_OP1_LITERAL(opline) = zend_optimizer_add_literal(op_array, &c);
/* no copy ctor - get already copied it */
opline->op1_type = IS_CONST;
}
} else if(flen == sizeof("extension_loaded")-1 && zend_binary_strcasecmp(fname, flen, "extension_loaded", sizeof("extension_loaded")-1) == 0) {
if(zend_hash_exists(&module_registry, Z_STR_P(arg))) {
literal_dtor(arg);
MAKE_NOP(sv);
MAKE_NOP(fcall);
LITERAL_BOOL(opline->op1, 1);
opline->op1_type = IS_CONST;
}
}
}
}
#endif

case ZEND_FETCH_LIST_R:
case ZEND_FETCH_LIST_W:
if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) {
Expand Down
Loading