Exemple #1
0
void
_CfrTil_EndBlock2 ( BlockInfo * bi )
{
    Compiler * compiler = _Context_->Compiler0 ;
    if ( _Stack_IsEmpty ( compiler->BlockStack ) )
    {
        _CfrTil_InstallGotoCallPoints_Keyed ( bi, GI_GOTO | GI_RECURSE | GI_CALL_LABEL ) ;
        CfrTil_TurnOffBlockCompiler ( ) ;
    }
    else _Compiler_FreeBlockInfoLocalsNamespace ( bi, _Context_->Compiler0 ) ;
    compiler->BlockLevel -- ;
}
Exemple #2
0
void
CfrTil_EndCombinator ( int32 quotesUsed, int32 moveFlag )
{
    Compiler * compiler = _Context_->Compiler0 ;
    BlockInfo *bi = ( BlockInfo * ) _Stack_Pick ( compiler->CombinatorBlockInfoStack, quotesUsed - 1 ) ; // -1 : remember - stack is zero based ; stack[0] is top
    _CfrTil_InstallGotoCallPoints_Keyed ( ( BlockInfo* ) bi, GI_BREAK | GI_CONTINUE ) ;
    if ( moveFlag && GetState ( _Q_->OVT_CfrTil, INLINE_ON ) )
    {
        byte * qCodeStart ;
        if ( bi->FrameStart ) qCodeStart = bi->bp_First ; // after the stack frame
        else qCodeStart = bi->ActualCodeStart ;
        Block_Copy ( qCodeStart, bi->CombinatorStartsAt, Here - bi->CombinatorStartsAt ) ;
    }
    _Stack_DropN ( compiler->CombinatorBlockInfoStack, quotesUsed ) ;
    if ( GetState ( compiler, LISP_COMBINATOR_MODE ) )
    {
        _Stack_Pop ( compiler->CombinatorInfoStack ) ;
        if ( ! Stack_Depth ( compiler->CombinatorInfoStack ) ) SetState ( compiler, LISP_COMBINATOR_MODE, false ) ;
    }
}
Exemple #3
0
void
_CfrTil_EndBlock1 ( BlockInfo * bi )
{
    Compiler * compiler = _Context_->Compiler0 ;
    if ( _Stack_IsEmpty ( compiler->BlockStack ) )
    {
        _CfrTil_InstallGotoCallPoints_Keyed ( bi, GI_RETURN ) ;
        if ( compiler->NumberOfRegisterVariables && ( compiler->NumberOfStackVariables == 1 ) &&
            Compiler_GetState ( compiler, ( RETURN_TOS | RETURN_EAX ) ) )
        {
            bi->bp_First = bi->Start ;
            if ( Compiler_GetState ( compiler, RETURN_EAX ) )
            {
                Compile_Move_EAX_To_TOS ( DSP ) ;
            }
        }
        else if ( _Compiler_IsFrameNecessary ( compiler ) && ( ! GetState ( compiler, DONT_REMOVE_STACK_VARIABLES ) ) )
        {
            if ( Compiler_GetState ( compiler, SAVE_ESP ) ) // SAVE_ESP is set by 'return'
            {
                _ESP_Setup ( ) ;
                bi->bp_First = bi->FrameStart ;
            }
            else bi->bp_First = bi->AfterEspSave ; // 3 : after ESP_Save code in frame setup code
            _Compiler_RemoveLocalFrame ( compiler ) ;
        }
        else
        {
            bi->bp_First = bi->Start ;
        }
    }
    _Compile_Return ( ) ;
    _DataStack_Push ( ( int32 ) bi->bp_First ) ;
    bi->bp_Last = Here ;
    _SetOffsetForCallOrJump ( bi->JumpOffset, Here, 0 ) ;
}