Changeset 593 for branches/1.3/xcache.c


Ignore:
Timestamp:
2009-07-05T06:06:15+02:00 (5 years ago)
Author:
moo
Message:

merged r304,r305,r306,r307 from trunk

Location:
branches/1.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3

  • branches/1.3/xcache.c

    r560 r593  
    3030#include "xcache_globals.h" 
    3131#include "processor.h" 
    32 #include "utils.h" 
    3332#include "const_string.h" 
    3433#include "opcode_spec.h" 
    35  
    36 #ifdef DEBUG 
    37 #   undef NDEBUG 
    38 #   undef inline 
    39 #   define inline 
    40 #else 
    41 #   ifndef NDEBUG 
    42 #       define NDEBUG 
    43 #   endif 
    44 #endif 
    45 #include <assert.h> 
     34#include "utils.h" 
    4635 
    4736#define VAR_ENTRY_EXPIRED(pentry) ((pentry)->ttl && XG(request_time) > pentry->ctime + (pentry)->ttl) 
     
    245234static void xc_entry_hold_php_dmz(xc_entry_t *xce TSRMLS_DC) /* {{{ */ 
    246235{ 
    247 #ifdef DEBUG 
    248     fprintf(stderr, "hold %s\n", xce->name.str.val); 
    249 #endif 
     236    TRACE("hold %s", xce->name.str.val); 
    250237    xce->refcount ++; 
    251238    xc_stack_push(&XG(php_holds)[xce->cache->cacheid], (void *)xce); 
     
    292279static XC_ENTRY_APPLY_FUNC(xc_gc_expires_php_entry_dmz) /* {{{ */ 
    293280{ 
    294 #ifdef DEBUG 
    295     fprintf(stderr, "ttl %lu, %lu %lu\n", (zend_ulong) XG(request_time), (zend_ulong) entry->atime, xc_php_ttl); 
    296 #endif 
     281    TRACE("ttl %lu, %lu %lu", (zend_ulong) XG(request_time), (zend_ulong) entry->atime, xc_php_ttl); 
    297282    if (XG(request_time) > entry->atime + xc_php_ttl) { 
    298283        return 1; 
     
    311296static void xc_gc_expires_one(xc_cache_t *cache, zend_ulong gc_interval, cache_apply_dmz_func_t apply_func TSRMLS_DC) /* {{{ */ 
    312297{ 
    313 #ifdef DEBUG 
    314     fprintf(stderr, "interval %lu, %lu %lu\n", (zend_ulong) XG(request_time), (zend_ulong) cache->last_gc_expires, gc_interval); 
    315 #endif 
     298    TRACE("interval %lu, %lu %lu", (zend_ulong) XG(request_time), (zend_ulong) cache->last_gc_expires, gc_interval); 
    316299    if (XG(request_time) - cache->last_gc_expires >= gc_interval) { 
    317300        ENTER_LOCK(cache) { 
     
    630613    for (i = 0; i < cachecount; i ++) { 
    631614        s = &holds[i]; 
    632 #ifdef DEBUG 
    633         fprintf(stderr, "holded %d\n", xc_stack_size(s)); 
    634 #endif 
    635         if (xc_stack_size(s)) { 
     615        TRACE("holded %d", xc_stack_count(s)); 
     616        if (xc_stack_count(s)) { 
    636617            cache = ((xc_entry_t *)xc_stack_top(s))->cache; 
    637618            ENTER_LOCK(cache) { 
    638                 while (xc_stack_size(s)) { 
     619                while (xc_stack_count(s)) { 
    639620                    xce = (xc_entry_t*) xc_stack_pop(s); 
    640 #ifdef DEBUG 
    641                     fprintf(stderr, "unhold %s\n", xce->name.str.val); 
    642 #endif 
     621                    TRACE("unhold %s", xce->name.str.val); 
    643622                    xce->refcount --; 
    644623                    assert(xce->refcount >= 0); 
     
    829808        assert(0); 
    830809    } 
    831 #ifdef DEBUG 
    832     fprintf(stderr, "got ZEND_DECLARE_INHERITED_CLASS: %s\n", class_name + 1); 
    833 #endif 
     810    TRACE("got ZEND_DECLARE_INHERITED_CLASS: %s", class_name + 1); 
    834811    /* let's see which class */ 
    835812    for (i = 0; i < php->classinfo_cnt; i ++) { 
     
    915892        /* found */ 
    916893        if (stored_xce) { 
    917 #ifdef DEBUG 
    918             fprintf(stderr, "found %s, catch it\n", stored_xce->name.str.val); 
    919 #endif 
     894            TRACE("found %s, catch it", stored_xce->name.str.val); 
    920895            xc_entry_hold_php_dmz(stored_xce TSRMLS_CC); 
    921896            cache->hits ++; 
     
    944919 
    945920    /* {{{ compile */ 
    946 #ifdef DEBUG 
    947     fprintf(stderr, "compiling %s\n", filename); 
    948 #endif 
     921    TRACE("compiling %s", filename); 
    949922 
    950923    /* make compile inside sandbox */ 
     
    11251098    } LEAVE_LOCK_EX(cache); 
    11261099    /* }}} */ 
    1127 #ifdef DEBUG 
    1128     fprintf(stderr, "stored\n"); 
    1129 #endif 
     1100    TRACE("%s", "stored"); 
    11301101 
    11311102#define X_FREE(var) \ 
     
    11861157    CG(compiled_filename) = stored_xce->name.str.val; 
    11871158    CG(zend_lineno)       = 0; 
    1188 #ifdef DEBUG 
    1189     fprintf(stderr, "restoring %s\n", stored_xce->name.str.val); 
    1190 #endif 
     1159    TRACE("restoring %s", stored_xce->name.str.val); 
    11911160    xc_processor_restore_xc_entry_t(&xce, stored_xce, xc_readonly_protection TSRMLS_CC); 
    11921161#ifdef SHOW_DPRINT 
     
    12211190    CG(in_compilation)    = 0; 
    12221191    CG(compiled_filename) = NULL; 
    1223 #ifdef DEBUG 
    1224     fprintf(stderr, "restored  %s\n", stored_xce->name.str.val); 
    1225 #endif 
     1192    TRACE("restored  %s", stored_xce->name.str.val); 
    12261193    return op_array; 
    12271194} 
     
    20061973        stored_xce = xc_entry_find_dmz(&xce TSRMLS_CC); 
    20071974        if (stored_xce) { 
    2008 #ifdef DEBUG 
    2009             fprintf(stderr, "incdec: gotxce %s\n", xce.name.str.val); 
    2010 #endif 
     1975            TRACE("incdec: gotxce %s", xce.name.str.val); 
    20111976            /* timeout */ 
    20121977            if (VAR_ENTRY_EXPIRED(stored_xce)) { 
    2013 #ifdef DEBUG 
    2014                 fprintf(stderr, "incdec: expired\n"); 
    2015 #endif 
     1978                TRACE("%s", "incdec: expired"); 
    20161979                xc_entry_remove_dmz(stored_xce TSRMLS_CC); 
    20171980                stored_xce = NULL; 
     
    20241987                    stored_xce->ctime = XG(request_time); 
    20251988                    stored_xce->ttl   = xce.ttl; 
    2026 #ifdef DEBUG 
    2027                     fprintf(stderr, "incdec: islong\n"); 
    2028 #endif 
     1989                    TRACE("%s", "incdec: islong"); 
    20291990                    value = Z_LVAL_P(stored_var->value); 
    20301991                    value += (inc == 1 ? count : - count); 
     
    20361997                } 
    20371998                else { 
    2038 #ifdef DEBUG 
    2039                     fprintf(stderr, "incdec: notlong\n"); 
    2040 #endif 
     1999                    TRACE("%s", "incdec: notlong"); 
    20412000                    xc_processor_restore_zval(&oldzval, stored_xce->data.var->value, stored_xce->have_references TSRMLS_CC); 
    20422001                    convert_to_long(&oldzval); 
     
    20462005            } 
    20472006        } 
    2048 #ifdef DEBUG 
    20492007        else { 
    2050             fprintf(stderr, "incdec: %s not found\n", xce.name.str.val); 
    2051         } 
    2052 #endif 
     2008            TRACE("incdec: %s not found", xce.name.str.val); 
     2009        } 
    20532010 
    20542011        value += (inc == 1 ? count : - count); 
     
    24952452 
    24962453    zend_llist_prepend_element(&zend_extensions, &extension); 
    2497 #ifdef DEBUG 
    2498     fprintf(stderr, "registered\n"); 
    2499 #endif 
     2454    TRACE("%s", "registered"); 
    25002455} 
    25012456 
Note: See TracChangeset for help on using the changeset viewer.