Changeset 370 in dev for trunk/abdev/BasicCompiler64


Ignore:
Timestamp:
Nov 15, 2007, 3:18:41 AM (16 years ago)
Author:
dai_9181
Message:

COM修飾子に対応。COMインターフェイスを呼び出せるようにした

Location:
trunk/abdev/BasicCompiler64
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/abdev/BasicCompiler64/CodeGenerator.cpp

    r357 r370  
    17331733    pNativeCode->PutUserProcSchedule( pUserProc, false );
    17341734}
     1735void CodeGenerator::op_mov_RV_com_vtbl( int reg, const CClass *pClass )
     1736{
     1737    // mov reg,com_vtblAddress
     1738
     1739    //オペコード、レジスタ
     1740    pNativeCode->Put( (char)(0xB8|REGISTER_OPERAND(reg)) );
     1741
     1742    //DISP32
     1743    pNativeCode->PutComVtblSchedule( pClass );
     1744}
    17351745void CodeGenerator::op_mov_RV_vtbl( int reg, const CClass *pClass )
    17361746{
  • trunk/abdev/BasicCompiler64/Compile_Calc.cpp

    r331 r370  
    208208    //変数アドレスを取得
    209209    RELATIVE_VAR VarRelativeVar;
    210     if(!GetVarOffsetReadWrite(
     210    bool result = GetVarOffsetReadWrite(
    211211        variable,
    212212        &VarRelativeVar,
    213         varType)) return;
     213        varType);
    214214
    215215    //レジスタのブロッキングを解除
    216216    pobj_BlockReg->clear();
     217
     218    if( !result )
     219    {
     220        return;
     221    }
    217222
    218223    if(varType.GetBasicType()&FLAG_PTR){
  • trunk/abdev/BasicCompiler64/Compile_CallProc.cpp

    r350 r370  
    359359        if( pobj_c->IsInterface() )
    360360        {
    361             // インターフェイスメソッド呼び出し
     361            // インターフェイス メソッド呼び出し
    362362
    363363            int offset_vtbl = compiler.GetObjectModule().meta.GetClasses().GetInterfaceInfoClassPtr()->GetMemberOffset( "__vtbl" );
     
    380380            }
    381381        }
     382        else if( pobj_c->IsComInterface() )
     383        {
     384            // COMインターフェイス メソッド呼び出し
     385
     386            //仮想関数(オブジェクトメソッド)呼び出し
     387            // pObj -> vtbl1 -> func1
     388            //               -> func2
     389            //               -> func3
     390
     391            int vtblMasterListIndex;
     392            pobj_c->GetVtblMasterListIndexAndVtblIndex( pUserProc, vtblMasterListIndex, vtblIndex );
     393
     394            // vtblのポインタを取得
     395            //mov r11,qword ptr[rcx]
     396            compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RCX,0,MOD_BASE);        }
    382397        else
    383398        {
     
    394409
    395410            // vtblマスターリストのポインタを取得
    396             //mov r11,qword ptr[rcx]
    397             compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RCX,0,MOD_BASE);
     411            //mov r11,qword ptr[rcx+sizeof(com_vtbl)]
     412            compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RCX,PTR_SIZE,MOD_BASE_DISP8);
    398413
    399414            // vtblのポインタを取得
  • trunk/abdev/BasicCompiler64/Compile_Func.cpp

    r359 r370  
    144144            }
    145145        }
     146        else if( pobj_c->IsComInterface() )
     147        {
     148            //仮想関数(オブジェクトメソッド)
     149            // pObj -> vtbl1 -> func1
     150            //               -> func2
     151            //               -> func3
     152
     153            int vtblMasterListIndex;
     154            pobj_c->GetVtblMasterListIndexAndVtblIndex( &userProc, vtblMasterListIndex, vtblIndex );
     155
     156            // vtblのポインタを取得
     157            //mov r11,qword ptr[rcx]
     158            compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RCX,0,MOD_BASE);
     159        }
    146160        else
    147161        {
     
    158172
    159173            // vtblマスターリストのポインタを取得
    160             //mov r11,qword ptr[rcx]
    161             compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RCX,0,MOD_BASE);
     174            //mov r11,qword ptr[rcx+sizeof(com_vtbl)]
     175            compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RCX,PTR_SIZE,MOD_BASE_DISP8);
    162176
    163177            // vtblのポインタを取得
  • trunk/abdev/BasicCompiler64/Compile_Object.cpp

    r355 r370  
    212212        && !pClass->IsAbstract() )
    213213    {
     214        // mov rcx,com_vtbl
     215        compiler.codeGenerator.op_mov_RV_com_vtbl( REG_RCX, pClass );
     216
     217        //mov qword ptr[rax],rcx
     218        compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RCX,REG_RAX,0,MOD_BASE);
     219
    214220        // mov rcx,vtblAddress
    215221        compiler.codeGenerator.op_mov_RV_vtbl( REG_RCX, pClass );
    216222
    217         //mov qword ptr[rax],rcx
    218         compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RCX,REG_RAX,0,MOD_BASE);
     223        //mov qword ptr[rax+sizeof(com_vtbl)],rcx
     224        compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RCX,REG_RAX,PTR_SIZE,MOD_BASE_DISP8);
    219225
    220226
  • trunk/abdev/BasicCompiler64/Compile_ProcOp.cpp

    r366 r370  
    189189        char temporary[1024];
    190190        sprintf( temporary,
    191             "Return New %s(ObjPtr( This ),Get_LONG_PTR( (Get_LONG_PTR( ObjPtr(This) ) + SizeOf(LONG_PTR)*%d) As VoidPtr ) As VoidPtr )",
     191            "Return New %s(ObjPtr( This ),Get_LONG_PTR( (Get_LONG_PTR( ObjPtr(This)+SizeOf(VoidPtr) ) + SizeOf(LONG_PTR)*%d) As VoidPtr ) As VoidPtr )",
    192192            userProc.ReturnType().GetClass().GetName().c_str(),
    193193            vtblMasterListIndex
  • trunk/abdev/BasicCompiler64/Compile_Statement.cpp

    r345 r370  
    9696    pobj_reg=new CRegister(REG_RAX);
    9797
     98    if( strstr(leftTerm,"赤"))
     99    {
     100        int test=0;
     101    }
     102
    98103    Type resultType;
    99104    bool isLiteral;
     
    116121            FreeTempObject(REG_R14,&resultType.GetClass());
    117122        }
    118 
    119         //成功
    120         return;
    121     }
    122 
    123     // 失敗
    124     SetError(1, NULL,cp);
     123    }
    125124}
    126125
  • trunk/abdev/BasicCompiler64/Compile_Var.cpp

    r350 r370  
    12281228    //New呼び出し
    12291229    if( type.IsObject()
    1230         && !type.IsInterface()
     1230        && !type.IsInterface() &&  !type.IsComInterface()
    12311231        &&(dwFlags&DIMFLAG_NONCALL_CONSTRACTOR)==0
    12321232        &&InitBuf[0]=='\0')
  • trunk/abdev/BasicCompiler64/NumOpe.cpp

    r368 r370  
    291291    }
    292292
     293    SetError();
     294
    293295    return false;
    294296}
     
    344346        if( !leftType.HasMember() ){
    345347            // メンバを持たない型の場合
     348            if( isProcedureCallOnly )
     349            {
     350                SetError(1,NULL,cp);
     351            }
    346352            return false;
    347353        }
     
    580586    }
    581587
     588    if( isProcedureCallOnly )
     589    {
     590        SetError(3, termLeft, cp );
     591    }
    582592
    583593    return false;
Note: See TracChangeset for help on using the changeset viewer.