Changeset 187 for trunk/thune/gc.c

Show
Ignore:
Timestamp:
06/20/06 05:09:27 (3 years ago)
Author:
krobillard
Message:

Thune - Major improvement to the handling of local function values.
Locals can now be passed to inner functions and caught when returned.
Functions are no longer tied to the thread which created them.

The localArgBlk has been eliminated and locals are now stored on the stack.
To accomodate this, the data stack is now separate from the control stack
and grows upwards. This also means that functions can no longer access the
stack below the function call. A limit of one returned value is in place.

To regain full stack usage, locals could be stored on the control stack.
The only downside would be an extra copy of arguments from the data to
the control stack.

ur_wordCell() is now a function rather than a macro.

uc_do() has been merged into ur_eval() and 'do is now implemented as an opcode.

. & .s now use uc_console_out() rather than dprint.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/thune/gc.c

    r182 r187  
    206206#endif 
    207207 
    208     // Function argument blocks will have blk->used set but no 
    209     // blk->ptr.cells. 
    210208    if( ! it ) 
    211209        return; 
     
    222220                    SET_BIT_BLOCK( it->word.wordBlk ); 
    223221                } 
    224                 SET_BIT_BLOCK( it->word.valBlk ); 
     222                if( it->word.valBlk > 0 ) 
     223                { 
     224                    SET_BIT_BLOCK( it->word.valBlk ); 
     225                } 
    225226                break; 
    226227 
     
    401402        { 
    402403            case CC_FUNC: 
    403                 if( it->func.argc ) 
    404                     it -= it->func.argc; 
    405                 --it; 
     404                SET_BIT_BLOCK( it->func.bodyN ); 
     405                idx = it->func.sigN; 
     406                if( idx ) 
     407                    ur_setBit( bsBlk.ptr.b, idx ); 
     408                it -= CC_LEN_FUNC; 
    406409                break; 
    407410 
     
    444447    UBlock blk; 
    445448 
    446     blk.ptr.cells = UR_TOS; 
    447     blk.used      = UR_BOS - UR_TOS; 
     449    blk.ptr.cells = UR_BOS + 1; 
     450    blk.used      = UR_TOS - UR_BOS; 
     451 
     452    assert( ur_is(UR_BOS, UT_UNSET) ); 
     453    assert( blk.used > -1 ); 
    448454 
    449455    _checkBlock( &blk );