Changeset 128 in dev for BasicCompiler64


Ignore:
Timestamp:
May 18, 2007, 4:42:36 AM (17 years ago)
Author:
dai_9181
Message:

Blittable型を導入した。

Location:
BasicCompiler64
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler64/BasicCompiler.vcproj

    r127 r128  
    157157                RuntimeLibrary="1"
    158158                UsePrecompiledHeader="0"
    159                 PrecompiledHeaderFile=".\Debug/BasicCompiler.pch"
    160                 AssemblerListingLocation=".\Debug/"
    161                 ObjectFile=".\Debug/"
    162                 ProgramDataBaseFileName=".\Debug/"
     159                PrecompiledHeaderFile=".\SmallDebug/BasicCompiler.pch"
     160                AssemblerListingLocation=".\SmallDebug/"
     161                ObjectFile=".\SmallDebug/"
     162                ProgramDataBaseFileName=".\SmallDebug/"
    163163                BrowseInformation="0"
    164164                WarningLevel="3"
     
    188188                IgnoreDefaultLibraryNames=""
    189189                GenerateDebugInformation="false"
    190                 ProgramDatabaseFile=".\Debug/BasicCompiler64.pdb"
     190                ProgramDatabaseFile=".\SmallDebug/BasicCompiler64.pdb"
    191191                SubSystem="2"
    192192                TargetMachine="0"
  • BasicCompiler64/Compile_Calc.cpp

    r116 r128  
    227227    }
    228228
     229    if( varType.IsObject() && Smoothie::Meta::blittableTypes.IsExist( calcType ) ){
     230        // Blittable型をオブジェクトとして扱う
     231        vector<UserProc *> userProcs;
     232        Smoothie::Meta::blittableTypes.GetClass( calcType ).EnumStaticMethod( "_Create", userProcs );
     233        if( userProcs.size() != 1 ){
     234            SetError();
     235            return;
     236        }
     237        UserProc *pUserProc = userProcs[0];
     238
     239        // mov rcx, rax
     240        op_mov_RR( REG_RCX, REG_RAX );
     241
     242        // call System.[TypeClass]._Create
     243        op_call( pUserProc );
     244
     245        calcType = pUserProc->ReturnType();
     246    }
    229247
    230248    /////////////////////////////////
  • BasicCompiler64/Compile_Statement.cpp

    r122 r128  
    9494    bool isLiteral;
    9595    BOOL bUseHeap;
    96     bool result = TermOpe( leftTerm, Type(), resultType, isLiteral, &bUseHeap, NULL, true );
     96    bool result = TermOpe( leftTerm, Type(), resultType, isLiteral, &bUseHeap, false, NULL, true );
    9797
    9898    delete pobj_reg;
  • BasicCompiler64/NumOpe.cpp

    r122 r128  
    224224    return false;
    225225}
    226 bool TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, BOOL *pbUseHeap, bool *pIsClassName, bool isProcedureCallOnly ){
     226bool TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, BOOL *pbUseHeap, bool isWantObject, bool *pIsClassName, bool isProcedureCallOnly ){
    227227    char parameter[VN_SIZE];
    228228
     
    252252        bool isClassName = false;
    253253        Type leftType;
    254         if( !TermOpe( termLeft, baseType, leftType, isLiteral, pbUseHeap, &isClassName ) ){
     254        if( GetTermType( termLeft, leftType, isLiteral, &isClassName ) ){
     255            if( isClassName == false && Smoothie::Meta::blittableTypes.IsExist( leftType ) ){
     256                // 左側のオブジェクト部分がBlittable型のとき
     257
     258                char temporary[VN_SIZE];
     259                lstrcpy( temporary, termLeft );
     260                sprintf( termLeft, "%s(%s)",
     261                    Smoothie::Meta::blittableTypes.Find( leftType ).GetCreateStaticMethodFullName().c_str(),
     262                    temporary );
     263            }
     264        }
     265
     266        if( !TermOpe( termLeft, baseType, leftType, isLiteral, pbUseHeap, true, &isClassName ) ){
    255267            goto globalArea;
    256268        }
     
    705717                    //型名
    706718                    if( Type::StringToType( term, resultType ) ){
     719
     720                        if( resultType.IsObject() ){
     721                            if( resultType.GetClass().IsBlittableType() ){
     722                                // Blittable型のときは基本型として扱う
     723                                // ※ただし、コンパイル中のメソッドがBlittable型クラスに属していないこと
     724                                if( UserProc::IsLocalAreaCompiling()
     725                                    && UserProc::CompilingUserProc().HasParentClass()
     726                                    && UserProc::CompilingUserProc().GetParentClass().IsBlittableType() )
     727                                {
     728                                    // コンパイル中のメソッドがBlittable型クラスに属している
     729                                }
     730                                else{
     731                                    resultType = resultType.GetClass().GetBlittableType();
     732                                }
     733                            }
     734                        }
     735
    707736                        resultType.SetBasicType( resultType.GetBasicType() | FLAG_CAST );
    708737                    }
  • BasicCompiler64/Opcode.h

    r122 r128  
    251251
    252252//NumOpe.cpp
    253 bool TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, BOOL *pbUseHeap, bool *pIsClassName = NULL, bool isProcedureCallOnly = false );
     253bool TermOpe(
     254             const char *term,
     255             const Type &baseType,
     256             Type &resultType,
     257             bool &isLiteral,
     258             BOOL *pbUseHeap,
     259             bool isWantObject = false,
     260             bool *pIsClassName = NULL,
     261             bool isProcedureCallOnly = false );
    254262bool NumOpe( int *pReg,
    255263           const char *Command,
Note: See TracChangeset for help on using the changeset viewer.