Changeset 408 in svn for branches/1.2/xcache.c


Ignore:
Timestamp:
2007-05-31T04:20:14Z (8 years ago)
Author:
Xuefer
Message:

merged [405] [407] from trunk: fixed #92, full ZendOptimizer? compatibility

Location:
branches/1.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2

  • branches/1.2/xcache.c

    r406 r408  
    9898
    9999static zend_bool xc_initized = 0;
     100static zend_compile_file_t *origin_compile_file = NULL;
    100101static zend_compile_file_t *old_compile_file = NULL;
    101102static zend_llist_element  *xc_llist_zend_extension = NULL;
     
    838839}
    839840/* }}} */
     841static zend_op_array *xc_check_initial_compile_file(zend_file_handle *h, int type TSRMLS_DC) /* {{{ */
     842{
     843    XG(initial_compile_file_called) = 1;
     844    return origin_compile_file(h, type TSRMLS_CC);
     845}
     846/* }}} */
    840847static zend_op_array *xc_compile_file(zend_file_handle *h, int type TSRMLS_DC) /* {{{ */
    841848{
     
    941948    old_constinfo_cnt  = zend_hash_num_elements(EG(zend_constants));
    942949
     950    XG(initial_compile_file_called) = 0;
    943951    zend_try {
    944952        op_array = old_compile_file(h, type TSRMLS_CC);
     
    954962        goto err_oparray;
    955963    }
     964
     965    if (!XG(initial_compile_file_called)) {
     966        xc_sandbox_free(&sandbox, XC_InstallNoBinding TSRMLS_CC);
     967        return op_array;
     968    }
    956969
    957970    filename = h->opened_path ? h->opened_path : h->filename;
     
    11251138    if (xc_test && stored_xce) {
    11261139        /* free it, no install. restore now */
    1127         xc_sandbox_free(&sandbox, 0 TSRMLS_CC);
     1140        xc_sandbox_free(&sandbox, XC_NoInstall TSRMLS_CC);
    11281141    }
    11291142    else if (!op_array) {
    11301143        /* failed to compile free it, no install */
    1131         xc_sandbox_free(&sandbox, 0 TSRMLS_CC);
     1144        xc_sandbox_free(&sandbox, XC_NoInstall TSRMLS_CC);
    11321145    }
    11331146    else {
    11341147        CG(active_op_array) = op_array;
    1135         xc_sandbox_free(&sandbox, 1 TSRMLS_CC);
     1148        xc_sandbox_free(&sandbox, XC_Install TSRMLS_CC);
    11361149    }
    11371150
     
    13781391        zend_compile_file = old_compile_file;
    13791392        old_compile_file = NULL;
     1393    }
     1394
     1395    if (origin_compile_file) {
     1396        zend_compile_file = origin_compile_file;
     1397        origin_compile_file = NULL;
    13801398    }
    13811399
     
    27462764#endif
    27472765/* }}} */
    2748 static startup_func_t xc_last_ext_startup = NULL;
     2766static startup_func_t xc_last_ext_startup;
    27492767static int xc_zend_startup_last(zend_extension *extension) /* {{{ */
    27502768{
     
    27672785{
    27682786    xc_zend_extension_gotup = 1;
     2787
     2788    if (!origin_compile_file) {
     2789        origin_compile_file = zend_compile_file;
     2790        zend_compile_file = xc_check_initial_compile_file;
     2791    }
     2792
    27692793    if (zend_llist_count(&zend_extensions) > 1) {
    27702794        zend_llist_position lpos;
Note: See TracChangeset for help on using the changeset viewer.