Changeset 142

Show
Ignore:
Timestamp:
05/09/06 22:54:53 (3 years ago)
Author:
krobillard
Message:

Fixed GC issues created by the changes to function argument handling [140].
Also fixed mold and form so they hold their argument from the GC.

Location:
trunk/orca
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/orca/gc.c

    r99 r142  
    169169#endif 
    170170 
    171     // Function argument blocks will have blk->used set but no blk->values. 
    172171    if( ! it ) 
    173172        return; 
     
    255254                    orSetBit( bsBlk.byteArray, idx ); 
    256255 
    257                 idx = it->func.context - orEnv->freeBlocks.sweepStart; 
    258                 if( idx >= 0 ) 
    259                     orSetBit( bsBlk.byteArray, idx ); 
     256                // Must check contents of argument block even if below 
     257                // sweepStart. 
     258                idx = it->func.context; 
     259                if( idx > 0 ) 
     260                { 
     261                    // During recursion this will waste some time 
     262                    // rechecking stack values. 
     263                    checkBlock( orBLOCKS + idx ); 
     264                } 
    260265                break; 
    261266 
  • trunk/orca/ovalue.c

    r140 r142  
    15611561OR_NATIVE( orEitherNative ) 
    15621562{ 
    1563     OValue* blkArg = a1 + 2;; 
     1563    OValue* blkArg = a1 + 2; 
    15641564    if( a1->type != OT_NONE ) 
    15651565    { 
     
    29702970        int vi; 
    29712971 
    2972         orRefAvailErr( 3 ) 
    2973         orRefPush( OT_BLOCK, a1->index ); 
     2972        blkN = a1->index; 
     2973 
     2974        orRefAvailErr( 2 ) 
     2975        orRefPush( OT_BLOCK, blkN ); 
     2976 
    29742977        rblk = orMakeBlock(0); 
    2975  
    29762978        nblkN = orBlockN(rblk); 
    2977         blkN = a1->index; 
    2978         blk = orBLOCK( a1 ); 
     2979 
     2980        blk = orBlockPtr( blkN ); 
    29792981        used = blk->used; 
    29802982        vi = a1->series.it; 
    29812983 
    2982         orRefPush( OT_BLOCK, blkN ); 
    29832984        orRefPush( OT_BLOCK, nblkN ); 
    29842985 
     
    30003001        } 
    30013002 
    3002         orRefPop( 3 ); 
     3003        orRefPop( 2 ); 
    30033004        orResultBLOCK( nblkN ); 
    30043005    } 
     
    43654366    orRefPush( OT_BLOCK, ctx.vblkN ); 
    43664367 
     4368    // Initialize values for GC. 
     4369    it   = vblk->values; 
    43674370    next = vblk->values + total; 
     4371    while( it != next ) 
     4372    { 
     4373        orSetTF( it, OT_NONE ); 
     4374        ++it; 
     4375    } 
     4376 
    43684377    orSetTF( next, OT_UNSET ); 
    43694378    next->RECURSE_COUNT = 0; 
  • trunk/orca/print.c

    r98 r142  
    11271127OR_NATIVE_PUB( orFormNative ) 
    11281128{ 
    1129     OString* str = orMakeString( 0 ); 
     1129    OString* str; 
     1130 
     1131    ++orEnv->dataStack.used; 
     1132    str = orMakeString( 0 ); 
     1133    --orEnv->dataStack.used; 
     1134 
    11301135    orForm( str, a1 ); 
    11311136    orResultSTRING( orStringN(str) ); 
     
    11391144{ 
    11401145#define REF_MOLD_ONLY    a1+1 
    1141     OString* str = orMakeString( 0 ); 
     1146    OString* str; 
     1147 
     1148    ++orEnv->dataStack.used; 
     1149    str = orMakeString( 0 ); 
     1150    --orEnv->dataStack.used; 
     1151 
    11421152    mold( str, a1, 0, orRefineSet(REF_MOLD_ONLY) ? MOLD_NO_BRACES : 0 ); 
    11431153    if( str->used )