cvs: Zend / zend_compile.c zend_execute.c zend_globals.h

From: Date: Tue, 30 Jul 2002 19:42:20 +0000
Subject: cvs: Zend / zend_compile.c zend_execute.c zend_globals.h
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-285@lists.php.net to get a copy of this message
jason Tue Jul 30 15:42:20 2002 EDT Modified files: /Zend zend_compile.c zend_execute.c zend_globals.h Log: @Added the ability to globaly declare a compiler modifier globally by using an empty statement @ i.e. <?php declare (ticks=1); //do something ?> (Jason) This is done by counting the opcodes between the begining and end of the declaration. Fixed certain situations where switching between tick counts could overflow the comparison Index: Zend/zend_compile.c diff -u Zend/zend_compile.c:1.232 Zend/zend_compile.c:1.233 --- Zend/zend_compile.c:1.232 Sat Jun 29 07:25:20 2002 +++ Zend/zend_compile.c Tue Jul 30 15:42:19 2002 @@ -2209,6 +2209,7 @@ void zend_do_declare_begin(TSRMLS_D) { zend_stack_push(&CG(declare_stack), &CG(declarables), sizeof(zend_declarables)); + CG(declarables).beginop = get_next_op_number(CG(active_op_array)); } @@ -2251,7 +2252,10 @@ zend_declarables *declarables; zend_stack_top(&CG(declare_stack), (void **) &declarables); - CG(declarables) = *declarables; + /* We should restore if there was more than (current - start) - (ticks?1:0) opcodes */ + if ((get_next_op_number(CG(active_op_array)) - CG(declarables).beginop) - ((CG(declarables).ticks.value.lval)?1:0)) { + CG(declarables) = *declarables; + } } Index: Zend/zend_execute.c diff -u Zend/zend_execute.c:1.297 Zend/zend_execute.c:1.298 --- Zend/zend_execute.c:1.297 Sat Jul 20 11:52:56 2002 +++ Zend/zend_execute.c Tue Jul 30 15:42:20 2002 @@ -2426,7 +2426,7 @@ do_bind_function_or_class(EX(opline), EG(function_table), EG(class_table), 0); NEXT_OPCODE(); case ZEND_TICKS: - if (++EG(ticks_count)==EX(opline)->op1.u.constant.value.lval) { + if (++EG(ticks_count)>=EX(opline)->op1.u.constant.value.lval) { EG(ticks_count)=0; if (zend_ticks_function) { zend_ticks_function(EX(opline)->op1.u.constant.value.lval); Index: Zend/zend_globals.h diff -u Zend/zend_globals.h:1.86 Zend/zend_globals.h:1.87 --- Zend/zend_globals.h:1.86 Sat Jun 22 10:25:27 2002 +++ Zend/zend_globals.h Tue Jul 30 15:42:20 2002 @@ -61,6 +61,7 @@ typedef struct _zend_declarables { zval ticks; + zend_uint beginop; } zend_declarables;

« previous php.zend-engine.cvs (#285) next »