]> granicus.if.org Git - php/commitdiff
- Make loop a bit faster.
authorAndi Gutmans <andi@php.net>
Fri, 28 Jan 2000 22:23:28 +0000 (22:23 +0000)
committerAndi Gutmans <andi@php.net>
Fri, 28 Jan 2000 22:23:28 +0000 (22:23 +0000)
Zend/zend-parser.y
Zend/zend_compile.c
Zend/zend_execute.c

index aa20f4d5baceaafe0bdc88109a867850d3e5b826..64427152e08a4c561ce6e334969805667ebb1b8f 100644 (file)
 
 %% /* Rules */
 
+start:
+       top_statement_list { do_return(NULL, 0 CLS_CC); }
+;
+
 top_statement_list:    
                top_statement_list  { do_extended_info(CLS_C); } top_statement { HANDLE_INTERACTIVE(); }
        |       /* empty */
index 87fe4886d064740b1858934f4b48d64b159a66d5..8a77e7bda705ea5662c6ab8a5f6660fce3a394cf 100644 (file)
@@ -733,6 +733,7 @@ void do_begin_function_declaration(znode *function_token, znode *function_name,
 
 void do_end_function_declaration(znode *function_token CLS_DC)
 {
+       do_return(NULL, 0 CLS_CC);
        pass_two(CG(active_op_array));
        CG(active_op_array) = function_token->u.op_array;
 
index 6efb47b7f92dfad088b6cbb1420c60b3e90ce57d..29d259fe62b6c83dd4f02930bd3b3dc8b84831e3 100644 (file)
@@ -952,7 +952,9 @@ typedef struct _object_info {
 void execute(zend_op_array *op_array ELS_DC)
 {
        zend_op *opline = op_array->opcodes;
+#if SUPPORT_INTERACTIVE
        zend_op *end = op_array->opcodes + op_array->last;
+#endif
        zend_function_state function_state;
        zend_function *fbc=NULL;  /* Function Being Called */
        object_info object = {NULL};
@@ -993,7 +995,11 @@ void execute(zend_op_array *op_array ELS_DC)
                }
        }
 
+#if SUPPORT_INTERACTIVE
        while (opline<end) {
+#else
+       while (1) {
+#endif
                switch(opline->opcode) {
                        case ZEND_ADD:
                                EG(binary_op) = add_function;
@@ -2276,6 +2282,8 @@ send_by_ref:
        }
 #if SUPPORT_INTERACTIVE
        op_array->last_executed_op_number = opline-op_array->opcodes;
-#endif
        free_alloca(Ts);
+#else
+       php_error(E_ERROR,"Arrived at end of main loop which shouldn't happen");
+#endif
 }