Changeset 247 in dev for trunk/abdev/BasicCompiler_Common


Ignore:
Timestamp:
Jul 28, 2007, 4:17:56 PM (17 years ago)
Author:
dai_9181
Message:

Exit Subスケジュールをリファクタリングした

Location:
trunk/abdev/BasicCompiler_Common
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/abdev/BasicCompiler_Common/Compile.cpp

    r246 r247  
    2828int CaseScheduleNum;
    2929int NowCaseSchedule;
    30 
    31 //プロシージャ抜け出しスケジュール(Exit Sub/Function)
    32 DWORD *pExitSubSchedule;
    33 int ExitSubScheduleNum;
    3430
    3531//グローバル変数初期バッファ
  • trunk/abdev/BasicCompiler_Common/include/CodeGenerator.h

    r246 r247  
    101101public:
    102102
     103    // Exit Subスケジュールの管理
     104    std::vector<long> exitSubCodePositions;
     105    std::vector<int> _exitSubCodePositions_ObpOld;
     106
    103107    // Gotoスケジュールの管理
    104108    std::vector<GotoLabelSchedule> gotoLabelSchedules;
     
    158162        return _continueCodePositions_ObpOld[_continueCodePositions_ObpOld.size()-1];
    159163    }
     164   
     165    void ResolveExitSubSchedule();
    160166
    161167    void CheckUnresolveSchedule();
     
    183189    const PertialSchedule *op_jmp( long offset, int op_size = sizeof(char), bool isPertialSchedule = false, bool isSelfOpcodeOffset = false );
    184190    void op_jmp_continue();
     191    void op_jmp_exitsub();
    185192    void op_jmp_goto_schedule( const GotoLabelSchedule &gotoLabelSchedule );
    186193
  • trunk/abdev/BasicCompiler_Common/src/CommonCodeGenerator.cpp

    r246 r247  
    33#include <CodeGenerator.h>
    44
     5
     6void CodeGenerator::ResolveExitSubSchedule()
     7{
     8    BOOST_FOREACH( long exitSubCodePosition, exitSubCodePositions )
     9    {
     10        pNativeCode->Overwrite( exitSubCodePosition, (long)( pNativeCode->GetSize()-(exitSubCodePosition+sizeof(long)) ) );
     11    }
     12   
     13    // TODO: 未完成
     14    BOOST_FOREACH( long exitSubCodePositionOld, _exitSubCodePositions_ObpOld )
     15    {
     16        extern int obp;
     17        pNativeCode->OverwriteOld( exitSubCodePositionOld, (long)( obp-(exitSubCodePositionOld+sizeof(long)) ) );
     18    }
     19}
    520
    621void CodeGenerator::CheckUnresolveSchedule()
     
    202217    op_jmp( GetContinueCodePosOld()-obp, sizeof(long), false, true );
    203218}
    204 void CodeGenerator::op_jmp_goto_schedule( const GotoLabelSchedule &gotoLabelSchedule )
     219void CodeGenerator::op_jmp_exitsub()
    205220{
    206221    // オペコード
    207222    pNativeCode->Put( (char)0xE9 );
    208223
     224    exitSubCodePositions.push_back( pNativeCode->GetSize() );
     225   
     226    extern int obp;
     227    _exitSubCodePositions_ObpOld.push_back( obp );
     228
     229    pNativeCode->Put( (long)0 );
     230}
     231void CodeGenerator::op_jmp_goto_schedule( const GotoLabelSchedule &gotoLabelSchedule )
     232{
     233    // オペコード
     234    pNativeCode->Put( (char)0xE9 );
     235
    209236    gotoLabelSchedules.push_back( gotoLabelSchedule );
    210237
Note: See TracChangeset for help on using the changeset viewer.