Changeset 405 for trunk


Ignore:
Timestamp:
2007-05-31T05:48:08+02:00 (8 years ago)
Author:
moo
Message:

full ZendOptimizer? compatibility

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/utils.c

    r393 r405  
    624624}
    625625/* }}} */
    626 static void xc_sandbox_install(xc_sandbox_t *sandbox TSRMLS_DC) /* {{{ */
     626static void xc_sandbox_install(xc_sandbox_t *sandbox, xc_install_action_t install TSRMLS_DC) /* {{{ */
    627627{
    628628    int i;
     
    668668#endif
    669669
    670     xc_undo_pass_two(CG(active_op_array) TSRMLS_CC);
    671     xc_foreach_early_binding_class(CG(active_op_array), xc_early_binding_cb, (void *) sandbox TSRMLS_CC);
    672     xc_redo_pass_two(CG(active_op_array) TSRMLS_CC);
     670    if (install != XC_InstallNoBinding) {
     671        xc_undo_pass_two(CG(active_op_array) TSRMLS_CC);
     672        xc_foreach_early_binding_class(CG(active_op_array), xc_early_binding_cb, (void *) sandbox TSRMLS_CC);
     673        xc_redo_pass_two(CG(active_op_array) TSRMLS_CC);
     674    }
    673675
    674676    i = 1;
     
    676678}
    677679/* }}} */
    678 void xc_sandbox_free(xc_sandbox_t *sandbox, int install TSRMLS_DC) /* {{{ */
     680void xc_sandbox_free(xc_sandbox_t *sandbox, xc_install_action_t install TSRMLS_DC) /* {{{ */
    679681{
    680682    /* restore first first install function/class */
     
    689691#endif
    690692
    691     if (install) {
     693    if (install != XC_NoInstall) {
    692694        CG(in_compilation)    = 1;
    693695        CG(compiled_filename) = sandbox->filename;
    694696        CG(zend_lineno)       = 0;
    695         xc_sandbox_install(sandbox TSRMLS_CC);
     697        xc_sandbox_install(sandbox, install TSRMLS_CC);
    696698        CG(in_compilation)    = 0;
    697699        CG(compiled_filename) = NULL;
  • trunk/utils.h

    r393 r405  
    100100} xc_sandbox_t;
    101101
     102typedef enum _xc_install_action_t {
     103    XC_NoInstall,
     104    XC_Install,
     105    XC_InstallNoBinding
     106} xc_install_action_t;
     107
    102108void xc_zend_class_add_ref(zend_class_entry ZESW(*ce, **ce));
    103109xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, char *filename TSRMLS_DC);
    104 void xc_sandbox_free(xc_sandbox_t *sandbox, int install TSRMLS_DC);
     110void xc_sandbox_free(xc_sandbox_t *sandbox, xc_install_action_t install TSRMLS_DC);
  • trunk/xcache.c

    r403 r405  
    8787
    8888static zend_bool xc_initized = 0;
     89static zend_compile_file_t *origin_compile_file = NULL;
    8990static zend_compile_file_t *old_compile_file = NULL;
    9091static zend_llist_element  *xc_llist_zend_extension = NULL;
     
    974975    old_constinfo_cnt = zend_hash_num_elements(EG(zend_constants));
    975976
     977    php->op_array = NULL;
     978    XG(initial_compile_file_called) = 0;
    976979    zend_try {
    977980        op_array = old_compile_file(h, type TSRMLS_CC);
     
    986989    if (op_array == NULL) {
    987990        goto err_op_array;
     991    }
     992
     993    if (!XG(initial_compile_file_called)) {
     994        return op_array;
    988995    }
    989996
     
    11641171}
    11651172/* }}} */
     1173static zend_op_array *xc_check_initial_compile_file(zend_file_handle *h, int type TSRMLS_DC) /* {{{ */
     1174{
     1175    XG(initial_compile_file_called) = 1;
     1176    return origin_compile_file(h, type TSRMLS_CC);
     1177}
     1178/* }}} */
    11661179static zend_op_array *xc_compile_file(zend_file_handle *h, int type TSRMLS_DC) /* {{{ */
    11671180{
     
    12901303        }
    12911304
     1305        /* not cachable */
     1306        if (!php.op_array) {
     1307            cache->compiling = 0;
     1308            xc_sandbox_free(&sandbox, XC_InstallNoBinding TSRMLS_CC);
     1309            return op_array;
     1310        }
     1311
    12921312        xce.data.php = &php;
    12931313    }
     
    13551375        }
    13561376        if (newlycompiled) {
    1357             xc_sandbox_free(&sandbox, 0 TSRMLS_CC);
     1377            xc_sandbox_free(&sandbox, XC_NoInstall TSRMLS_CC);
    13581378        }
    13591379        return xc_compile_restore(stored_xce, h TSRMLS_CC);
     
    13631383            /* install it */
    13641384            CG(active_op_array) = op_array;
    1365             xc_sandbox_free(&sandbox, 1 TSRMLS_CC);
     1385            xc_sandbox_free(&sandbox, XC_Install TSRMLS_CC);
    13661386        }
    13671387    }
     
    13711391    if (newlycompiled) {
    13721392        xc_free_php(&php TSRMLS_CC);
    1373         xc_sandbox_free(&sandbox, 0 TSRMLS_CC);
     1393        xc_sandbox_free(&sandbox, XC_NoInstall TSRMLS_CC);
    13741394    }
    13751395
     
    15641584        zend_compile_file = old_compile_file;
    15651585        old_compile_file = NULL;
     1586    }
     1587
     1588    if (origin_compile_file) {
     1589        zend_compile_file = origin_compile_file;
     1590        origin_compile_file = NULL;
    15661591    }
    15671592
     
    29152940#endif
    29162941/* }}} */
    2917 static startup_func_t xc_last_ext_startup = NULL;
     2942static startup_func_t xc_last_ext_startup;
    29182943static int xc_zend_startup_last(zend_extension *extension) /* {{{ */
    29192944{
     
    29362961{
    29372962    xc_zend_extension_gotup = 1;
     2963
     2964    if (!origin_compile_file) {
     2965        origin_compile_file = zend_compile_file;
     2966        zend_compile_file = xc_check_initial_compile_file;
     2967    }
     2968
    29382969    if (zend_llist_count(&zend_extensions) > 1) {
    29392970        zend_llist_position lpos;
  • trunk/xcache_globals.h

    r399 r405  
    11
    22ZEND_BEGIN_MODULE_GLOBALS(xcache)
     3    zend_bool initial_compile_file_called; /* true is origin_compile_file is called */
    34    zend_bool cacher;      /* true if enabled */
    45    zend_bool stat;
Note: See TracChangeset for help on using the changeset viewer.