diff options
-rw-r--r-- | Zend/zend_compile.c | 25 | ||||
-rw-r--r-- | ext/opcache/Optimizer/pass1_5.c | 4 |
2 files changed, 17 insertions, 12 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 81c0596578..f5adb4f100 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3970,12 +3970,17 @@ uint32_t zend_compile_args(zend_ast *ast, zend_function *fbc TSRMLS_DC) { if (zend_is_variable(arg)) { if (zend_is_call(arg)) { zend_compile_var(&arg_node, arg, BP_VAR_R TSRMLS_CC); - opcode = ZEND_SEND_VAR_NO_REF; - flags |= ZEND_ARG_SEND_FUNCTION; - if (fbc && ARG_SHOULD_BE_SENT_BY_REF(fbc, arg_num)) { - flags |= ZEND_ARG_SEND_BY_REF; - if (ARG_MAY_BE_SENT_BY_REF(fbc, arg_num)) { - flags |= ZEND_ARG_SEND_SILENT; + if (arg_node.op_type & (IS_CONST|IS_TMP_VAR)) { + /* Function call was converted into builtin instruction */ + opcode = ZEND_SEND_VAL; + } else { + opcode = ZEND_SEND_VAR_NO_REF; + flags |= ZEND_ARG_SEND_FUNCTION; + if (fbc && ARG_SHOULD_BE_SENT_BY_REF(fbc, arg_num)) { + flags |= ZEND_ARG_SEND_BY_REF; + if (ARG_MAY_BE_SENT_BY_REF(fbc, arg_num)) { + flags |= ZEND_ARG_SEND_SILENT; + } } } } else if (fbc) { @@ -4108,7 +4113,7 @@ int zend_compile_func_strlen(znode *result, zend_ast_list *args TSRMLS_DC) { } zend_compile_expr(&arg_node, args->child[0] TSRMLS_CC); - zend_emit_op(result, ZEND_STRLEN, &arg_node, NULL TSRMLS_CC); + zend_emit_op_tmp(result, ZEND_STRLEN, &arg_node, NULL TSRMLS_CC); return SUCCESS; } @@ -4121,7 +4126,7 @@ int zend_compile_func_typecheck(znode *result, zend_ast_list *args, uint32_t typ } zend_compile_expr(&arg_node, args->child[0] TSRMLS_CC); - opline = zend_emit_op(result, ZEND_TYPE_CHECK, &arg_node, NULL TSRMLS_CC); + opline = zend_emit_op_tmp(result, ZEND_TYPE_CHECK, &arg_node, NULL TSRMLS_CC); opline->extended_value = type; return SUCCESS; } @@ -4140,7 +4145,7 @@ int zend_compile_func_defined(znode *result, zend_ast_list *args TSRMLS_DC) { return FAILURE; } - opline = zend_emit_op(result, ZEND_DEFINED, NULL, NULL TSRMLS_CC); + opline = zend_emit_op_tmp(result, ZEND_DEFINED, NULL, NULL TSRMLS_CC); opline->op1_type = IS_CONST; LITERAL_STR(opline->op1, name); zend_alloc_cache_slot(opline->op1.constant TSRMLS_CC); @@ -6857,7 +6862,7 @@ void zend_compile_isset_or_empty(znode *result, zend_ast *ast TSRMLS_DC) { EMPTY_SWITCH_DEFAULT_CASE() } - opline->result_type = IS_TMP_VAR; + result->op_type = opline->result_type = IS_TMP_VAR; opline->extended_value |= ast->kind == ZEND_AST_ISSET ? ZEND_ISSET : ZEND_ISEMPTY; } diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index cae4d0445d..de09e89123 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -472,7 +472,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { zval t; ZVAL_LONG(&t, Z_STRLEN(ZEND_OP1_LITERAL(opline))); - replace_var_by_const(op_array, opline + 1, ZEND_RESULT(opline).var, &t TSRMLS_CC); + replace_tmp_by_const(op_array, opline + 1, ZEND_RESULT(opline).var, &t TSRMLS_CC); literal_dtor(&ZEND_OP1_LITERAL(opline)); MAKE_NOP(opline); } @@ -485,7 +485,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { break; } ZVAL_TRUE(&c); - replace_var_by_const(op_array, opline, tv, &c TSRMLS_CC); + replace_tmp_by_const(op_array, opline, tv, &c TSRMLS_CC); literal_dtor(&ZEND_OP1_LITERAL(opline)); MAKE_NOP(opline); } |