Changeset 509 for trunk/thune/gc.c

Show
Ignore:
Timestamp:
02/09/08 02:35:22 (10 months ago)
Author:
krobillard
Message:

Added hold/release macros. ur_readDir() now holds its result block.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/thune/gc.c

    r508 r509  
    231231 
    232232 
     233static void _checkCells( UThread* ut, UCollector* gc, UCell* it, UCell* end ); 
     234 
    233235static void _checkBlock( UThread* ut, UCollector* gc, UBlock* blk ) 
    234236{ 
    235     int idx; 
    236237    UCell* it  = blk->ptr.cells; 
    237     UCell* end = it + blk->used; 
    238238 
    239239#ifdef GC_VERBOSE 
     
    241241#endif 
    242242 
    243     if( ! it ) 
    244         return; 
    245  
     243    if( it ) 
     244        _checkCells( ut, gc, it, it + blk->used ); 
     245} 
     246 
     247 
     248static void _checkCells( UThread* ut, UCollector* gc, UCell* it, UCell* end ) 
     249{ 
     250    int idx; 
    246251    while( it != end ) 
    247252    { 
     
    396401            case CC_ITER: 
    397402            case CC_EACH: 
     403            { 
     404                UCell* cell = ((UCell*) it) - 1; 
    398405                SET_BIT_BLOCK_L( it->cp.n ) 
     406                _checkCells( ut, gc, cell, cell + 1 ); 
    399407                it -= CC_LEN_ITER; 
     408            } 
    400409                break; 
    401410 
     
    422431static void _checkControlStack( UThread* ut, UCollector* gc ) 
    423432{ 
    424     UBlock blk; 
    425  
    426     blk.ptr.cells = UR_BOC; 
    427     blk.used      = UR_TOC - UR_BOC; 
    428  
    429     assert( blk.used > -1 ); 
    430  
    431     _checkBlock( ut, gc, &blk ); 
     433    assert( UR_TOC >= UR_BOC ); 
     434 
     435    _checkCells( ut, gc, UR_BOC, UR_TOC ); 
    432436} 
    433437#endif 
     
    436440static void _checkDataStack( UThread* ut, UCollector* gc ) 
    437441{ 
    438     UBlock blk; 
    439  
    440     blk.ptr.cells = UR_BOS + 1; 
    441     blk.used      = UR_TOS - UR_BOS; 
    442  
    443442#ifndef LANG_RUNE 
    444443    assert( ur_is(UR_BOS, UT_UNSET) ); 
    445444#endif 
    446     assert( blk.used > -1 ); 
    447  
    448     _checkBlock( ut, gc, &blk ); 
     445    assert( UR_TOS >= UR_BOS ); 
     446 
     447    _checkCells( ut, gc, UR_BOS + 1, UR_TOS + 1 ); 
    449448} 
    450449