From: Felipe Pena Date: Sun, 12 Jun 2011 01:43:10 +0000 (+0000) Subject: - Avoid zend_do_ticks() call for each statement in parsing X-Git-Tag: php-5.3.7RC1~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=86ed2eeb5d7420fe67f0061e66106233904faeeb;p=php - Avoid zend_do_ticks() call for each statement in parsing --- diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index d6ac7e3e4d..9b5166f9ae 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4901,14 +4901,12 @@ void zend_do_extended_fcall_end(TSRMLS_D) /* {{{ */ void zend_do_ticks(TSRMLS_D) /* {{{ */ { - if (Z_LVAL(CG(declarables).ticks)) { - zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); + zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); - opline->opcode = ZEND_TICKS; - opline->op1.u.constant = CG(declarables).ticks; - opline->op1.op_type = IS_CONST; - SET_UNUSED(opline->op2); - } + opline->opcode = ZEND_TICKS; + opline->op1.u.constant = CG(declarables).ticks; + opline->op1.op_type = IS_CONST; + SET_UNUSED(opline->op2); } /* }}} */ diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index cbbb6722a5..cd8be85388 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -39,6 +39,7 @@ #define INC_BPC(op_array) if (op_array->fn_flags & ZEND_ACC_INTERACTIVE) { ((op_array)->backpatch_count++); } #define DEC_BPC(op_array) if (op_array->fn_flags & ZEND_ACC_INTERACTIVE) { ((op_array)->backpatch_count--); } #define HANDLE_INTERACTIVE() if (CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE) { execute_new_code(TSRMLS_C); } +#define DO_TICKS() if (Z_LVAL(CG(declarables).ticks)) { zend_do_ticks(TSRMLS_C); } #define RESET_DOC_COMMENT() \ { \ diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index d4881bd162..9ad186e7d3 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -211,7 +211,7 @@ inner_statement: statement: - unticked_statement { zend_do_ticks(TSRMLS_C); } + unticked_statement { DO_TICKS(); } | T_STRING ':' { zend_do_label(&$1 TSRMLS_CC); } ; @@ -291,11 +291,11 @@ unset_variable: ; function_declaration_statement: - unticked_function_declaration_statement { zend_do_ticks(TSRMLS_C); } + unticked_function_declaration_statement { DO_TICKS(); } ; class_declaration_statement: - unticked_class_declaration_statement { zend_do_ticks(TSRMLS_C); } + unticked_class_declaration_statement { DO_TICKS(); } ;