Changeset 51 in dev


Ignore:
Timestamp:
Feb 10, 2007, 8:30:19 PM (17 years ago)
Author:
dai_9181
Message:

ppobj_Member及びppobj_StaticMemberを廃止し、vectorに統一した(methods及びstaticMethods)。

Files:
23 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler32/CParameter.cpp

    r50 r51  
    109109
    110110            //call destructor
    111             int i5 = types[i2].u.pobj_Class->DestructorMemberSubIndex;
    112             if( i5 != -1 ){
    113                 op_call( types[i2].u.pobj_Class->ppobj_Method[i5]->psi );
     111            CMethod *method = types[i2].u.pobj_Class->GetDestructorMethod();
     112            if( method ){
     113                op_call( method->psi );
    114114            }
    115115
     
    148148    CalcType.type=NumOpe_GetType(Parameter,&BaseType,&CalcType.u.lpIndex);
    149149
    150     if(pobj_Class->CopyConstructorMemberSubIndex!=-1&&
    151         CalcType.type==DEF_OBJECT&&CalcType.u.pobj_Class==pobj_Class){
     150    if( pobj_Class->GetCopyConstructorMethod()
     151        && CalcType.type==DEF_OBJECT&&CalcType.u.pobj_Class==pobj_Class){
    152152        ////////////////////////////////////
    153153        // コピーコンストラクタを呼び出す
     
    179179
    180180        //call constructor
    181         op_call(pobj_Class->ppobj_Method[pobj_Class->CopyConstructorMemberSubIndex]->psi);
     181        op_call(pobj_Class->GetCopyConstructorMethod()->psi);
    182182
    183183
     
    191191
    192192
    193             if(pobj_Class->ConstructorMemberSubIndex!=-1){
     193            if( pobj_Class->GetConstructorMethod() ){
    194194                ////////////////////////////////
    195195                // コンストラクタを呼び出す
     
    200200
    201201                //call constructor
    202                 op_call(pobj_Class->ppobj_Method[pobj_Class->ConstructorMemberSubIndex]->psi);
     202                op_call(pobj_Class->GetConstructorMethod()->psi);
    203203            }
    204204
  • BasicCompiler32/Compile_CallProc.cpp

    r50 r51  
    9595
    9696void Opcode_CallProc(char *Parameter,SUBINFO *psi,DWORD dwFlags,char *ObjectName,int RefType){
    97     int i,i2;
     97    int i2;
    9898
    9999    if(psi->dwType==SUBTYPE_MACRO){
     
    338338        OpBuffer[obp++]=(char)0x11;
    339339
    340         for(i=0,i2=0;i<pobj_c->iMethodNum;i++){
    341             if(pobj_c->ppobj_Method[i]->psi==psi) break;
    342             if(pobj_c->ppobj_Method[i]->psi->bVirtual) i2++;
    343         }
     340        i2 = pobj_c->GetFuncNumInVtbl( psi );
    344341
    345342        //call dword ptr[edx+func_index]
  • BasicCompiler32/Compile_Func.cpp

    r50 r51  
    324324        OpBuffer[obp++]=(char)0x11;
    325325
    326         int i,i2;
    327         for(i=0,i2=0;i<pobj_c->iMethodNum;i++){
    328             if(pobj_c->ppobj_Method[i]->psi==psi) break;
    329             if(pobj_c->ppobj_Method[i]->psi->bVirtual) i2++;
    330         }
     326        int i2 = pobj_c->GetFuncNumInVtbl( psi );
    331327
    332328        //mov eax,dword ptr[edx+func_index]
  • BasicCompiler32/Compile_Object.cpp

    r50 r51  
    220220
    221221
     222    CMethod *method = pobj_c->GetDestructorMethod();
     223    if( method == NULL ) return 0;
     224
    222225    //mov ecx,DestructorProcAddr
    223     i2=pobj_c->DestructorMemberSubIndex;
    224     if(i2==-1) return -1;
    225226    OpBuffer[obp++]=(char)0xB9;
    226     pobj_SubAddrSchedule->add(pobj_c->ppobj_Method[i2]->psi,0);
    227     pobj_c->ppobj_Method[i2]->psi->bUse=1;
     227    pobj_SubAddrSchedule->add(method->psi,0);
     228    method->psi->bUse=1;
    228229    obp+=sizeof(long);
    229230
  • BasicCompiler32/Compile_ProcOp.cpp

    r50 r51  
    219219    extern SUBINFO **ppSubHash;
    220220    extern BOOL bDebugCompile;
    221     int i3,i4,i5,VarSize,LocalVarSchedule,EspOffsetSchedule,BufferSize,BaseOffset;
     221    int i3,i4,VarSize,LocalVarSchedule,EspOffsetSchedule,BufferSize,BaseOffset;
    222222    char temporary[VN_SIZE];
    223223
     
    379379        if(psi->ReturnType==DEF_OBJECT && psi->isReturnRef == false){
    380380            //戻り値用オブジェクトのコンストラクタを呼び出す
    381             if(psi->u.Return_pobj_c->ConstructorMemberSubIndex!=-1){
     381            if( psi->u.Return_pobj_c->GetConstructorMethod() ){
    382382                sprintf(temporary,"%s.%s()",temp,psi->u.Return_pobj_c->name);
    383383                OpcodeOthers(temporary);
     
    462462            BOOL bThisIsSuperClass;
    463463            if(pobj_CompilingClass->pobj_InheritsClass==0) bThisIsSuperClass=1;
    464             else if(pobj_CompilingClass->pobj_InheritsClass->ConstructorMemberSubIndex==-1){
     464            else if( pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod() == NULL ){
    465465                //インターフェイスを継承したときはコンストラクタを持たない
    466466                bThisIsSuperClass=1;
     
    497497                    RemoveStringPare(temporary);
    498498
    499                     i3=pobj_CompilingClass->pobj_InheritsClass->ConstructorMemberSubIndex;
    500499                    Opcode_CallProc(temporary,
    501                         pobj_CompilingClass->ppobj_Method[i3]->psi,
     500                        pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod()->psi,
    502501                        0,
    503502                        "",
     
    506505                else{
    507506                    //基底クラスのコンストラクタを暗黙的に呼び出す
    508                     i3=pobj_CompilingClass->pobj_InheritsClass->ConstructorMemberSubIndex;
    509507                    Opcode_CallProc("",
    510                         pobj_CompilingClass->ppobj_Method[i3]->psi,
     508                        pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod()->psi,
    511509                        0,
    512510                        "",
     
    524522            for(i3=0;i3<pobj_CompilingClass->iMemberNum;i3++){
    525523                CMember *pMember = pobj_CompilingClass->ppobj_Member[i3];
     524                MemberTypeSize=
     525                    GetTypeSize(pMember->TypeInfo.type,
     526                        pMember->TypeInfo.u.lpIndex);
     527
     528                MemberObjectNum=
     529                    JumpSubScripts(pMember->SubScripts);
    526530
    527531                offset=GetSizeOfClassMember(pobj_CompilingClass,pMember->name,NULL);
    528532
    529                 if(pMember->TypeInfo.type==DEF_OBJECT){
    530                     if(pMember->TypeInfo.u.pobj_Class->ConstructorMemberSubIndex!=-1){
    531                         i5=pMember->TypeInfo.u.pobj_Class->ConstructorMemberSubIndex;
    532                         if(pMember->TypeInfo.u.pobj_Class->ppobj_Method[i5]->psi->RealParmNum==1){  //Thisポインタを第一引数に持ち合わせるため、引数なしの場合はこの値が1になる
    533 
    534                             MemberTypeSize=
    535                                 GetTypeSize(pMember->TypeInfo.type,
    536                                     pMember->TypeInfo.u.lpIndex);
    537 
    538                             MemberObjectNum=
    539                                 JumpSubScripts(pMember->SubScripts);
    540 
     533                if(pMember->TypeInfo.type==DEF_OBJECT && pMember->IsRef() == false){
     534                    CMethod *method = pMember->TypeInfo.u.pobj_Class->GetConstructorMethod();
     535                    if( method ){
     536                        if( method->psi->RealParmNum == 1 ){    //Thisポインタを第一引数に持ち合わせるため、引数なしの場合はこの値が1になる
    541537                            for(i4=0;i4<MemberObjectNum;i4++){
    542538                                //Thisポインタをecxにコピー
     
    553549
    554550                                //call constructor
    555                                 op_call(pMember->TypeInfo.u.pobj_Class->ppobj_Method[i5]->psi);
     551                                op_call( method->psi );
    556552                            }
    557553                        }
     
    618614                    基底クラスのデストラクタを呼び出す */
    619615
    620                 i3=pobj_CompilingClass->pobj_InheritsClass->DestructorMemberSubIndex;
    621                 if(i3!=-1){
     616                CMethod *method = pobj_CompilingClass->pobj_InheritsClass->GetDestructorMethod();
     617                if( method ){
    622618                    Opcode_CallProc("",
    623                         pobj_CompilingClass->ppobj_Method[i3]->psi,
     619                        method->psi,
    624620                        0,
    625621                        "",
     
    647643
    648644                if(pMember->TypeInfo.type==DEF_OBJECT){
    649                     if(pMember->TypeInfo.u.pobj_Class->DestructorMemberSubIndex!=-1){
     645                    CMethod *method = pMember->TypeInfo.u.pobj_Class->GetDestructorMethod();
     646                    if( method ){
    650647                        for(i4=MemberObjectNum-1;i4>=0;i4--){
    651648                            //Thisポインタをecxにコピー
     
    662659
    663660                            //call destructor
    664                             i5=pMember->TypeInfo.u.pobj_Class->DestructorMemberSubIndex;
    665                             op_call(pMember->TypeInfo.u.pobj_Class->ppobj_Method[i5]->psi);
     661                            op_call( method->psi );
    666662                        }
    667663                    }
  • BasicCompiler32/Compile_Statement.cpp

    r50 r51  
    106106        }
    107107        if(i2==DEF_OBJECT){
    108             CClass *pobj_Class;
    109             pobj_Class=(CClass *)lp;
    110             if(pobj_Class->DestructorMemberSubIndex!=-1){
    111                 //デストラクタの呼び出し
    112 
    113                 //push eax
    114                 op_push(REG_EAX);
    115 
    116                 //push eax
    117                 op_push(REG_EAX);
    118 
    119                 //call destructor
    120                 int i5;
    121                 i5=pobj_Class->DestructorMemberSubIndex;
    122                 op_call(pobj_Class->ppobj_Method[i5]->psi);
    123             }
    124             else{
    125                 //push eax
    126                 op_push(REG_EAX);
    127             }
    128 
    129             //call free
    130             extern SUBINFO *pSub_free;
    131             op_call(pSub_free);
     108            //mov ebx,eax
     109            op_mov_RR(REG_EBX,REG_EAX);
     110
     111            FreeTempObject(REG_EBX,(CClass *)lp);
    132112        }
    133113        return;
  • BasicCompiler32/MakePeHdr.cpp

    r42 r51  
    10491049    // プロシージャポインタスケジュール
    10501050    for(i=0;i<pobj_SubAddrSchedule->num;i++){
     1051        if(pobj_SubAddrSchedule->ppsi[i]->CompileAddress==0
     1052            &&pobj_SubAddrSchedule->ppsi[i]->EndOpAddr==0){
     1053            SetError(300,NULL,-1);
     1054        }
     1055
    10511056        if(pobj_SubAddrSchedule->pbCall[i]){
    10521057            *((long *)(OpBuffer+pobj_SubAddrSchedule->pObpValues[i]))=
  • BasicCompiler32/NumOpe.cpp

    r49 r51  
    9696
    9797        //call constructor
    98         op_call(pobj_StringClass->ppobj_Method[pobj_StringClass->ConstructorMemberSubIndex]->psi);
     98        op_call(pobj_StringClass->GetConstructorMethod()->psi);
    9999    }
    100100
  • BasicCompiler32/OperatorProc.cpp

    r50 r51  
    55    if(!IsSafeReg(reg)) SetError(300,NULL,cp);
    66
    7     if(pobj_c->DestructorMemberSubIndex!=-1){
     7    CMethod *method = pobj_c->GetDestructorMethod();
     8    if( method ){
    89        //push reg
    910        op_push(reg);
    1011
    1112        //call DestructorProcAddr
    12         op_call(pobj_c->ppobj_Method[pobj_c->DestructorMemberSubIndex]->psi);
     13        op_call( method->psi );
    1314    }
    1415
  • BasicCompiler64/CParameter.cpp

    r50 r51  
    9696
    9797            //call destructor
    98             int i5 = types[i2].u.pobj_Class->DestructorMemberSubIndex;
    99             if( i5 != -1 ){
    100                 op_call( types[i2].u.pobj_Class->ppobj_Method[i5]->psi );
     98            CMethod *method = types[i2].u.pobj_Class->GetDestructorMethod();
     99            if( method ){
     100                op_call( method->psi );
    101101            }
    102102
     
    138138        CalcType.type=NumOpe_GetType(Parameter,&BaseType,&CalcType.u.lpIndex);
    139139
    140         if(pobj_Class->CopyConstructorMemberSubIndex!=-1&&
    141             CalcType.type==DEF_OBJECT&&CalcType.u.pobj_Class==pobj_Class){
     140        if( pobj_Class->GetCopyConstructorMethod()
     141            && CalcType.type==DEF_OBJECT&&CalcType.u.pobj_Class==pobj_Class){
    142142            ////////////////////////////////////
    143143            // コピーコンストラクタを呼び出す
     
    160160
    161161            //call constructor
    162             op_call(pobj_Class->ppobj_Method[pobj_Class->CopyConstructorMemberSubIndex]->psi);
     162            op_call(pobj_Class->GetCopyConstructorMethod()->psi);
    163163
    164164
     
    168168        }
    169169        else{
    170             if(pobj_Class->ConstructorMemberSubIndex!=-1){
     170            if( pobj_Class->GetConstructorMethod() ){
    171171                ////////////////////////////////
    172172                // コンストラクタを呼び出す
     
    177177
    178178                //call constructor
    179                 op_call(pobj_Class->ppobj_Method[pobj_Class->ConstructorMemberSubIndex]->psi);
     179                op_call(pobj_Class->GetConstructorMethod()->psi);
    180180            }
    181181
  • BasicCompiler64/Compile_CallProc.cpp

    r50 r51  
    9797
    9898void Opcode_CallProc(char *Parameter,SUBINFO *psi,DWORD dwFlags,char *ObjectName,int RefType){
    99     int i,i2;
     99    int i2;
    100100
    101101    if(psi->dwType==SUBTYPE_MACRO){
     
    348348        op_mov_RM(sizeof(_int64),REG_R11,REG_RCX,0,MOD_BASE);
    349349
    350         for(i=0,i2=0;i<pobj_c->iMethodNum;i++){
    351             if(pobj_c->ppobj_Method[i]->psi==psi) break;
    352             if(pobj_c->ppobj_Method[i]->psi->bVirtual) i2++;
    353         }
     350        i2 = pobj_c->GetFuncNumInVtbl( psi );
    354351
    355352        //call qword ptr[r11+func_index]
  • BasicCompiler64/Compile_Func.cpp

    r50 r51  
    172172        op_mov_RM(sizeof(_int64),REG_R11,REG_RCX,0,MOD_BASE);
    173173
    174         int i,i2;
    175         for(i=0,i2=0;i<pobj_c->iMethodNum;i++){
    176             if(pobj_c->ppobj_Method[i]->psi==psi) break;
    177             if(pobj_c->ppobj_Method[i]->psi->bVirtual) i2++;
    178         }
     174        int i2 = pobj_c->GetFuncNumInVtbl( psi );
    179175
    180176        //mov rax,qword ptr[r11+func_index]
  • BasicCompiler64/Compile_Object.cpp

    r50 r51  
    198198
    199199
    200     i2=pobj_c->DestructorMemberSubIndex;
    201     if(i2==-1) return 0;
     200    CMethod *method = pobj_c->GetDestructorMethod();
     201    if( method == NULL ) return 0;
    202202
    203203    //mov rcx,DestructorProcAddr
    204204    op_mov_RV(sizeof(_int64),REG_RCX,0);
    205205    obp-=sizeof(long);
    206     pobj_SubAddrSchedule->add(pobj_c->ppobj_Method[i2]->psi,0);
    207     pobj_c->ppobj_Method[i2]->psi->bUse=1;
     206    pobj_SubAddrSchedule->add(method->psi,0);
     207    method->psi->bUse=1;
    208208    obp+=sizeof(long);
    209209
  • BasicCompiler64/Compile_ProcOp.cpp

    r50 r51  
    209209    extern SUBINFO **ppSubHash;
    210210    extern BOOL bDebugCompile;
    211     int i3,i4,i5,VarSize,BufferSize;
     211    int i3,i4,VarSize,BufferSize;
    212212    char temporary[VN_SIZE];
    213213
     
    466466        if(psi->ReturnType==DEF_OBJECT && psi->isReturnRef == false){
    467467            //戻り値用オブジェクトのコンストラクタを呼び出す
    468             if(psi->u.Return_pobj_c->ConstructorMemberSubIndex!=-1){
     468            if( psi->u.Return_pobj_c->GetConstructorMethod() ){
    469469                sprintf(temporary,"%s.%s()",temp,psi->u.Return_pobj_c->name);
    470470                OpcodeOthers(temporary);
     
    517517            BOOL bThisIsSuperClass;
    518518            if(pobj_CompilingClass->pobj_InheritsClass==0) bThisIsSuperClass=1;
    519             else if(pobj_CompilingClass->pobj_InheritsClass->ConstructorMemberSubIndex==-1){
     519            else if( pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod() == NULL ){
    520520                //インターフェイスを継承したときはコンストラクタを持たない
    521521                bThisIsSuperClass=1;
     
    552552                    RemoveStringPare(temporary);
    553553
    554                     i3=pobj_CompilingClass->pobj_InheritsClass->ConstructorMemberSubIndex;
    555554                    Opcode_CallProc(temporary,
    556                         pobj_CompilingClass->ppobj_Method[i3]->psi,
     555                        pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod()->psi,
    557556                        0,
    558557                        "",
     
    561560                else{
    562561                    //基底クラスのコンストラクタを暗黙的に呼び出す
    563                     i3=pobj_CompilingClass->pobj_InheritsClass->ConstructorMemberSubIndex;
    564562                    Opcode_CallProc("",
    565                         pobj_CompilingClass->ppobj_Method[i3]->psi,
     563                        pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod()->psi,
    566564                        0,
    567565                        "",
     
    588586
    589587                if(pMember->TypeInfo.type==DEF_OBJECT && pMember->IsRef() == false){
    590                     if(pMember->TypeInfo.u.pobj_Class->ConstructorMemberSubIndex!=-1){
    591                         i5=pMember->TypeInfo.u.pobj_Class->ConstructorMemberSubIndex;
    592                         if(pMember->TypeInfo.u.pobj_Class->ppobj_Method[i5]->psi->RealParmNum==1){  //Thisポインタを第一引数に持ち合わせるため、引数なしの場合はこの値が1になる
     588                    CMethod *method = pMember->TypeInfo.u.pobj_Class->GetConstructorMethod();
     589                    if( method ){
     590                        if( method->psi->RealParmNum == 1 ){    //Thisポインタを第一引数に持ち合わせるため、引数なしの場合はこの値が1になる
    593591                            for(i4=0;i4<MemberObjectNum;i4++){
    594592                                //Thisポインタをrcxにコピー
     
    599597
    600598                                //call constructor
    601                                 op_call(pMember->TypeInfo.u.pobj_Class->ppobj_Method[i5]->psi);
     599                                op_call( method->psi );
    602600                            }
    603601                        }
     
    662660                    基底クラスのデストラクタを呼び出す */
    663661
    664                 i3=pobj_CompilingClass->pobj_InheritsClass->DestructorMemberSubIndex;
    665                 if(i3!=-1){
     662                CMethod *method = pobj_CompilingClass->pobj_InheritsClass->GetDestructorMethod();
     663                if( method ){
    666664                    Opcode_CallProc("",
    667                         pobj_CompilingClass->ppobj_Method[i3]->psi,
     665                        method->psi,
    668666                        0,
    669667                        "",
     
    689687
    690688                if(pMember->TypeInfo.type==DEF_OBJECT && pMember->IsRef() == false){
    691                     if(pMember->TypeInfo.u.pobj_Class->DestructorMemberSubIndex!=-1){
     689                    CMethod *method = pMember->TypeInfo.u.pobj_Class->GetDestructorMethod();
     690                    if( method ){
    692691                        for(i4=MemberObjectNum-1;i4>=0;i4--){
    693692                            //Thisポインタをrcxにコピー
     
    698697
    699698                            //call destructor
    700                             i5=pMember->TypeInfo.u.pobj_Class->DestructorMemberSubIndex;
    701                             op_call(pMember->TypeInfo.u.pobj_Class->ppobj_Method[i5]->psi);
     699                            op_call(method->psi);
    702700                        }
    703701                    }
  • BasicCompiler64/MakePeHdr.cpp

    r42 r51  
    10591059    // プロシージャポインタスケジュール
    10601060    for(i=0;i<pobj_SubAddrSchedule->num;i++){
     1061        if(pobj_SubAddrSchedule->ppsi[i]->CompileAddress==0
     1062            &&pobj_SubAddrSchedule->ppsi[i]->EndOpAddr==0){
     1063            SetError(300,NULL,-1);
     1064        }
     1065
    10611066        if(pobj_SubAddrSchedule->pbCall[i]){
    10621067            *((long *)(OpBuffer+pobj_SubAddrSchedule->pObpValues[i]))=
  • BasicCompiler64/NumOpe.cpp

    r49 r51  
    3535
    3636        //call constructor
    37         op_call(pobj_StringClass->ppobj_Method[pobj_StringClass->ConstructorMemberSubIndex]->psi);
     37        op_call(pobj_StringClass->GetConstructorMethod()->psi);
    3838
    3939        int i2;
  • BasicCompiler64/OperatorProc.cpp

    r50 r51  
    1010    ////////////////////////////////////////////////
    1111
    12     if(pobj_c->DestructorMemberSubIndex!=-1){
     12    CMethod *method = pobj_c->GetDestructorMethod();
     13    if( method ){
    1314        //mov rcx,reg
    1415        op_mov_RR(REG_RCX,reg);
    1516
    1617        //call DestructorProcAddr
    17         op_call(pobj_c->ppobj_Method[pobj_c->DestructorMemberSubIndex]->psi);
     18        op_call( method->psi );
    1819    }
    1920
     
    294295
    295296        if(bCalcUseHeap){
    296             /*
    297             //未解放のインスタンスが存在する場合
    298             //※専用のローカル変数を用意し、メモリリークを回避
    299             char temporary[VN_SIZE],temp2[VN_SIZE];
    300 
    301 
    302             ////////////////////////////////
    303             // 一時オブジェクト変数を用意
    304             ////////////////////////////////
    305             char szTempVarName[255];
    306             GetTypeName(CalcType,lpCalcIndex,temp2);
    307             sprintf(szTempVarName,"_System_strDummy%d",obp);
    308             wsprintf(temporary,"%s%c%c%s",szTempVarName,1,ESC_AS,temp2);
    309             InsertDimStatement_ToProcHead(temporary);
    310 
    311             RELATIVE_VAR VarRelativeVar;
    312             int VarType;
    313             LONG_PTR lpVarIndex;
    314             if(!GetVarOffsetReadOnly(
    315                 szTempVarName,
    316                 &VarType,
    317                 &VarRelativeVar,
    318                 &lpVarIndex)) return;
    319 
    320 
    321             CClass *pobj_c;
    322             pobj_c=(CClass *)lpCalcIndex;
    323             if(pobj_c->DestructorMemberSubIndex!=-1){
    324 
    325                 //////////////////////////////////////////////////////
    326                 /////    レジスタ資源のバックアップ
    327                 {   BACKUP_REGISTER_RESOURCE
    328                 //////////////////////////////////////////////////////
    329 
    330                     //ループの場合、古い一時オブジェクトのデストラクタを呼ぶ
    331 
    332                     //rcxに変数アドレスをコピー
    333                     SetVarPtrToReg(REG_RCX,&VarRelativeVar);
    334 
    335                     //call destructor
    336                     OpBuffer[obp++]=(char)0xE8;
    337                     pobj_SubAddrSchedule->add(pobj_c->ppobj_Method[pobj_c->DestructorMemberSubIndex]->psi,1);
    338                     obp+=sizeof(long);
    339 
    340                 /////////////////////////////////////////////
    341                 //////   レジスタ資源を復元
    342                     RESTORE_REGISTER_RESOURCE
    343                 }////////////////////////////////////////////
    344             }
    345 
    346             //mov r15,reg
    347             op_mov_RR(REG_R15,reg);
    348 
    349 
    350             int object_size;
    351             object_size=GetSizeOfClass((CClass *)lpVarIndex);
    352 
    353             //mov rcx,object_size
    354             op_mov_RV(sizeof(_int64),REG_RCX,object_size);
    355 
    356             //rdiに変数アドレスをコピー
    357             SetVarPtrToReg(REG_RDI,&VarRelativeVar);
    358 
    359             //mov rsi,reg
    360             op_mov_RR(REG_RSI,reg);
    361 
    362             //mov r14,rdi
    363             op_mov_RR(REG_R14,REG_RDI);
    364             pobj_BlockReg->lock(REG_R14);
    365 
    366             //rep movs byte ptr[rdi],byte ptr[rsi]
    367             op_rep_movs(sizeof(BYTE));
    368 
    369             //////////////////////////////////////////////////////
    370             /////    レジスタ資源のバックアップ
    371             {   BACKUP_REGISTER_RESOURCE
    372             //////////////////////////////////////////////////////
    373 
    374                 //mov rcx,r15
    375                 op_mov_RR(REG_RCX,REG_R15);
    376 
    377                 //call free
    378                 extern SUBINFO *pSub_free;
    379                 OpBuffer[obp++]=(char)0xE8;
    380                 pobj_SubAddrSchedule->add(pSub_free,1);
    381                 obp+=sizeof(long);
    382 
    383             /////////////////////////////////////////////
    384             //////   レジスタ資源を復元
    385                 RESTORE_REGISTER_RESOURCE
    386             }////////////////////////////////////////////
    387 
    388 
    389             //mov reg,r14
    390             op_mov_RR(reg,REG_R14);
    391 
    392             pobj_BlockReg->unlock(REG_R14);
    393             */
    394 
    395297            //未解放のインスタンスが存在する旨を示す警告
    396298            SetError(-105,NULL,cp);
    397 
    398299        }
    399300
  • BasicCompiler_Common/Class.cpp

    r50 r51  
    207207    }
    208208
    209     if(ppobj_Method){
    210         //メソッド
    211         for(i=0;i<iMethodNum;i++){
    212             delete ppobj_Method[i];
    213         }
    214         HeapDefaultFree(ppobj_Method);
    215         ppobj_Method=0;
    216     }
    217 
    218209    if(ppobj_StaticMember){
    219210        //静的メンバ
     
    225216    }
    226217
    227     foreach( CMethod *method, StaticMethods ){
     218    //メソッド
     219    foreach( CMethod *method, methods ){
     220        delete method;
     221    }
     222
     223    //静的メソッド
     224    foreach( CMethod *method, staticMethods ){
    228225        delete method;
    229226    }
     
    249246
    250247    //メソッドをコピー
    251     ppobj_Method=(CMethod **)HeapReAlloc(
    252         hHeap,
    253         0,
    254         ppobj_Method,
    255         pInheritsClass->iMethodNum*sizeof(CMethod *));
    256     iMethodNum=pInheritsClass->iMethodNum;
    257     for(i3=0;i3<pInheritsClass->iMethodNum;i3++){
    258         ppobj_Method[i3]=new CMethod(pInheritsClass->ppobj_Method[i3]);
     248    foreach( CMethod *baseMethod, pInheritsClass->methods ){
     249        CMethod *method = new CMethod( baseMethod );
    259250
    260251        //dwAccess
    261         if(pInheritsClass->ppobj_Method[i3]->dwAccess==ACCESS_PRIVATE)
    262             ppobj_Method[i3]->dwAccess=ACCESS_NON;
    263         else ppobj_Method[i3]->dwAccess=pInheritsClass->ppobj_Method[i3]->dwAccess;
     252        if(baseMethod->dwAccess==ACCESS_PRIVATE)
     253            method->dwAccess=ACCESS_NON;
     254        else method->dwAccess=baseMethod->dwAccess;
    264255
    265256        //pobj_Inherits
    266257        // ※継承元のClassIndexをセット(入れ子継承を考慮する)
    267         if(pInheritsClass->ppobj_Method[i3]->pobj_InheritsClass==0)
    268             ppobj_Method[i3]->pobj_InheritsClass=pInheritsClass;
     258        if(baseMethod->pobj_InheritsClass==0)
     259            method->pobj_InheritsClass=pInheritsClass;
    269260        else
    270             ppobj_Method[i3]->pobj_InheritsClass=
    271                 pInheritsClass->ppobj_Method[i3]->pobj_InheritsClass;
     261            method->pobj_InheritsClass=
     262                baseMethod->pobj_InheritsClass;
     263
     264        methods.push_back( method );
    272265    }
    273266
     
    289282}
    290283void CClass::AddMethod( SUBINFO *psi,DWORD dwAccess, bool isConst, BOOL bAbstract, BOOL bVirtual ){
    291     ppobj_Method = (CMethod **)HeapReAlloc( hHeap, 0, ppobj_Method, (iMethodNum + 1) * sizeof(CMethod *) );
    292     ppobj_Method[iMethodNum] = new CMethod();
    293     ppobj_Method[iMethodNum]->psi = psi;
    294     ppobj_Method[iMethodNum]->dwAccess = dwAccess;
    295     ppobj_Method[iMethodNum]->isConst = isConst;
    296     ppobj_Method[iMethodNum]->bAbstract = bAbstract;
    297     ppobj_Method[iMethodNum]->bVirtual = bVirtual;
    298     ppobj_Method[iMethodNum]->pobj_InheritsClass = 0;
    299 
    300     iMethodNum++;
     284    CMethod *method = new CMethod();
     285    method->psi = psi;
     286    method->dwAccess = dwAccess;
     287    method->isConst = isConst;
     288    method->bAbstract = bAbstract;
     289    method->bVirtual = bVirtual;
     290    method->pobj_InheritsClass = 0;
     291
     292    methods.push_back( method );
    301293}
    302294void CClass::AddStaticMethod(SUBINFO *psi,DWORD dwAccess){
     
    308300    method->pobj_InheritsClass=0;
    309301
    310     StaticMethods.push_back( method );
     302    staticMethods.push_back( method );
    311303}
    312304BOOL CClass::DupliCheckAll(const char *name){
    313305    //重複チェック
    314306
    315     int i;
    316 
    317307    //メンバ
    318308    if(DupliCheckMember(name)) return 1;
    319309
    320310    //メソッド
    321     for(i=0;i<iMethodNum;i++){
    322         if(lstrcmp(name,ppobj_Method[i]->psi->name)==0){
     311    foreach( CMethod *method, methods ){
     312        if( lstrcmp( name, method->psi->name ) == 0 ){
    323313            return 1;
    324314        }
     
    349339}
    350340CMethod *CClass::GetMethodInfo( SUBINFO *psi ){
    351     for( int i=iMethodNum-1; i>=0; i-- ){
    352         if( psi == ppobj_Method[i]->psi ) return ppobj_Method[i];
     341    for( int i=(int)methods.size()-1; i>=0; i-- ){
     342        if( psi == methods[i]->psi ) return methods[i];
    353343    }
    354344    return NULL;
    355345}
    356346CMethod *CClass::GetStaticMethodInfo( SUBINFO *psi ){
    357     for( int i=(int)StaticMethods.size()-1; i>=0; i-- ){
    358         if( psi == StaticMethods[i]->psi ) return StaticMethods[i];
     347    for( int i=(int)staticMethods.size()-1; i>=0; i-- ){
     348        if( psi == staticMethods[i]->psi ) return staticMethods[i];
    359349    }
    360350    return NULL;
    361351}
    362352bool CClass::IsExistMethod( const char *name ){
    363     for( int i=0; i<iMethodNum; i++ ){
    364         if( lstrcmp( ppobj_Method[i]->psi->name, name ) == 0 ) return true;
     353    foreach( CMethod *method, methods ){
     354        if( lstrcmp( method->psi->name, name ) == 0 ) return true;
    365355    }
    366356    return false;
    367357}
    368358bool CClass::IsExistStaticMethod( const char *name ){
    369     foreach( CMethod *method, StaticMethods ){
     359    foreach( CMethod *method, staticMethods ){
    370360        if( lstrcmp( method->psi->name, name ) == 0 ) return true;
    371361    }
     
    375365void CClass::EnumStaticMethod( const char *methodName, std::vector<SUBINFO *> &subs ) const
    376366{
    377     foreach( CMethod *method, StaticMethods ){
     367    foreach( CMethod *method, staticMethods ){
    378368        if(lstrcmp(methodName,method->psi->name)==0){
    379369            subs.push_back( method->psi );
     
    386376    //オブジェクトのメンバ関数の場合
    387377    //※オーバーライドされた関数を先にサーチする必要があるため、バックサーチを行う
    388     for(int i=iMethodNum-1;i>=0;i--){
    389         if(lstrcmp(name,ppobj_Method[i]->psi->name)==0){
    390             subs.push_back( ppobj_Method[i]->psi );
     378    for( int i=(int)methods.size()-1; i>=0; i-- ){
     379        if(lstrcmp(methodName,methods[i]->psi->name)==0){
     380            subs.push_back( methods[i]->psi );
    391381        }
    392382    }
     
    395385void CClass::EnumMethod( const BYTE idOperatorCalc, std::vector<SUBINFO *> &subs ) const
    396386{
    397     for(int i=0;i<iMethodNum;i++){
     387    //オブジェクトのメンバ関数の場合
     388    //※オーバーライドされた関数を先にサーチする必要があるため、バックサーチを行う
     389    for( int i=(int)methods.size()-1; i>=0; i-- ){
    398390        char *temp;
    399         temp=ppobj_Method[i]->psi->name;
     391        temp=methods[i]->psi->name;
    400392        if(temp[0]==1&&temp[1]==ESC_OPERATOR){
    401393            if((BYTE)temp[2]==idOperatorCalc){
    402                 subs.push_back( ppobj_Method[i]->psi );
    403             }
    404         }
    405     }
     394                subs.push_back( methods[i]->psi );
     395            }
     396        }
     397    }
     398}
     399
     400//デフォルト コンストラクタ メソッドを取得
     401CMethod *CClass::GetConstructorMethod() const
     402{
     403    if( ConstructorMemberSubIndex == -1 ) return NULL;
     404    return methods[ConstructorMemberSubIndex];
     405}
     406
     407//デフォルト コピーコンストラクタ メソッドを取得
     408CMethod *CClass::GetCopyConstructorMethod() const
     409{
     410    if( CopyConstructorMemberSubIndex == -1 ) return NULL;
     411    return methods[CopyConstructorMemberSubIndex];
     412}
     413
     414//デストラクタ メソッドを取得
     415CMethod *CClass::GetDestructorMethod() const
     416{
     417    if( DestructorMemberSubIndex == -1 ) return NULL;
     418    return methods[DestructorMemberSubIndex];
    406419}
    407420
     
    409422LONG_PTR CClass::AddVtblDataTable(SUBINFO **ppsi,int length){
    410423    return AddDataTable((char *)ppsi,length);
     424}
     425int CClass::GetFuncNumInVtbl( const SUBINFO *psi ) const
     426{
     427    int n = 0;
     428    foreach( CMethod *method, methods ){
     429        if( method->psi == psi ) break;
     430        if( method->psi->bVirtual ) n++;
     431    }
     432    return n;
    411433}
    412434LONG_PTR CClass::GetVtblGlobalOffset(void){
     
    424446
    425447    //関数テーブルに値をセット
    426     for( int i=0, i2=0; i < iMethodNum; i++ ){
    427         if(ppobj_Method[i]->bVirtual){
    428             ppobj_Method[i]->psi->bUse=1;
    429 
    430             if(ppobj_Method[i]->bAbstract){
     448    int i2 = 0;
     449    foreach( CMethod *method, methods ){
     450        if(method->bVirtual){
     451            method->psi->bUse=1;
     452
     453            if(method->bAbstract){
    431454                extern int cp;
    432455                SetError(300,NULL,cp);
     
    434457                ppsi[i2]=0;
    435458            }
    436             else ppsi[i2]=ppobj_Method[i]->psi;
     459            else ppsi[i2]=method->psi;
    437460            i2++;
    438461        }
     
    465488}
    466489bool CClass::IsAbstract(){
    467     //未実装の仮想関数を持つ場合は1を返す
    468 
    469     for( int i=0; i < iMethodNum; i++ ){
    470         if(ppobj_Method[i]->bVirtual){
    471             if(ppobj_Method[i]->bAbstract){
     490    //未実装の仮想関数を持つ場合はtrueを返す
     491
     492    foreach( CMethod *method, methods ){
     493        if(method->bVirtual){
     494            if(method->bAbstract){
    472495                return true;
    473496            }
     
    744767
    745768    if( fConstructor == 1 )
    746         pobj_c->ConstructorMemberSubIndex = pobj_c->iMethodNum;
     769        pobj_c->ConstructorMemberSubIndex = (int)pobj_c->methods.size();
    747770    else if( fConstructor == 2 )
    748         pobj_c->CopyConstructorMemberSubIndex = pobj_c->iMethodNum;
     771        pobj_c->CopyConstructorMemberSubIndex = (int)pobj_c->methods.size();
    749772    else if( bDestructor )
    750         pobj_c->DestructorMemberSubIndex = pobj_c->iMethodNum;
     773        pobj_c->DestructorMemberSubIndex = (int)pobj_c->methods.size();
    751774
    752775
     
    761784    }
    762785
    763     //メンバ関数
    764     for(i=0;i<pobj_c->iMethodNum;i++){
     786    //メソッド
     787    foreach( CMethod *method, pobj_c->methods ){
    765788        //基底クラスと重複する場合はオーバーライドを行う
    766         if(pobj_c->ppobj_Method[i]->pobj_InheritsClass) continue;
    767 
    768         if(lstrcmp(temporary,pobj_c->ppobj_Method[i]->psi->name)==0){
     789        if(method->pobj_InheritsClass) continue;
     790
     791        if(lstrcmp(temporary,method->psi->name)==0){
    769792            if(CompareParameter(
    770                 pobj_c->ppobj_Method[i]->psi->pParmInfo,pobj_c->ppobj_Method[i]->psi->ParmNum,
     793                method->psi->pParmInfo,method->psi->ParmNum,
    771794                psi->pParmInfo,psi->ParmNum
    772795                )==0){
     
    781804    if(bAbstract) psi->bCompile=1;
    782805
    783 
    784     for(i=0;i<pobj_c->iMethodNum;i++){
    785         if(lstrcmp(temporary,pobj_c->ppobj_Method[i]->psi->name)==0){
     806    //メソッドのオーバーライド
     807    foreach( CMethod *method, pobj_c->methods ){
     808        if(lstrcmp(temporary,method->psi->name)==0){
    786809            if(CompareParameter(
    787                 pobj_c->ppobj_Method[i]->psi->pParmInfo,pobj_c->ppobj_Method[i]->psi->ParmNum,
     810                method->psi->pParmInfo,method->psi->ParmNum,
    788811                psi->pParmInfo,psi->ParmNum
    789812                )==0){
    790813
    791                 if(pobj_c->ppobj_Method[i]->psi->bVirtual){
     814                if(method->psi->bVirtual){
    792815                    //メンバ関数を上書き
    793                     pobj_c->ppobj_Method[i]->psi=psi;
    794                     pobj_c->ppobj_Method[i]->bAbstract=0;
     816                    method->psi=psi;
     817                    method->bAbstract=0;
    795818
    796819                    if(!bOverride){
    797820                        SetError(127,NULL,NowLine);
    798821                    }
    799                     if(pobj_c->ppobj_Method[i]->dwAccess!=dwAccess){
     822                    if(method->dwAccess!=dwAccess){
    800823                        SetError(128,NULL,NowLine);
    801824                    }
     
    890913            pobj_c->ppobj_StaticMember=(CMember **)HeapAlloc(hHeap,0,1);
    891914            pobj_c->iStaticMemberNum=0;
    892             pobj_c->ppobj_Method=(CMethod **)HeapAlloc(hHeap,0,1);
    893             pobj_c->iMethodNum=0;
    894915
    895916            pobj_c->ConstructorMemberSubIndex=-1;
     
    10501071            pobj_c->ppobj_StaticMember=(CMember **)HeapAlloc(hHeap,0,1);
    10511072            pobj_c->iStaticMemberNum=0;
    1052             pobj_c->ppobj_Method=(CMethod **)HeapAlloc(hHeap,0,1);
    1053             pobj_c->iMethodNum=0;
    10541073
    10551074            pobj_c->ConstructorMemberSubIndex=-1;
  • BasicCompiler_Common/Class.h

    r50 r51  
    6060    ~CMethod();
    6161};
     62class CDBClass;
     63class CDebugSection;
    6264class CClass{
     65    friend CDBClass;
     66    friend CDebugSection;
     67
     68    //メソッド情報
     69    std::vector<CMethod *> methods;
     70    int ConstructorMemberSubIndex;
     71    int CopyConstructorMemberSubIndex;
     72    int DestructorMemberSubIndex;
     73
    6374    //静的メソッド情報
    64     std::vector<CMethod *> StaticMethods;
     75    std::vector<CMethod *> staticMethods;
    6576
    6677public:
     
    7485    CMember **ppobj_Member;
    7586    int iMemberNum;
    76 
    77     //メソッド情報
    78     CMethod **ppobj_Method;
    79     int iMethodNum;
    80     int ConstructorMemberSubIndex;
    81     int DestructorMemberSubIndex;
    82     int CopyConstructorMemberSubIndex;
    8387
    8488    //静的メンバ情報
     
    121125    void EnumMethod( const BYTE idOperatorCalc, std::vector<SUBINFO *> &subs ) const;
    122126
     127    //デフォルト コンストラクタ メソッドを取得
     128    CMethod *GetConstructorMethod() const;
     129
     130    //デフォルト コピーコンストラクタ メソッドを取得
     131    CMethod *GetCopyConstructorMethod() const;
     132
     133    //デストラクタ メソッドを取得
     134    CMethod *GetDestructorMethod() const;
     135
    123136
    124137    //vtbl
     
    127140    LONG_PTR AddVtblDataTable(SUBINFO **ppsi,int length);
    128141public:
    129     LONG_PTR GetVtblGlobalOffset(void);
     142    int GetFuncNumInVtbl( const SUBINFO *psi ) const;
     143    LONG_PTR GetVtblGlobalOffset(void);
    130144    void ActionVtblSchedule(LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection);
    131145    bool IsAbstract();
  • BasicCompiler_Common/DebugMiddleFile.cpp

    r16 r51  
    364364
    365365        //メソッド
    366         *(long *)(buffer+i2)=pobj_c->iMethodNum;
    367         i2+=sizeof(long);
    368         for(i4=0;i4<pobj_c->iMethodNum;i4++){
    369             *(long *)(buffer+i2)=pobj_c->ppobj_Method[i4]->dwAccess;
    370             i2+=sizeof(long);
    371             if(pobj_c->ppobj_Method[i4]->pobj_InheritsClass){
    372                 lstrcpy(buffer+i2,pobj_c->ppobj_Method[i4]->pobj_InheritsClass->name);
     366        *(long *)(buffer+i2)=(long)pobj_c->methods.size();
     367        i2+=sizeof(long);
     368        foreach( CMethod *method, pobj_c->methods ){
     369            *(long *)(buffer+i2)=method->dwAccess;
     370            i2+=sizeof(long);
     371            if(method->pobj_InheritsClass){
     372                lstrcpy(buffer+i2,method->pobj_InheritsClass->name);
    373373                i2+=lstrlen(buffer+i2)+1;
    374374            }
     
    377377                i2+=lstrlen(buffer+i2)+1;
    378378            }
    379             lstrcpy(buffer+i2,pobj_c->ppobj_Method[i4]->psi->name);
     379            lstrcpy(buffer+i2,method->psi->name);
    380380            i2+=lstrlen(buffer+i2)+1;
    381381        }
     
    738738
    739739        //メソッド
    740         pobj_c->iMethodNum=*(long *)(buffer+i2);
    741         i2+=sizeof(long);
    742         pobj_c->ppobj_Method=
    743             (CMethod **)HeapAlloc(hHeap,0,pobj_c->iMethodNum*sizeof(CMethod *));
    744         for(i4=0;i4<pobj_c->iMethodNum;i4++){
    745             pobj_c->ppobj_Method[i4]=new CMethod();
    746 
    747             pobj_c->ppobj_Method[i4]->dwAccess=*(long *)(buffer+i2);
     740        int nMethod = *(long *)(buffer+i2);
     741        i2+=sizeof(long);
     742        for( i4=0; i4<nMethod; i4++ ){
     743            CMethod *method = new CMethod();
     744
     745            method->dwAccess=*(long *)(buffer+i2);
    748746            i2+=sizeof(long);
    749747
     
    753751
    754752            if(szInherits[0])
    755                 pobj_c->ppobj_Method[i4]->pobj_InheritsClass=pobj_DBClass->check(szInherits);
    756             else pobj_c->ppobj_Method[i4]->pobj_InheritsClass=0;
     753                method->pobj_InheritsClass=pobj_DBClass->check(szInherits);
     754            else method->pobj_InheritsClass=0;
    757755
    758756            lstrcpy(temp2,buffer+i2);
     
    760758
    761759            CClass *pobj_temp_c;
    762             pobj_temp_c=pobj_c->ppobj_Method[i4]->pobj_InheritsClass;
     760            pobj_temp_c=method->pobj_InheritsClass;
    763761            if(pobj_temp_c==0) pobj_temp_c=pobj_c;
    764762            i5=hash_default(temp2);
     
    768766                psi=psi->pNextData;
    769767            }
    770             pobj_c->ppobj_Method[i4]->psi=psi;
     768            method->psi=psi;
     769
     770            pobj_c->methods.push_back( method );
    771771        }
    772772
  • BasicCompiler_Common/LexicalScoping.cpp

    r34 r51  
    182182
    183183
    184     int i3,i4,i5;
     184    int i3,i4;
    185185    int indexSystemGC=-1;
    186186    for( i3 = num - 1; i3 >= 0; i3-- ){     //確保したのと逆順序で解放するため、バックサーチにする
     
    201201
    202202            //デストラクタを呼び出す
    203             i5=pVar[i3].u.pobj_c->DestructorMemberSubIndex;
    204             if(i5!=-1)
    205                 Opcode_CallProc("",pVar[i3].u.pobj_c->ppobj_Method[i5]->psi,0,pVar[i3].name,DEF_OBJECT);
     203            CMethod *method = pVar[i3].u.pobj_c->GetDestructorMethod();
     204            if( method ){
     205                Opcode_CallProc("", method->psi,0,pVar[i3].name,DEF_OBJECT);
     206            }
    206207
    207208            //メモリを解放する
     
    242243        else if(pVar[i3].type==DEF_OBJECT&&pVar[i3].fRef==0){
    243244            //デストラクタの呼び出し
    244             i5=pVar[i3].u.pobj_c->DestructorMemberSubIndex;
    245             if(i5!=-1){
     245            CMethod *method = pVar[i3].u.pobj_c->GetDestructorMethod();
     246            if( method ){
    246247                int ss[MAX_ARRAYDIM];
    247248                memset(ss,0,MAX_ARRAYDIM*sizeof(int));
     
    266267                        }
    267268                        lstrcat(temporary,"]");
    268                         Opcode_CallProc("",pVar[i3].u.pobj_c->ppobj_Method[i5]->psi,0,temporary,DEF_OBJECT);
     269                        Opcode_CallProc("",method->psi,0,temporary,DEF_OBJECT);
    269270
    270271                        ss[0]++;
     
    280281                }
    281282                else{
    282                     Opcode_CallProc("",pVar[i3].u.pobj_c->ppobj_Method[i5]->psi,0,pVar[i3].name,DEF_OBJECT);
     283                    Opcode_CallProc("",method->psi,0,pVar[i3].name,DEF_OBJECT);
    283284                }
    284285            }
     
    288289    if(indexSystemGC!=-1){
    289290        //_System_GCオブジェクトのデストラクタの呼び出し処理
    290         i3=pVar[indexSystemGC].u.pobj_c->DestructorMemberSubIndex;
    291         if(i3!=-1){
    292             Opcode_CallProc("",pVar[indexSystemGC].u.pobj_c->ppobj_Method[i3]->psi,0,pVar[indexSystemGC].name,DEF_OBJECT);
     291        CMethod *method = pVar[indexSystemGC].u.pobj_c->GetDestructorMethod();
     292        if( method ){
     293            Opcode_CallProc("",method->psi,0,pVar[indexSystemGC].name,DEF_OBJECT);
    293294        }
    294295    }
  • BasicCompiler_Common/Variable.cpp

    r49 r51  
    12251225
    12261226
    1227 
    1228 
     1227    if( pTypeInfo->type==DEF_OBJECT ){
     1228        //デストラクタの利用フラグをオンにする
     1229        CMethod *method = pTypeInfo->u.pobj_Class->GetDestructorMethod();
     1230        if( method ){
     1231            method->psi->bUse = 1;
     1232        }
     1233    }
     1234
     1235/*
    12291236    if(pTypeInfo->type==DEF_OBJECT){
    12301237        //利用対象のクラスコンストラクタ、デストラクタに使用チェックをつける
     
    12391246            }
    12401247        }
    1241     }
    1242 }
     1248    }*/
     1249}
  • BasicCompiler_Common/hash.cpp

    r50 r51  
    5757    extern int SubInfoNum;
    5858    extern int cp;
    59     int i;
    6059
    6160    char name[VN_SIZE];
     
    9796
    9897        if( isStatic ){
    99             // 静的メソッドから取得
     98            // 静的メソッドから列挙
    10099            pobj_c->EnumStaticMethod( NestMember, subs );
    101100        }
    102101        else{
    103             //動的メソッドから取得
    104 
    105             //※オーバーライドされた関数を先にサーチする必要があるため、バックサーチを行う
    106             for(i=pobj_c->iMethodNum-1;i>=0;i--){
    107                 if(lstrcmp(NestMember,pobj_c->ppobj_Method[i]->psi->name)==0){
    108                     subs.push_back( pobj_c->ppobj_Method[i]->psi );
    109                 }
    110             }
     102            //動的メソッドから列挙
     103            pobj_c->EnumMethod( NestMember, subs );
    111104        }
    112105    }
     
    117110            //自身のオブジェクトのメンバ関数を検索
    118111
     112            // 静的メソッド
     113            pobj_CompilingClass->EnumStaticMethod( name, subs );
    119114
    120             //////////////////////////////////////////////
    121             // 静的メソッド
    122             //////////////////////////////////////////////
    123 
    124             CClass *pobj_c = pobj_CompilingClass;
    125 
    126             pobj_c->EnumStaticMethod( NestMember, subs );
    127 
    128 
    129             ///////////////////////
    130             // 動的メソッド(一般)
    131             ///////////////////////
    132             for(i=0;i<pobj_CompilingClass->iMethodNum;i++){
    133                 //オーバーライドされた関数を飛び越す
    134                 if(pobj_CompilingClass->ppobj_Method[i]->pobj_InheritsClass==0) break;
    135             }
    136             for(;i<pobj_CompilingClass->iMethodNum;i++){
    137                 if(lstrcmp(name,pobj_CompilingClass->ppobj_Method[i]->psi->name)==0){
    138                     subs.push_back( pobj_CompilingClass->ppobj_Method[i]->psi );
    139                 }
    140             }
    141 
    142             //オーバーライドされたメンバ関数
    143             for(i=0;i<pobj_CompilingClass->iMethodNum;i++){
    144                 //オーバーライドされた関数を飛び越す
    145                 if(pobj_CompilingClass->ppobj_Method[i]->pobj_InheritsClass){
    146                     if(lstrcmp(name,pobj_CompilingClass->ppobj_Method[i]->psi->name)==0){
    147                         subs.push_back( pobj_CompilingClass->ppobj_Method[i]->psi );
    148                     }
    149                 }
    150             }
     115            // 動的メソッド
     116            pobj_CompilingClass->EnumMethod( name, subs );
    151117        }
    152118
Note: See TracChangeset for help on using the changeset viewer.