Changeset 639 in dev for trunk/ab5.0/abdev


Ignore:
Timestamp:
Jun 12, 2008, 11:30:50 PM (16 years ago)
Author:
dai_9181
Message:

静的リンクリンカの依存関係解決モジュールを製作中

Location:
trunk/ab5.0/abdev
Files:
31 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/BasicCompiler_Common/MakeExe.cpp

    r636 r639  
    202202        }
    203203
     204        ActiveBasic::Common::Environment::SetRemoveExternalMark( true );
     205
    204206        BOOST_FOREACH( const std::string &filePath, compiler.staticLibraryFilePaths )
    205207        {
     
    225227        }
    226228
     229        ActiveBasic::Common::Environment::SetRemoveExternalMark( false );
     230
    227231        if( !isSuccessfulLoadStaticLinkLibrary )
    228232        {
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Class.h

    r637 r639  
    466466    void GetReferenceOffsetsInitializeBuffer( std::string &referenceOffsetsBuffer, int &numOfReference, int baseOffset = 0 ) const;
    467467
    468     virtual bool Resolve();
     468    virtual bool Resolve( const ObjectModule &resolver );
    469469};
    470470
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Const.h

    r637 r639  
    6666    double GetDoubleData();
    6767
    68     virtual bool Resolve();
     68    virtual bool Resolve( const ObjectModule &resolver );
    6969};
    7070class Consts : public Jenga::Common::Hashmap<CConst>
     
    154154    }
    155155
    156     virtual bool Resolve();
     156    virtual bool Resolve( const ObjectModule &resolver );
    157157};
    158158class ConstMacros
  • trunk/ab5.0/abdev/ab_common/include/Lexical/DataTable.h

    r637 r639  
    150150    void ResetDataSectionBaseOffset( long dataSectionBaseOffset );
    151151
    152     void Resolve();
     152    void Resolve( const ObjectModule &resolver );
    153153};
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Delegate.h

    r637 r639  
    9292    bool IsSimilar( const Delegate &dgt ) const;
    9393
    94     virtual bool Resolve();
     94    virtual bool Resolve( const ObjectModule &resolver );
    9595};
    9696typedef Jenga::Common::Hashmap<Delegate> Delegates;
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Interface.h

    r636 r639  
    9191
    9292    std::string GetFullNameWithActualGenericTypeParameters() const;
     93
     94    virtual bool Resolve( const ObjectModule &resolver );
    9395};
    9496typedef std::vector<Interface *> Interfaces;
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Member.h

    r632 r639  
    7676        return constructParameter;
    7777    }
     78
     79    virtual bool Resolve( const ObjectModule &resolver );
    7880};
    7981typedef std::vector<Member *> Members;
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Meta.h

    r637 r639  
    9898    }
    9999
     100    const Classes &GetClasses() const
     101    {
     102        return *pNowClassesForDebugger;
     103    }
    100104    Classes &GetClasses()
    101105    {
     
    158162    const CClass *FindClassSupportedTypeDef( const Symbol &symbol );
    159163
    160     void Resolve();
     164    void Resolve( const ObjectModule &resolver );
    161165};
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Method.h

    r603 r639  
    4848    virtual bool IsNotUse() const = 0;
    4949    virtual void SetNotUseMark( bool isNotUse ) = 0;
     50
     51    virtual bool Resolve( const ObjectModule &resolver );
    5052};
    5153
     
    156158        this->isNotUse = isNotUse;
    157159    }
     160
     161    virtual bool Resolve( const ObjectModule &resolver );
    158162};
    159163BOOST_CLASS_EXPORT( DynamicMethod );
     
    230234        throw;
    231235    }
     236
     237    virtual bool Resolve( const ObjectModule &resolver );
    232238};
    233239BOOST_CLASS_EXPORT( StaticMethod );
  • trunk/ab5.0/abdev/ab_common/include/Lexical/NativeCode.h

    r637 r639  
    116116    const ::UserProc &GetUserProc() const;
    117117    const ::CClass &GetClass() const;
     118
     119    virtual bool Resolve( const ObjectModule &resolver );
    118120};
    119121typedef std::vector<Schedule> Schedules;
     
    247249    void ResetRelationalObjectModuleIndex( const std::vector<int> &relationTable );
    248250
    249     void Resolve();
     251    void Resolve( const ObjectModule &resolver );
    250252};
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Procedure.h

    r637 r639  
    110110        return returnType;
    111111    }
     112
     113    virtual bool Resolve( const ObjectModule &resolver );
    112114};
    113115
     
    158160
    159161        ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Procedure );
     162        ar & boost::serialization::make_nvp("pParentClass", const_cast<CClass *&>(pParentClass) );
    160163
    161164        if( ActiveBasic::Common::Environment::IsRemoveExternal() )
     
    170173        ar & BOOST_SERIALIZATION_NVP( _paramStr );
    171174        ar & BOOST_SERIALIZATION_NVP( importedNamespaces );
    172         ar & boost::serialization::make_nvp("pParentClass", const_cast<CClass *&>(pParentClass) );
    173175        ar & boost::serialization::make_nvp("pInterface", const_cast<Interface *&>(pInterface) );
    174176        ar & BOOST_SERIALIZATION_NVP( pMethod );
     
    374376    const CMethod &GetMethod() const;
    375377
    376     virtual bool Resolve();
     378    virtual bool Resolve( const ObjectModule &resolver );
    377379
    378380    static const UserProc *pGlobalProc;
     
    482484    }
    483485
    484     virtual bool Resolve();
     486    virtual bool Resolve( const ObjectModule &resolver );
    485487};
    486488class DllProcs : public Jenga::Common::Hashmap<DllProc>
     
    523525    }
    524526
    525     virtual bool Resolve();
     527    virtual bool Resolve( const ObjectModule &resolver );
    526528};
    527529
  • trunk/ab5.0/abdev/ab_common/include/Lexical/RelationalObjectModuleItem.h

    r637 r639  
    11#pragma once
     2
     3class ObjectModule;
    24
    35namespace ActiveBasic{ namespace Common{ namespace Lexical{
     
    6668    }
    6769
    68     virtual bool Resolve() = 0;
     70    virtual bool Resolve( const ObjectModule &resolver ) = 0;
    6971};
    7072
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Template.h

    r632 r639  
    4646        return actualTypes;
    4747    }
     48
     49    virtual bool Resolve( const ObjectModule &resolver );
    4850};
    4951
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Type.h

    r637 r639  
    66typedef std::vector<GenericType> GenericTypes;
    77
    8 class Type{
     8class Type
     9{
    910    int basicType;
    1011    union{
     
    229230    std::string ToString() const;
    230231
     232    virtual bool Resolve( const ObjectModule &resolver );
     233
    231234
    232235private:
     
    299302        return type;
    300303    }
     304    Type &GetType()
     305    {
     306        return type;
     307    }
    301308};
    302309
  • trunk/ab5.0/abdev/ab_common/include/Lexical/TypeDef.h

    r637 r639  
    5151    }
    5252
    53     virtual bool Resolve();
     53    virtual bool Resolve( const ObjectModule &resolver );
    5454};
    5555
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Variable.h

    r637 r639  
    175175    }
    176176
    177     virtual bool Resolve();
     177    virtual bool Resolve( const ObjectModule &resolver );
    178178
    179179
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Class.cpp

    r637 r639  
    869869}
    870870
    871 bool CClass::Resolve()
    872 {
    873     // TODO: Resolve
     871bool CClass::Resolve( const ObjectModule &resolver )
     872{
     873    // 型パラメータ
     874    BOOST_FOREACH( GenericType &genericType, formalGenericTypes )
     875    {
     876        genericType.GetType().Resolve( resolver );
     877    }
     878
     879    // 基底クラス
     880    if( this->pSuperClass )
     881    {
     882        if( this->pSuperClass->IsNeedResolve() )
     883        {
     884            this->pSuperClass = resolver.meta.GetClasses().FindEx( *pSuperClass );
     885        }
     886    }
     887
     888    // 基底クラスの型パラメータ(実パラメータ)
     889    BOOST_FOREACH( Type &superClassActualTypeParameter, superClassActualTypeParameters )
     890    {
     891        superClassActualTypeParameter.Resolve( resolver );
     892    }
     893
     894    // Blittable型情報
     895    blittableType.Resolve( resolver );
     896
     897    // 実装するインターフェイス
     898    BOOST_FOREACH( ::Interface *pInterface, interfaces )
     899    {
     900        pInterface->Resolve( resolver );
     901    }
     902
     903    // 動的メンバ
     904    BOOST_FOREACH( Member *pMember, dynamicMembers )
     905    {
     906        pMember->Resolve( resolver );
     907    }
     908
     909    // 静的メンバ
     910    BOOST_FOREACH( Member *pMember, staticMembers )
     911    {
     912        pMember->Resolve( resolver );
     913    }
     914
     915    // 動的メソッド
     916    BOOST_FOREACH( CMethod *pMethod, GetDynamicMethods() )
     917    {
     918        pMethod->Resolve( resolver );
     919    }
     920
     921    // 静的メソッド
     922    BOOST_FOREACH( CMethod *pMethod, staticMethods )
     923    {
     924        pMethod->Resolve( resolver );
     925    }
     926
     927    // テンプレート展開後のクラス
     928    BOOST_FOREACH( ActiveBasic::Common::Lexical::ExpandedTemplateClass *pExpandedTemplateClass, expandedTemplateClasses )
     929    {
     930        pExpandedTemplateClass->Resolve( resolver );
     931    }
     932
    874933    return true;
    875934}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Const.cpp

    r637 r639  
    77}
    88
    9 bool CConst::Resolve()
     9bool CConst::Resolve( const ObjectModule &resolver )
    1010{
    11     // TODO: Resolve
     11    type.Resolve( resolver );
    1212    return true;
    1313}
     
    7878}
    7979
    80 bool ConstMacro::Resolve()
     80bool ConstMacro::Resolve( const ObjectModule &resolver )
    8181{
    82     // TODO: Resolve
     82    // 依存関係を解決すべきメンバは無い
    8383    return true;
    8484}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/DataTable.cpp

    r637 r639  
    7878}
    7979
    80 void DataTable::Resolve()
     80void DataTable::Resolve( const ObjectModule &resolver )
    8181{
    82     // TODO: Resolve
     82    BOOST_FOREACH( Schedule &schedule, schedules )
     83    {
     84        schedule.Resolve( resolver );
     85    }
    8386}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Delegate.cpp

    r637 r639  
    1919}
    2020
    21 bool Delegate::Resolve()
     21bool Delegate::Resolve( const ObjectModule &resolver )
    2222{
    23     // TODO: Resolve
     23    Procedure::Resolve( resolver );
     24
     25    BOOST_FOREACH( Parameter *pParameter, dynamicParams )
     26    {
     27        pParameter->Resolve( resolver );
     28    }
     29
    2430    return true;
    2531}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Interface.cpp

    r603 r639  
    5252    return interfaceName;
    5353}
     54
     55bool Interface::Resolve( const ObjectModule &resolver )
     56{
     57    // 動的メソッド
     58    BOOST_FOREACH( CMethod *pMethod, GetDynamicMethods() )
     59    {
     60        pMethod->Resolve( resolver );
     61    }
     62
     63    // クラス
     64    if( this->pInterfaceClass )
     65    {
     66        if( this->pInterfaceClass->IsNeedResolve() )
     67        {
     68            this->pInterfaceClass = resolver.meta.GetClasses().FindLike( pInterfaceClass );
     69        }
     70    }
     71
     72    BOOST_FOREACH( Type &actualTypeParameter, actualTypeParameters )
     73    {
     74        actualTypeParameter.Resolve( resolver );
     75    }
     76
     77    return true;
     78}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Member.cpp

    r632 r639  
    4040{
    4141}
     42
     43bool Member::Resolve( const ObjectModule &resolver )
     44{
     45    type.Resolve( resolver );
     46    return true;
     47}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Meta.cpp

    r637 r639  
    253253}
    254254
    255 void Meta::Resolve()
     255void Meta::Resolve( const ObjectModule &resolver )
    256256{
    257257    // 関数・メソッド
     
    261261    {
    262262        UserProc *pUserProc = this->GetUserProcs().Iterator_GetNext();
    263         pUserProc->Resolve();
     263        pUserProc->Resolve( resolver );
    264264    }
    265265
     
    270270    {
    271271        DllProc *pDllProc = this->GetDllProcs().Iterator_GetNext();
    272         pDllProc->Resolve();
     272        pDllProc->Resolve( resolver );
    273273    }
    274274
     
    279279    {
    280280        CClass *pClass = this->GetClasses().Iterator_GetNext();
    281         pClass->Resolve();
     281        pClass->Resolve( resolver );
    282282    }
    283283
     
    285285    BOOST_FOREACH( Variable *pVar, globalVars )
    286286    {
    287         pVar->Resolve();
     287        pVar->Resolve( resolver );
    288288    }
    289289
     
    294294    {
    295295        CConst *pConst = this->GetGlobalConsts().Iterator_GetNext();
    296         pConst->Resolve();
     296        pConst->Resolve( resolver );
    297297    }
    298298
     
    303303    {
    304304        ConstMacro *pConstMacro = this->GetGlobalConstMacros().Iterator_GetNext();
    305         pConstMacro->Resolve();
     305        pConstMacro->Resolve( resolver );
    306306    }
    307307
     
    309309    BOOST_FOREACH( TypeDef &typeDef, typeDefs )
    310310    {
    311         typeDef.Resolve();
     311        typeDef.Resolve( resolver );
    312312    }
    313313
     
    315315    BOOST_FOREACH( ProcPointer *pProcPointer, procPointers )
    316316    {
    317         pProcPointer->Resolve();
     317        pProcPointer->Resolve( resolver );
    318318    }
    319319
     
    324324    {
    325325        Delegate *pDelegate = this->GetDelegates().Iterator_GetNext();
    326         pDelegate->Resolve();
    327     }
    328 }
     326        pDelegate->Resolve( resolver );
     327    }
     328}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Method.cpp

    r603 r639  
    11#include "stdafx.h"
     2
     3bool CMethod::Resolve( const ObjectModule &resolver )
     4{
     5    if( pUserProc )
     6    {
     7        if( pUserProc->IsNeedResolve() )
     8        {
     9            pUserProc = resolver.meta.GetUserProcs().FindLike( pUserProc );
     10        }
     11    }
     12    return true;
     13}
    214
    315DynamicMethod::OverrideResult::EnumType DynamicMethod::Override( const UserProc *pUserProc, Prototype::Accessibility accessibility, bool isOverrideModifier )
     
    2941}
    3042
     43bool DynamicMethod::Resolve( const ObjectModule &resolver )
     44{
     45    CMethod::Resolve( resolver );
     46
     47    if( this->pInheritsClass )
     48    {
     49        if( this->pInheritsClass->IsNeedResolve() )
     50        {
     51            this->pInheritsClass = resolver.meta.GetClasses().FindLike( pInheritsClass );
     52        }
     53    }
     54
     55    return true;
     56}
    3157
    3258StaticMethod::StaticMethod( const StaticMethod &staticMethod )
     
    3561    throw;
    3662}
     63
     64bool StaticMethod::Resolve( const ObjectModule &resolver )
     65{
     66    CMethod::Resolve( resolver );
     67    return true;
     68}
     69
    3770
    3871Methods::Methods()
  • trunk/ab5.0/abdev/ab_common/src/Lexical/NativeCode.cpp

    r637 r639  
    1717    _ASSERT( type == Schedule::ComVtbl || type == Schedule::Vtbl || type == Schedule::TypeInfo );
    1818    return *pClass;
     19}
     20
     21bool Schedule::Resolve( const ObjectModule &resolver )
     22{
     23    switch( type )
     24    {
     25    case UserProc:
     26    case AddressOf:
     27    case CatchAddress:
     28        if( pUserProc->IsNeedResolve() )
     29        {
     30            pUserProc = resolver.meta.GetUserProcs().FindLike( pUserProc );
     31        }
     32        break;
     33    case DllProc:
     34        if( pDllProc->IsNeedResolve() )
     35        {
     36            pDllProc = resolver.meta.GetDllProcs().FindLike( pDllProc );
     37        }
     38        break;
     39    case ComVtbl:
     40    case Vtbl:
     41    case TypeInfo:
     42        if( pClass->IsNeedResolve() )
     43        {
     44            pClass = resolver.meta.GetClasses().FindLike( pClass );
     45        }
     46        break;
     47    default:
     48        break;
     49    }
     50
     51    return true;
    1952}
    2053
     
    158191}
    159192
    160 void NativeCode::Resolve()
     193void NativeCode::Resolve( const ObjectModule &resolver )
    161194{
    162     // TODO: Resolve
     195    BOOST_FOREACH( Schedule &schedule, schedules )
     196    {
     197        schedule.Resolve( resolver );
     198    }
    163199}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/ObjectModule.cpp

    r637 r639  
    8787void ObjectModule::Resolve()
    8888{
    89     this->meta.Resolve();
     89    this->meta.Resolve( *this );
    9090
    9191    // グローバルネイティブコードを解決(スケジュールを解決する)
    92     this->globalNativeCode.Resolve();
     92    this->globalNativeCode.Resolve( *this );
    9393
    9494    // データテーブルを解決(スケジュールを解決する)
    95     this->dataTable.Resolve();
     95    this->dataTable.Resolve( *this );
    9696}
    9797
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Procedure.cpp

    r637 r639  
    1111    }
    1212}
     13
     14bool Procedure::Resolve( const ObjectModule &resolver )
     15{
     16    BOOST_FOREACH( Parameter *pParameter, params )
     17    {
     18        pParameter->Resolve( resolver );
     19    }
     20
     21    returnType.Resolve( resolver );
     22
     23    return true;
     24}
     25
    1326
    1427void UserProc::ResetRelationalObjectModuleIndex( const std::vector<int> &relationTable )
     
    157170}
    158171
    159 bool UserProc::Resolve()
    160 {
    161     // TODO: Resolve
     172bool UserProc::Resolve( const ObjectModule &resolver )
     173{
     174    Procedure::Resolve( resolver );
     175
     176    if( pParentClass )
     177    {
     178        if( pParentClass->IsNeedResolve() )
     179        {
     180            pParentClass = resolver.meta.GetClasses().FindLike( pParentClass );
     181        }
     182    }
     183
     184    if( pInterface )
     185    {
     186        const_cast<Interface *>(pInterface)->Resolve( resolver );
     187    }
     188
     189    if( pMethod )
     190    {
     191        pMethod->Resolve( resolver );
     192    }
     193
     194    BOOST_FOREACH( Parameter *pParameter, realParams )
     195    {
     196        pParameter->Resolve( resolver );
     197    }
     198
     199    BOOST_FOREACH( Variable *pLocalVar, localVars )
     200    {
     201        pLocalVar->Resolve( resolver );
     202    }
     203
     204    nativeCode.Resolve( resolver );
    162205    return true;
    163206}
     
    185228}
    186229
    187 bool DllProc::Resolve()
    188 {
    189     // TODO: Resolve
    190     return true;
    191 }
    192 
    193 bool ProcPointer::Resolve()
    194 {
    195     // TODO: Resolve
     230bool DllProc::Resolve( const ObjectModule &resolver )
     231{
     232    Procedure::Resolve( resolver );
     233    return true;
     234}
     235
     236bool ProcPointer::Resolve( const ObjectModule &resolver )
     237{
     238    Procedure::Resolve( resolver );
    196239    return true;
    197240}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Template.cpp

    r632 r639  
    88    }
    99}
     10
     11bool ExpandedTemplateClass::Resolve( const ObjectModule &resolver )
     12{
     13    if( pClass->IsNeedResolve() )
     14    {
     15        pClass = const_cast<CClass *>(resolver.meta.GetClasses().FindLike( pClass ));
     16    }
     17
     18    BOOST_FOREACH( Type &actualType, actualTypes )
     19    {
     20        actualType.Resolve( resolver );
     21    }
     22
     23    return true;
     24}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Type.cpp

    r632 r639  
    554554    if(name[i]=='%') return DEF_INTEGER;
    555555    return DEF_DOUBLE;
     556}
     557
     558bool Type::Resolve( const ObjectModule &resolver )
     559{
     560    if( this->HasMember() )
     561    {
     562        if( this->pClass->IsNeedResolve() )
     563        {
     564            this->pClass = resolver.meta.GetClasses().FindLike( this->pClass );
     565        }
     566
     567        BOOST_FOREACH( GenericType &actualGenericType, actualGenericTypes )
     568        {
     569            actualGenericType.GetType().Resolve( resolver );
     570        }
     571    }
     572    return true;
    556573}
    557574
  • trunk/ab5.0/abdev/ab_common/src/Lexical/TypeDef.cpp

    r637 r639  
    88}
    99
    10 bool TypeDef::Resolve()
     10bool TypeDef::Resolve( const ObjectModule &resolver )
    1111{
    12     // TODO: Resolve
     12    this->baseType.Resolve( resolver );
    1313    return true;
    1414}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Variable.cpp

    r637 r639  
    2828}
    2929
    30 bool Variable::Resolve()
     30bool Variable::Resolve( const ObjectModule &resolver )
    3131{
    32     // TODO: Resolve
     32    this->type.Resolve( resolver );
    3333    return true;
    3434}
Note: See TracChangeset for help on using the changeset viewer.