Re: com php-src: Fixed return operand type (Use IS_TMP_VAR instead of IS_VAR in the same way as it was before AST patch): Zend/zend_compile.c
ext/opcache/Optimizer/pass1_5.c

From: Date: Mon, 01 Sep 2014 06:22:53 +0000
Subject: Re: com php-src: Fixed return operand type (Use IS_TMP_VAR instead of IS_VAR in the same way as it was before AST patch): Zend/zend_compile.c
ext/opcache/Optimizer/pass1_5.c
References: 1 2  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-81322@lists.php.net to get a copy of this message
I'll think about them. Thanks. Dmitry. On Sat, Aug 30, 2014 at 11:15 PM, Nikita Popov <nikita.ppv@gmail.com> wrote: > On Tue, Aug 26, 2014 at 12:22 PM, Dmitry Stogov <dmitry@php.net> wrote: > >> Commit: 055b632e7d0464a019d7a251cf1e9da9982c8f0e >> Author: Dmitry Stogov <dmitry@zend.com> Tue, 26 Aug 2014 >> 14:22:03 +0400 >> Parents: 7cbbb371270fe369eb30a570df95bbdcf42a82e4 >> Branches: master >> >> Link: >> >> http://git.php.net/?p=php-src.git;a=commitdiff;h=055b632e7d0464a019d7a251cf1e9da9982c8f0e >> >> Log: >> Fixed return operand type (Use IS_TMP_VAR instead of IS_VAR in the same >> way as it was before AST patch) >> >> Changed paths: >> M Zend/zend_compile.c >> M ext/opcache/Optimizer/pass1_5.c >> >> >> Diff: >> diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c >> index 81c0596..f5adb4f 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; >> } >> > > This causes invalid opcode combinations in the following cases: > > strlen("foo")[0] = 1; > $ref =& strlen("foo"); > > Nikita >

« previous php.cvs (#81322) next »