Changeset 51 in dev for BasicCompiler32


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

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

Location:
BasicCompiler32
Files:
9 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
Note: See TracChangeset for help on using the changeset viewer.