felipe                                   Sun, 12 Jun 2011 01:43:10 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=312076

Log:
- Avoid zend_do_ticks() call for each statement in parsing

Changed paths:
    U   php/php-src/branches/PHP_5_3/Zend/zend_compile.c
    U   php/php-src/branches/PHP_5_3/Zend/zend_compile.h
    U   php/php-src/branches/PHP_5_3/Zend/zend_language_parser.y
    U   php/php-src/branches/PHP_5_4/Zend/zend_compile.c
    U   php/php-src/branches/PHP_5_4/Zend/zend_compile.h
    U   php/php-src/branches/PHP_5_4/Zend/zend_language_parser.y
    U   php/php-src/trunk/Zend/zend_compile.c
    U   php/php-src/trunk/Zend/zend_compile.h
    U   php/php-src/trunk/Zend/zend_language_parser.y

Modified: php/php-src/branches/PHP_5_3/Zend/zend_compile.c
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_compile.c    2011-06-12 01:09:01 UTC 
(rev 312075)
+++ php/php-src/branches/PHP_5_3/Zend/zend_compile.c    2011-06-12 01:43:10 UTC 
(rev 312076)
@@ -4901,14 +4901,12 @@

 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);
 }
 /* }}} */


Modified: php/php-src/branches/PHP_5_3/Zend/zend_compile.h
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_compile.h    2011-06-12 01:09:01 UTC 
(rev 312075)
+++ php/php-src/branches/PHP_5_3/Zend/zend_compile.h    2011-06-12 01:43:10 UTC 
(rev 312076)
@@ -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()        \
     {                              \

Modified: php/php-src/branches/PHP_5_3/Zend/zend_language_parser.y
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_language_parser.y    2011-06-12 
01:09:01 UTC (rev 312075)
+++ php/php-src/branches/PHP_5_3/Zend/zend_language_parser.y    2011-06-12 
01:43:10 UTC (rev 312076)
@@ -211,7 +211,7 @@


 statement:
-               unticked_statement { zend_do_ticks(TSRMLS_C); }
+               unticked_statement { DO_TICKS(); }
        |       T_STRING ':' { zend_do_label(&$1 TSRMLS_CC); }
 ;

@@ -291,11 +291,11 @@
 ;

 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(); }
 ;



Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c
===================================================================
--- php/php-src/branches/PHP_5_4/Zend/zend_compile.c    2011-06-12 01:09:01 UTC 
(rev 312075)
+++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c    2011-06-12 01:43:10 UTC 
(rev 312076)
@@ -6170,14 +6170,12 @@

 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);
 }
 /* }}} */


Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.h
===================================================================
--- php/php-src/branches/PHP_5_4/Zend/zend_compile.h    2011-06-12 01:09:01 UTC 
(rev 312075)
+++ php/php-src/branches/PHP_5_4/Zend/zend_compile.h    2011-06-12 01:43:10 UTC 
(rev 312076)
@@ -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()        \
     {                              \

Modified: php/php-src/branches/PHP_5_4/Zend/zend_language_parser.y
===================================================================
--- php/php-src/branches/PHP_5_4/Zend/zend_language_parser.y    2011-06-12 
01:09:01 UTC (rev 312075)
+++ php/php-src/branches/PHP_5_4/Zend/zend_language_parser.y    2011-06-12 
01:43:10 UTC (rev 312076)
@@ -213,7 +213,7 @@


 statement:
-               unticked_statement { zend_do_ticks(TSRMLS_C); }
+               unticked_statement { DO_TICKS(); }
        |       T_STRING ':' { zend_do_label(&$1 TSRMLS_CC); }
 ;

@@ -293,11 +293,11 @@
 ;

 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(); }
 ;



Modified: php/php-src/trunk/Zend/zend_compile.c
===================================================================
--- php/php-src/trunk/Zend/zend_compile.c       2011-06-12 01:09:01 UTC (rev 
312075)
+++ php/php-src/trunk/Zend/zend_compile.c       2011-06-12 01:43:10 UTC (rev 
312076)
@@ -6170,14 +6170,12 @@

 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);
 }
 /* }}} */


Modified: php/php-src/trunk/Zend/zend_compile.h
===================================================================
--- php/php-src/trunk/Zend/zend_compile.h       2011-06-12 01:09:01 UTC (rev 
312075)
+++ php/php-src/trunk/Zend/zend_compile.h       2011-06-12 01:43:10 UTC (rev 
312076)
@@ -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()        \
     {                              \

Modified: php/php-src/trunk/Zend/zend_language_parser.y
===================================================================
--- php/php-src/trunk/Zend/zend_language_parser.y       2011-06-12 01:09:01 UTC 
(rev 312075)
+++ php/php-src/trunk/Zend/zend_language_parser.y       2011-06-12 01:43:10 UTC 
(rev 312076)
@@ -213,7 +213,7 @@


 statement:
-               unticked_statement { zend_do_ticks(TSRMLS_C); }
+               unticked_statement { DO_TICKS(); }
        |       T_STRING ':' { zend_do_label(&$1 TSRMLS_CC); }
 ;

@@ -293,11 +293,11 @@
 ;

 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(); }
 ;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to