From 80d432ca6281175dc01991b0c0ab6c98968a8790 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 12 Jun 2011 01:43:10 +0000 Subject: [PATCH] - Avoid zend_do_ticks() call for each statement in parsing --- Zend/zend_compile.c | 12 +++++------- Zend/zend_compile.h | 1 + Zend/zend_language_parser.y | 6 +++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 1cad70f77a2..2f3fad9ba48 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -6170,14 +6170,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; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - opline->extended_value = Z_LVAL(CG(declarables).ticks); - } + opline->opcode = ZEND_TICKS; + SET_UNUSED(opline->op1); + SET_UNUSED(opline->op2); + opline->extended_value = Z_LVAL(CG(declarables).ticks); } /* }}} */ diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 9aeac1416ce..8ce7c405f80 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) { (CG(context).backpatch_count++); } #define DEC_BPC(op_array) if (op_array->fn_flags & ZEND_ACC_INTERACTIVE) { (CG(context).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 e0a956bc23e..e3d079c5519 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -213,7 +213,7 @@ inner_statement: statement: - unticked_statement { zend_do_ticks(TSRMLS_C); } + unticked_statement { DO_TICKS(); } | T_STRING ':' { zend_do_label(&$1 TSRMLS_CC); } ; @@ -293,11 +293,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(); } ;