Changeset 666 in dev for trunk/ab5.0/abdev/compiler_x86


Ignore:
Timestamp:
Jun 26, 2008, 11:02:20 PM (16 years ago)
Author:
dai_9181
Message:

ClassSizeOf組み込み関数を追加。

Location:
trunk/ab5.0/abdev/compiler_x86
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/compiler_x86/Compile_Func.cpp

    r562 r666  
    1414    if( lstrcmpi( FuncName, "AddressOf" ) == 0 )        return FUNC_ADDRESSOF;
    1515    if( lstrcmpi( FuncName, "SizeOf" ) == 0 )           return FUNC_SIZEOF;
     16    if( lstrcmpi( FuncName, "__ClassSizeOf" ) == 0 )            return FUNC_CLASS_SIZEOF;
    1617    if( lstrcmpi( FuncName, "VarPtr" ) == 0 )           return FUNC_VARPTR;
    1718    if( lstrcmpi( FuncName, "ObjPtr" ) == 0 )           return FUNC_OBJPTR;
     
    524525    }
    525526}
    526 void Opcode_Func_SizeOf( const std::string &typeName ){
     527void Opcode_Func_SizeOf( const std::string &typeName )
     528{
    527529    Type tempType;
    528530    if( !compiler.StringToType( typeName, tempType ) ){
     
    531533    }
    532534
     535    int typeSize = tempType.GetSize();
     536
     537    //mov eax,size
     538    compiler.codeGenerator.op_mov_RV( REG_EAX, typeSize );
     539}
     540void Opcode_Func_ClassSizeOf( const std::string &typeName )
     541{
     542    Type tempType;
     543    if( !compiler.StringToType( typeName, tempType ) ){
     544        compiler.errorMessenger.Output(3,typeName,cp);
     545        return;
     546    }
     547
    533548    int typeSize = ( tempType.IsObject() ) ?
    534549        tempType.GetClass().GetSize() : tempType.GetSize();
     
    752767            resultType.SetBasicType( DEF_LONG );
    753768            break;
     769        case FUNC_CLASS_SIZEOF:
     770            if( isCallOn ) Opcode_Func_ClassSizeOf(Parameter);
     771            resultType.SetBasicType( DEF_LONG );
     772            break;
    754773        case FUNC_VARPTR:
    755774            Opcode_Func_VarPtr( Parameter, resultType, isCallOn );
  • trunk/ab5.0/abdev/compiler_x86/FunctionValue.h

    r431 r666  
    2525#define FUNC_SYSTEM_GET_DEFAULT_CONSTRUCTOR     0x0629
    2626#define FUNC_SYSTEM_GET_DESTRUCTOR              0x062A
     27#define FUNC_CLASS_SIZEOF   0x062B
    2728
    2829//ポインタ
Note: See TracChangeset for help on using the changeset viewer.