Changeset 936 in svn for trunk/xcache.c


Ignore:
Timestamp:
2012-06-28T09:45:40+02:00 (3 years ago)
Author:
Xuefer
Message:

change misses to updates. misses is kept for compatibility reason but deprecated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xcache.c

    r931 r936  
    281281    if (stored_entry) {
    282282        xc_entry_add_unlocked(cache, entryslotid, stored_entry);
     283        ++cache->updates;
    283284        return stored_entry;
    284285    }
     
    592593    add_assoc_long_ex(return_value, ZEND_STRS("slots"),     cache->hentry->size);
    593594    add_assoc_long_ex(return_value, ZEND_STRS("compiling"), cache->compiling);
    594     add_assoc_long_ex(return_value, ZEND_STRS("misses"),    cache->misses);
     595    add_assoc_long_ex(return_value, ZEND_STRS("updates"),   cache->updates);
     596    add_assoc_long_ex(return_value, ZEND_STRS("misses"),    cache->updates); /* deprecated */
    595597    add_assoc_long_ex(return_value, ZEND_STRS("hits"),      cache->hits);
    596598    add_assoc_long_ex(return_value, ZEND_STRS("clogs"),     cache->clogs);
     
    16011603}
    16021604/* }}} */
    1603 static zend_op_array *xc_compile_php(xc_compiler_t *compiler, zend_file_handle *h, int type TSRMLS_DC) /* {{{ */
    1604 {
    1605     zend_op_array *op_array;
     1605static void xc_compile_php(xc_compiler_t *compiler, zend_file_handle *h, int type TSRMLS_DC) /* {{{ */
     1606{
    16061607    zend_uint old_constinfo_cnt, old_funcinfo_cnt, old_classinfo_cnt;
    16071608    zend_bool catched = 0;
     
    16141615    old_constinfo_cnt = zend_hash_num_elements(EG(zend_constants));
    16151616
    1616     compiler->new_php.op_array = NULL;
    1617     XG(initial_compile_file_called) = 0;
    16181617    zend_try {
    1619         op_array = old_compile_file(h, type TSRMLS_CC);
     1618        compiler->new_php.op_array = old_compile_file(h, type TSRMLS_CC);
    16201619    } zend_catch {
    16211620        catched = 1;
     
    16261625    }
    16271626
    1628     if (op_array == NULL) {
     1627    if (compiler->new_php.op_array == NULL) {
    16291628        goto err_op_array;
    16301629    }
    16311630
    16321631    if (!XG(initial_compile_file_called)) {
    1633         return op_array;
     1632        return;
    16341633    }
    16351634
     
    16371636    /* {{{ prepare */
    16381637    zend_restore_compiled_filename(h->opened_path ? h->opened_path : (char *) h->filename TSRMLS_CC);
    1639     compiler->new_php.op_array = op_array;
    16401638
    16411639#ifdef HAVE_XCACHE_CONSTANT
     
    18191817#endif
    18201818
    1821     return op_array;
     1819    return;
    18221820
    18231821err_alloc:
     
    18301828        zend_bailout();
    18311829    }
    1832 
    1833     return op_array;
    18341830}
    18351831/* }}} */
     
    19121908    */
    19131909
    1914     zend_op_array *op_array;
    19151910    xc_entry_php_t *stored_entry;
    19161911    xc_entry_data_php_t *stored_php;
     
    19561951        }
    19571952
    1958         cache->misses ++;
    19591953        TRACE("miss entry %d:%s", compiler->new_entry.file_inode, compiler->new_entry.entry.name.str.val);
    19601954
     
    20082002    /* }}} */
    20092003
    2010     op_array = NULL;
    20112004    /* {{{ compile */
    20122005    /* make compile inside sandbox */
    2013     xc_sandbox_init(&sandbox, h->opened_path ? h->opened_path : h->filename TSRMLS_CC);
    20142006
    20152007#ifdef HAVE_XCACHE_CONSTANT
     
    20232015    memset(&compiler->new_php.op_array_info, 0, sizeof(compiler->new_php.op_array_info));
    20242016
     2017    XG(initial_compile_file_called) = 0;
    20252018    zend_try {
    2026         op_array = xc_compile_php(compiler, h, type TSRMLS_CC);
     2019        xc_sandbox_init(&sandbox, h->opened_path ? h->opened_path : h->filename TSRMLS_CC);
     2020        compiler->new_php.op_array = NULL;
     2021        xc_compile_php(compiler, h, type TSRMLS_CC);
    20272022    } zend_catch {
    20282023        catched = 1;
    20292024    } zend_end_try();
    20302025
    2031     if (catched || !op_array) {
     2026    if (catched
     2027     || !compiler->new_php.op_array /* possible ? */
     2028     || !XG(initial_compile_file_called)) {
    20322029        goto err_aftersandbox;
    20332030    }
    20342031
    2035     /* not cachable */
    2036     if (!compiler->new_php.op_array) {
    2037         cache->compiling = 0;
    2038         /* it's not cachable, but don't scare the users with high misses */
    2039         cache->misses --;
    2040         xc_sandbox_free(&sandbox, XC_InstallNoBinding TSRMLS_CC);
    2041         return op_array;
    2042     }
    20432032    /* }}} */
    20442033#ifdef SHOW_DPRINT
     
    20652054    TRACE("%s", stored_entry ? "stored" : "store failed");
    20662055
     2056    if (catched || !stored_php) {
     2057        goto err_aftersandbox;
     2058    }
     2059
    20672060    cache->compiling = 0;
    2068     if (catched) {
    2069         goto err_aftersandbox;
    2070     }
    2071 
    20722061    xc_free_php(&compiler->new_php TSRMLS_CC);
    20732062
    20742063    if (stored_entry) {
    2075         if (op_array) {
     2064        if (compiler->new_php.op_array) {
    20762065#ifdef ZEND_ENGINE_2
    2077             destroy_op_array(op_array TSRMLS_CC);
     2066            destroy_op_array(compiler->new_php.op_array TSRMLS_CC);
    20782067#else
    2079             destroy_op_array(op_array);
    2080 #endif
    2081             efree(op_array);
     2068            destroy_op_array(compiler->new_php.op_array);
     2069#endif
     2070            efree(compiler->new_php.op_array);
     2071            compiler->new_php.op_array = NULL;
    20822072            h = NULL;
    20832073        }
     
    20882078        zend_op_array *old_active_op_array = CG(active_op_array);
    20892079        /* install it */
    2090         CG(active_op_array) = op_array;
     2080        CG(active_op_array) = compiler->new_php.op_array;
    20912081        xc_sandbox_free(&sandbox, XC_Install TSRMLS_CC);
    20922082        CG(active_op_array) = old_active_op_array;
    20932083    }
    2094     return op_array;
     2084    return compiler->new_php.op_array;
    20952085
    20962086err_aftersandbox:
     
    20982088    xc_sandbox_free(&sandbox, XC_NoInstall TSRMLS_CC);
    20992089
     2090    cache->compiling = 0;
    21002091    if (catched) {
    2101         cache->compiling = 0;
    21022092        cache->errors ++;
    21032093        zend_bailout();
    21042094    }
    2105     return op_array;
     2095    return compiler->new_php.op_array;
    21062096}
    21072097/* }}} */
     
    28392829        else {
    28402830            RETVAL_NULL();
    2841             cache->misses ++;
    28422831        }
    28432832    } LEAVE_LOCK(cache);
     
    30253014                zv = (zval *) cache->shm->handlers->to_readwrite(cache->shm, (char *) stored_entry_var->value);
    30263015                Z_LVAL_P(zv) = value;
     3016                ++cache->updates;
    30273017                break; /* leave lock */
    30283018            }
Note: See TracChangeset for help on using the changeset viewer.