Changeset 477 in svn


Ignore:
Timestamp:
2007-08-19T16:15:51+02:00 (8 years ago)
Author:
Xuefer
Message:

opcodes data is copied but not the op_array. use op_array_handler instead

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/optimizer.c

    r476 r477  
    77/* the "vector" stack */
    88#include "stack.h"
     9#include "xcache_globals.h"
    910
    1011#ifdef DEBUG
     
    1920#   define XCACHE_IS_CV 16
    2021#endif
    21 #define optimized_flag done_pass_two
    2222
    2323typedef int bbid_t;
     
    516516    }
    517517
    518     /* don't optimize twice */
    519     if (op_array->optimized_flag) {
    520         return 0;
    521     }
    522     op_array->optimized_flag = 1;
    523 
    524518#ifdef DEBUG
    525519#   if 0
     
    557551}
    558552/* }}} */
    559 static int xc_clear_flag_optimized(zend_op_array *op_array TSRMLS_DC) /* {{{ */
    560 {
    561     op_array->done_pass_two = 0;
    562     return 0;
    563 }
    564 /* }}} */
    565 void xc_optimize(zend_op_array *op_array TSRMLS_DC) /* {{{ */
    566 {
    567     xc_compile_result_t cr;
    568 
    569     if (!op_array) {
    570         return;
    571     }
    572 
    573     xc_compile_result_init_cur(&cr, op_array TSRMLS_CC);
    574 
    575     xc_apply_op_array(&cr, (apply_func_t) xc_undo_pass_two TSRMLS_CC);
    576     /* op_array->done_pass_two is now used as if it's op_array->flag_optimized */
    577     xc_apply_op_array(&cr, (apply_func_t) xc_optimize_op_array TSRMLS_CC);
    578     xc_apply_op_array(&cr, (apply_func_t) xc_clear_flag_optimized TSRMLS_CC);
    579     xc_apply_op_array(&cr, (apply_func_t) xc_redo_pass_two TSRMLS_CC);
    580 
    581     xc_compile_result_free(&cr);
    582 }
    583 /* }}} */
     553void xc_optimizer_op_array_handler(zend_op_array *op_array) /* {{{ */
     554{
     555    TSRMLS_FETCH();
     556    if (XG(optimizer)) {
     557        xc_optimize_op_array(op_array TSRMLS_CC);
     558    }
     559}
     560/* }}} */
  • trunk/optimizer.h

    r393 r477  
    22#include "xcache.h"
    33
    4 void xc_optimize(zend_op_array *op_array TSRMLS_DC);
     4void xc_optimizer_op_array_handler(zend_op_array *op_array);
  • trunk/xcache.c

    r474 r477  
    10001000    }
    10011001
    1002 #ifdef HAVE_XCACHE_OPTIMIZER
    1003     if (XG(optimizer)) {
    1004         xc_optimize(op_array TSRMLS_CC);
    1005     }
    1006 #endif
    10071002    /* }}} */
    10081003    /* {{{ prepare */
     
    12001195    if (!XG(cacher)) {
    12011196        op_array = old_compile_file(h, type TSRMLS_CC);
    1202 #ifdef HAVE_XCACHE_OPTIMIZER
    1203         if (XG(optimizer)) {
    1204             xc_optimize(op_array TSRMLS_CC);
    1205         }
    1206 #endif
    12071197        return op_array;
    12081198    }
     
    30513041    NULL,           /* deactivate_func_t */
    30523042    NULL,           /* message_handler_func_t */
     3043#ifdef HAVE_XCACHE_OPTIMIZER
     3044    xc_optimizer_op_array_handler,
     3045#else
    30533046    NULL,           /* op_array_handler_func_t */
     3047#endif
    30543048    xcache_statement_handler,
    30553049    xcache_fcall_begin_handler,
Note: See TracChangeset for help on using the changeset viewer.