Changeset 245 in dev


Ignore:
Timestamp:
Jul 27, 2007, 8:02:22 PM (17 years ago)
Author:
dai_9181
Message:
 
Location:
trunk/abdev
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/abdev/BasicCompiler32/Compile_Statement.cpp

    r243 r245  
    140140    }
    141141
    142     CodeGenerator::PertialSchedule *pIfPertialSchedule = NULL;
     142    const CodeGenerator::PertialSchedule *pIfPertialSchedule = NULL;
    143143    if( !NumOpe(Parameter,Type(),tempType) ){
    144144        //NumOpe内でエラー
     
    207207
    208208        //jne
    209         CodeGenerator::PertialSchedule *pTempPertialSchedule1 = compiler.codeGenerator.op_jne( 0, sizeof(char), true );
     209        const CodeGenerator::PertialSchedule *pTempPertialSchedule1 = compiler.codeGenerator.op_jne( 0, sizeof(char), true );
    210210
    211211        //cmp ebx,0
     
    213213
    214214        //jne
    215         CodeGenerator::PertialSchedule *pTempPertialSchedule2 = compiler.codeGenerator.op_jne( 0, sizeof(char), true );
     215        const CodeGenerator::PertialSchedule *pTempPertialSchedule2 = compiler.codeGenerator.op_jne( 0, sizeof(char), true );
    216216
    217217        //jmp (endif、または else までジャンプ)
     
    252252    if(i2==ESC_ELSE){
    253253        //jmp (endifまで)
    254         CodeGenerator::PertialSchedule *pTempPertialSchedule = compiler.codeGenerator.op_jmp( 0, sizeof(long), true );
     254        const CodeGenerator::PertialSchedule *pTempPertialSchedule = compiler.codeGenerator.op_jmp( 0, sizeof(long), true );
    255255
    256256        compiler.codeGenerator.opfix_JmpPertialSchedule( pIfPertialSchedule );
     
    346346    if(!Parameter[0]) SetError(10,"While",cp);
    347347
    348     CodeGenerator::PertialSchedule *pWhilePertialSchedule = NULL;
     348    const CodeGenerator::PertialSchedule *pWhilePertialSchedule = NULL;
    349349    Type tempType;
    350350    if( !NumOpe(Parameter,Type(),tempType) ){
     
    414414
    415415        //jne
    416         CodeGenerator::PertialSchedule *pTempPertialSchedule1 = compiler.codeGenerator.op_jne( 0, sizeof(char), true );
     416        const CodeGenerator::PertialSchedule *pTempPertialSchedule1 = compiler.codeGenerator.op_jne( 0, sizeof(char), true );
    417417
    418418        //cmp ebx,0
     
    420420
    421421        //jne
    422         CodeGenerator::PertialSchedule *pTempPertialSchedule2 = compiler.codeGenerator.op_jne( 0, sizeof(char), true );
     422        const CodeGenerator::PertialSchedule *pTempPertialSchedule2 = compiler.codeGenerator.op_jne( 0, sizeof(char), true );
    423423
    424424        //jmp (Wendまでジャンプ)
     
    492492
    493493    //jmp ...
    494     CodeGenerator::PertialSchedule *pTempPertialSchedule = compiler.codeGenerator.op_jmp( 0, sizeof(long), true );
     494    const CodeGenerator::PertialSchedule *pTempPertialSchedule = compiler.codeGenerator.op_jmp( 0, sizeof(long), true );
    495495
    496496    //Continueアドレスのバックアップとセット
     
    534534
    535535    //jmp [カウンタ減少の場合の判定を飛び越す]
    536     CodeGenerator::PertialSchedule *pTempPertialSchedule2 = compiler.codeGenerator.op_jmp( 0, sizeof(long), true );
     536    const CodeGenerator::PertialSchedule *pTempPertialSchedule2 = compiler.codeGenerator.op_jmp( 0, sizeof(long), true );
    537537
    538538    //jeジャンプ先のオフセット値
     
    601601    GetLexicalScopes().CallDestructorsOfScopeEnd();
    602602
    603     CodeGenerator::PertialSchedule *pDoPertialSchedule = NULL;
     603    const CodeGenerator::PertialSchedule *pDoPertialSchedule = NULL;
    604604
    605605    extern char *basbuf;
     
    780780
    781781    //jmp ...
    782     CodeGenerator::PertialSchedule *pTempPertialSchedule = compiler.codeGenerator.op_jmp( 0, sizeof(long), true );
     782    const CodeGenerator::PertialSchedule *pTempPertialSchedule = compiler.codeGenerator.op_jmp( 0, sizeof(long), true );
    783783
    784784    //レキシカルスコープをレベルダウン
  • trunk/abdev/BasicCompiler32/NumOpe_Relation.cpp

    r240 r245  
    142142        compiler.codeGenerator.op_cmp_RR( REG_EDX, REG_ECX );
    143143
    144         CodeGenerator::PertialSchedule *pFalsePertialSchedule1;
     144        const CodeGenerator::PertialSchedule *pFalsePertialSchedule1;
    145145        if(IsSignedType(type_stack[sp-2])==0&&IsSignedType(type_stack[sp-1])==0){
    146146            //符号なし演算
     
    156156        }
    157157
    158         CodeGenerator::PertialSchedule *pTruePertialSchedule;
     158        const CodeGenerator::PertialSchedule *pTruePertialSchedule;
    159159        if(IsSignedType(type_stack[sp-2])==0&&IsSignedType(type_stack[sp-1])==0){
    160160            //符号なし演算
     
    174174
    175175        //ja FalseSchedule2(偽へジャンプ)
    176         CodeGenerator::PertialSchedule *pFalsePertialSchedule2 = compiler.codeGenerator.op_ja( 0, sizeof(char), true );
     176        const CodeGenerator::PertialSchedule *pFalsePertialSchedule2 = compiler.codeGenerator.op_ja( 0, sizeof(char), true );
    177177
    178178        //TrueScheduleのジャンプ先の設定
     
    351351        compiler.codeGenerator.op_cmp_RR( REG_EDX, REG_ECX );
    352352
    353         CodeGenerator::PertialSchedule *pFalsePertialSchedule1;
     353        const CodeGenerator::PertialSchedule *pFalsePertialSchedule1;
    354354        if(IsSignedType(AnswerType)){
    355355            //符号あり演算
     
    365365        }
    366366
    367         CodeGenerator::PertialSchedule *pTruePertialSchedule;
     367        const CodeGenerator::PertialSchedule *pTruePertialSchedule;
    368368        if(IsSignedType(AnswerType)){
    369369            //符号あり演算
     
    383383
    384384        //jb FalseSchedule2(偽へジャンプ)
    385         CodeGenerator::PertialSchedule *pFalsePertialSchedule2 = compiler.codeGenerator.op_jb( 0, sizeof(char), true );
     385        const CodeGenerator::PertialSchedule *pFalsePertialSchedule2 = compiler.codeGenerator.op_jb( 0, sizeof(char), true );
    386386
    387387        //TrueScheduleのジャンプ先の設定
     
    563563        compiler.codeGenerator.op_cmp_RR( REG_EDX, REG_ECX );
    564564
    565         CodeGenerator::PertialSchedule *pTruePertialSchedule1;
     565        const CodeGenerator::PertialSchedule *pTruePertialSchedule1;
    566566        if(IsSignedType(AnswerType)){
    567567            //符号あり演算
     
    577577        }
    578578
    579         CodeGenerator::PertialSchedule *pFalsePertialSchedule;
     579        const CodeGenerator::PertialSchedule *pFalsePertialSchedule;
    580580        if(IsSignedType(AnswerType)){
    581581            //符号あり演算
     
    595595
    596596        //jb TrueSchedule2(真へジャンプ)
    597         CodeGenerator::PertialSchedule *pTruePertialSchedule2 = compiler.codeGenerator.op_jb( 0, sizeof(char), true );
     597        const CodeGenerator::PertialSchedule *pTruePertialSchedule2 = compiler.codeGenerator.op_jb( 0, sizeof(char), true );
    598598
    599599        //FalseScheduleのジャンプ先の設定
     
    771771        compiler.codeGenerator.op_cmp_RR( REG_EDX, REG_ECX );
    772772
    773         CodeGenerator::PertialSchedule *pTruePertialSchedule1;
     773        const CodeGenerator::PertialSchedule *pTruePertialSchedule1;
    774774        if(IsSignedType(AnswerType)){
    775775            //符号有り
     
    785785        }
    786786
    787         CodeGenerator::PertialSchedule *pFalsePertialSchedule;
     787        const CodeGenerator::PertialSchedule *pFalsePertialSchedule;
    788788        if(IsSignedType(AnswerType)){
    789789            //符号有り
     
    803803
    804804        //ja TrueSchedule2(真へジャンプ)
    805         CodeGenerator::PertialSchedule *pTruePertialSchedule2 = compiler.codeGenerator.op_ja( 0, sizeof(char), true );
     805        const CodeGenerator::PertialSchedule *pTruePertialSchedule2 = compiler.codeGenerator.op_ja( 0, sizeof(char), true );
    806806
    807807        //FalseScheduleのジャンプ先の設定
     
    975975
    976976        //jne TrueSchedule1(真へジャンプ)
    977         CodeGenerator::PertialSchedule *pTruePertialSchedule1 = compiler.codeGenerator.op_jne( 0, sizeof(char), true );
     977        const CodeGenerator::PertialSchedule *pTruePertialSchedule1 = compiler.codeGenerator.op_jne( 0, sizeof(char), true );
    978978
    979979        //cmp edx,ecx
     
    981981
    982982        //jne TrueSchedule2(真へジャンプ)
    983         CodeGenerator::PertialSchedule *pTruePertialSchedule2 = compiler.codeGenerator.op_jne( 0, sizeof(char), true );
     983        const CodeGenerator::PertialSchedule *pTruePertialSchedule2 = compiler.codeGenerator.op_jne( 0, sizeof(char), true );
    984984
    985985        //xor eax,eax(eaxを0にする)
     
    11411141
    11421142        //jne FalseSchedule1(偽へジャンプ)
    1143         CodeGenerator::PertialSchedule *pFalsePertialSchedule1 = compiler.codeGenerator.op_jne( 0, sizeof(char), true );
     1143        const CodeGenerator::PertialSchedule *pFalsePertialSchedule1 = compiler.codeGenerator.op_jne( 0, sizeof(char), true );
    11441144
    11451145        //cmp edx,ecx
     
    11471147
    11481148        //jne FalseSchedule2(偽へジャンプ)
    1149         CodeGenerator::PertialSchedule *pFalsePertialSchedule2 = compiler.codeGenerator.op_jne( 0, sizeof(char), true );
     1149        const CodeGenerator::PertialSchedule *pFalsePertialSchedule2 = compiler.codeGenerator.op_jne( 0, sizeof(char), true );
    11501150
    11511151        //mov eax,1
  • trunk/abdev/BasicCompiler_Common/include/CodeGenerator.h

    r244 r245  
    5252
    5353private:
    54 
    5554    // 部分スケジュールの管理
    56     typedef std::vector<PertialSchedule *> PertialSchedules;
     55    typedef std::vector<const PertialSchedule *> PertialSchedules;
    5756    PertialSchedules pertialSchedules;
    5857
     
    128127
    129128private:
    130     PertialSchedule *__jmp_op_format( char opcode, long offset, int op_size, bool isPertialSchedule = false, bool isSelfOpcodeOffset = false );
    131 public:
    132     PertialSchedule *op_jle( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
    133     PertialSchedule *op_jbe( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
    134     PertialSchedule *op_jge( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
    135     PertialSchedule *op_jae( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
    136     PertialSchedule *op_jl( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
    137     PertialSchedule *op_jb( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
    138     PertialSchedule *op_jg( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
    139     PertialSchedule *op_ja( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
    140     PertialSchedule *op_jne( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
    141     PertialSchedule *op_je( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
    142     PertialSchedule *op_jmp( long offset, int op_size = sizeof(char), bool isPertialSchedule = false, bool isSelfOpcodeOffset = false );
     129    const PertialSchedule *__jmp_op_format( char opcode, long offset, int op_size, bool isPertialSchedule = false, bool isSelfOpcodeOffset = false );
     130public:
     131    const PertialSchedule *op_jle( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
     132    const PertialSchedule *op_jbe( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
     133    const PertialSchedule *op_jge( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
     134    const PertialSchedule *op_jae( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
     135    const PertialSchedule *op_jl( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
     136    const PertialSchedule *op_jb( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
     137    const PertialSchedule *op_jg( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
     138    const PertialSchedule *op_ja( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
     139    const PertialSchedule *op_jne( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
     140    const PertialSchedule *op_je( long offset, int op_size = sizeof(char), bool isPertialSchedule = false );
     141    const PertialSchedule *op_jmp( long offset, int op_size = sizeof(char), bool isPertialSchedule = false, bool isSelfOpcodeOffset = false );
    143142    void op_jmp_continue();
    144143
  • trunk/abdev/BasicCompiler_Common/include/NativeCode.h

    r244 r245  
    241241        ObpPlus( sizeof(long) );
    242242    }
    243     void PutUserProcSchedule( const UserProc *pUserProc, bool isCall )
    244     {
    245         Schedule schedule( pUserProc, size );
    246         if( isCall == false )
    247         {
    248             schedule.SpecifyAddressOf();
    249         }
    250         schedules.push_back( schedule );
    251 
    252         *((long *)(codeBuffer+size))=0;
    253         size += sizeof(long);
    254 
    255 
    256 
    257         // 未完成
    258         if( isCall )
    259         {
    260             pobj_SubAddrSchedule->add(pUserProc,1);
    261         }
    262         else
    263         {
    264             pobj_SubAddrSchedule->add(pUserProc,0);
    265         }
    266         extern char *OpBuffer;
    267         extern int obp;
    268         *((long *)(OpBuffer+obp))=0;
    269         ObpPlus( sizeof(long) );
    270     }
     243    void PutUserProcSchedule( const UserProc *pUserProc, bool isCall );
    271244    void Put( short s )
    272245    {
  • trunk/abdev/BasicCompiler_Common/src/CommonCodeGenerator.cpp

    r241 r245  
    5353            }
    5454
    55             pertialSchedules.erase( it );
     55            it = pertialSchedules.erase( it );
    5656            delete pPertialSchedule;
    5757
     
    6969    }
    7070}
    71 CodeGenerator::PertialSchedule *CodeGenerator::__jmp_op_format( char opcode, long offset, int op_size, bool isPertialSchedule, bool isSelfOpcodeOffset )
     71const CodeGenerator::PertialSchedule *CodeGenerator::__jmp_op_format( char opcode, long offset, int op_size, bool isPertialSchedule, bool isSelfOpcodeOffset )
    7272{
    7373    long beginCodePos = pNativeCode->GetSize();
     
    111111    }
    112112
    113     PertialSchedule *pPertialSchedule = NULL;
     113    const PertialSchedule *pPertialSchedule = NULL;
    114114    if( isPertialSchedule )
    115115    {
     
    143143    return pPertialSchedule;
    144144}
    145 CodeGenerator::PertialSchedule *CodeGenerator::op_jle( long offset, int op_size, bool isPertialSchedule )
     145const CodeGenerator::PertialSchedule *CodeGenerator::op_jle( long offset, int op_size, bool isPertialSchedule )
    146146{
    147147    return __jmp_op_format( (char)0x0E, offset, op_size, isPertialSchedule );
    148148}
    149 CodeGenerator::PertialSchedule *CodeGenerator::op_jbe( long offset, int op_size, bool isPertialSchedule )
     149const CodeGenerator::PertialSchedule *CodeGenerator::op_jbe( long offset, int op_size, bool isPertialSchedule )
    150150{
    151151    return __jmp_op_format( (char)0x06, offset, op_size, isPertialSchedule );
    152152}
    153 CodeGenerator::PertialSchedule *CodeGenerator::op_jge( long offset, int op_size, bool isPertialSchedule )
     153const CodeGenerator::PertialSchedule *CodeGenerator::op_jge( long offset, int op_size, bool isPertialSchedule )
    154154{
    155155    return __jmp_op_format( (char)0x0D, offset, op_size, isPertialSchedule );
    156156}
    157 CodeGenerator::PertialSchedule *CodeGenerator::op_jae( long offset, int op_size, bool isPertialSchedule )
     157const CodeGenerator::PertialSchedule *CodeGenerator::op_jae( long offset, int op_size, bool isPertialSchedule )
    158158{
    159159    return __jmp_op_format( (char)0x03, offset, op_size, isPertialSchedule );
    160160}
    161 CodeGenerator::PertialSchedule *CodeGenerator::op_jl( long offset, int op_size, bool isPertialSchedule )
     161const CodeGenerator::PertialSchedule *CodeGenerator::op_jl( long offset, int op_size, bool isPertialSchedule )
    162162{
    163163    return __jmp_op_format( (char)0x0C, offset, op_size, isPertialSchedule );
    164164}
    165 CodeGenerator::PertialSchedule *CodeGenerator::op_jb( long offset, int op_size, bool isPertialSchedule )
     165const CodeGenerator::PertialSchedule *CodeGenerator::op_jb( long offset, int op_size, bool isPertialSchedule )
    166166{
    167167    return __jmp_op_format( (char)0x02, offset, op_size, isPertialSchedule );
    168168}
    169 CodeGenerator::PertialSchedule *CodeGenerator::op_jg( long offset, int op_size, bool isPertialSchedule )
     169const CodeGenerator::PertialSchedule *CodeGenerator::op_jg( long offset, int op_size, bool isPertialSchedule )
    170170{
    171171    return __jmp_op_format( (char)0x0F, offset, op_size, isPertialSchedule );
    172172}
    173 CodeGenerator::PertialSchedule *CodeGenerator::op_ja( long offset, int op_size, bool isPertialSchedule )
     173const CodeGenerator::PertialSchedule *CodeGenerator::op_ja( long offset, int op_size, bool isPertialSchedule )
    174174{
    175175    return __jmp_op_format( (char)0x07, offset, op_size, isPertialSchedule );
    176176}
    177 CodeGenerator::PertialSchedule *CodeGenerator::op_jne( long offset, int op_size, bool isPertialSchedule )
     177const CodeGenerator::PertialSchedule *CodeGenerator::op_jne( long offset, int op_size, bool isPertialSchedule )
    178178{
    179179    return __jmp_op_format( (char)0x05, offset, op_size, isPertialSchedule );
    180180}
    181 CodeGenerator::PertialSchedule *CodeGenerator::op_je( long offset, int op_size, bool isPertialSchedule )
     181const CodeGenerator::PertialSchedule *CodeGenerator::op_je( long offset, int op_size, bool isPertialSchedule )
    182182{
    183183    return __jmp_op_format( (char)0x04, offset, op_size, isPertialSchedule );
    184184}
    185 CodeGenerator::PertialSchedule *CodeGenerator::op_jmp( long offset, int op_size, bool isPertialSchedule, bool isSelfOpcodeOffset )
     185const CodeGenerator::PertialSchedule *CodeGenerator::op_jmp( long offset, int op_size, bool isPertialSchedule, bool isSelfOpcodeOffset )
    186186{
    187187    return __jmp_op_format( (char)0xEB, offset, op_size, isPertialSchedule, isSelfOpcodeOffset );
  • trunk/abdev/BasicCompiler_Common/src/NativeCode.cpp

    r237 r245  
    11#include "stdafx.h"
     2
     3#include <NativeCode.h>
     4#include <Procedure.h>
    25
    36#define BREAK_EIP(checkEip)  (obp+0x00401000>=checkEip)
     
    1417    }
    1518}
     19
     20void NativeCode::PutUserProcSchedule( const UserProc *pUserProc, bool isCall )
     21{
     22    pUserProc->Using();
     23
     24    Schedule schedule( pUserProc, size );
     25    if( isCall == false )
     26    {
     27        schedule.SpecifyAddressOf();
     28    }
     29    schedules.push_back( schedule );
     30
     31    *((long *)(codeBuffer+size))=0;
     32    size += sizeof(long);
     33
     34
     35
     36    // 未完成
     37    if( isCall )
     38    {
     39        pobj_SubAddrSchedule->add(pUserProc,1);
     40    }
     41    else
     42    {
     43        pobj_SubAddrSchedule->add(pUserProc,0);
     44    }
     45    extern char *OpBuffer;
     46    extern int obp;
     47    *((long *)(OpBuffer+obp))=0;
     48    ObpPlus( sizeof(long) );
     49}
Note: See TracChangeset for help on using the changeset viewer.