Ignore:
Timestamp:
Mar 3, 2008, 8:36:36 PM (17 years ago)
Author:
dai
Message:

GCがオブジェクト内の参照をスキャンする際、平たくスキャンするのではなく、基底クラスをたどるような実装に変更した。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/system/gc.sbp

    r440 r449  
    463463    @date   2007/10/21
    464464    */
    465     Function ScanObject(pObject As *Object, pbMark As *Byte) As Boolean
    466         Dim classTypeInfo = Nothing As ActiveBasic.Core._System_TypeForClass
    467         classTypeInfo = pObject->GetType() As ActiveBasic.Core._System_TypeForClass
    468 
     465    Function ScanObject( classTypeInfo As ActiveBasic.Core._System_TypeForClass, pObject As *Object, pbMark As *Byte) As Boolean
    469466        If IsNull( classTypeInfo ) Then
    470467            Return False
    471468        End If
    472469
    473         If Object.ReferenceEquals( classTypeInfo, ActiveBasic.Core._System_TypeBase.selfTypeInfo ) Then
    474             ' TypeInfoクラスの場合はTypeBaseImplクラスとして扱う
    475             classTypeInfo = _System_TypeBase_Search( "ActiveBasic.Core.TypeBaseImpl" ) As ActiveBasic.Core._System_TypeForClass
     470        ' 基底クラスをスキャン
     471        If Not IsNull( classTypeInfo.BaseType ) Then
     472            Dim baseClassTypeInfo = Nothing As ActiveBasic.Core._System_TypeForClass
     473            baseClassTypeInfo = classTypeInfo.BaseType As ActiveBasic.Core._System_TypeForClass
     474            ScanObject( baseClassTypeInfo, pObject, pbMark )
    476475        End If
    477476
     
    488487
    489488        Return True
     489    End Function
     490    Function ScanObject(pObject As *Object, pbMark As *Byte) As Boolean
     491        Dim classTypeInfo = Nothing As ActiveBasic.Core._System_TypeForClass
     492        classTypeInfo = pObject->GetType() As ActiveBasic.Core._System_TypeForClass
     493
     494        If Object.ReferenceEquals( classTypeInfo, ActiveBasic.Core._System_TypeBase.selfTypeInfo ) Then
     495            ' TypeInfoクラスの場合はTypeBaseImplクラスとして扱う
     496            classTypeInfo = _System_TypeBase_Search( "ActiveBasic.Core.TypeBaseImpl" ) As ActiveBasic.Core._System_TypeForClass
     497        End If
     498
     499        Return ScanObject( classTypeInfo, pObject, pbMark )
    490500    End Function
    491501
Note: See TracChangeset for help on using the changeset viewer.