Changeset 106 for trunk/thune/make.c

Show
Ignore:
Timestamp:
03/31/06 22:47:57 (3 years ago)
Author:
krobillard
Message:

Thune - Garbage collector now checks the control stack.

Eliminated quick holds.
Tests now run with GC_STRESS_TEST defined.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/thune/make.c

    r100 r106  
    5555 
    5656#ifdef GC_STRESS_TEST 
    57     if( ur_env->blocks.sweepStart && (ur_env->flags & UR_ENV_GC) ) 
     57    if( ur_env->flags & UR_ENV_GC ) 
    5858        ur_recycle(); 
    5959#endif 
     
    9494 
    9595#ifdef GC_STRESS_TEST 
    96     if( ur_env->bin.sweepStart && (ur_env->flags & UR_ENV_GC) ) 
     96    if( ur_env->flags & UR_ENV_GC ) 
    9797        ur_recycle(); 
    9898#endif 
     
    426426 
    427427 
    428 void ur_makeContext( UContext* ctx, UCell* proto ) 
     428static void ur_makeContext( UContext* ctx, const UCell* proto ) 
    429429{ 
    430430    if( proto && ur_is(proto, UT_BLOCK) ) 
     
    435435        UCell* start; 
    436436        UCell* end; 
     437        UIndex hold; 
    437438 
    438439        blk = ur_blockPtr( proto->series.n ); 
     
    451452        ctx->ctx.wordBlk = ur_makeBlock( size ); 
    452453 
    453         ur_refPush( UT_BLOCK, ctx->ctx.wordBlk ); 
     454        hold = ur_hold( UT_BLOCK, ctx->ctx.wordBlk ); 
    454455        ctx->ctx.protoValBlk = ur_makeBlock( size ); 
    455456        ctx->ctx.valBlk = ctx->ctx.protoValBlk; 
    456         ur_refPop( 1 ); 
     457        ur_release( hold ); 
    457458 
    458459 
     
    554555    int argc = 1; 
    555556 
    556     UR_S_DROP; 
    557     res = UR_TOS; 
     557    res = ur_s_prev(tos); 
    558558 
    559559    if( ur_is(res, UT_DATATYPE) ) 
     
    562562        { 
    563563            ur_copy(res, *tos);     // UR_S_NIP; 
     564            UR_S_DROP; 
    564565            return; 
    565566        } 
     
    574575 
    575576        argc = 2; 
    576         UR_S_DROP; 
    577577    } 
    578578 
     
    611611                                        str->ptr.c + str->used ); 
    612612                } 
    613                 if( ! blkN ) 
     613                else 
    614614                { 
    615615                    blkN = ur_makeBlock(0); 
    616616                } 
    617617 
    618                 ur_setType(res, UT_BLOCK); 
    619                 ur_setSeries(res, blkN, 0); 
     618                if( blkN ) 
     619                { 
     620                    ur_setType(res, UT_BLOCK); 
     621                    ur_setSeries(res, blkN, 0); 
     622                } 
    620623            } 
    621624            break; 
     
    689692                ur_bind( tos->series.n, res ); 
    690693 
    691                 UR_S_GROW; 
    692  
    693694                //ur_callControl( UR_CALL_DO ); 
     695                //return UC_DO; 
    694696                UR_CALL_OP = OP_DO; 
    695                 //return UC_DO; 
     697                return; 
    696698            } 
    697699            //else if( ur_is(res, UT_CONTEXT) ) 
     
    701703 
    702704        case UT_BITSET: 
     705        { 
     706            // Make bitset before setting res in case GC is called. 
     707            UIndex binN = ur_makeBitset(tos); 
    703708            ur_setType(res, UT_BITSET); 
    704             ur_setSeries(res, ur_makeBitset(tos), 0); 
     709            ur_setSeries(res, binN, 0); 
     710        } 
    705711            break; 
    706712 
     
    708714            goto error; 
    709715    } 
     716 
     717    UR_S_DROPN( argc ); 
    710718    return; 
    711719    //return UC_CONT;