Changeset 449 for trunk


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

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

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/Classes/System/Object.ab

    r275 r449  
    5959
    6060    Private
    61         typeInfo As TypeInfo
     61        _system_object_member_typeInfo As TypeInfo
    6262
    6363    Public
     
    6767            End If
    6868
    69             This.typeInfo = typeInfo
     69            This._system_object_member_typeInfo = typeInfo
    7070        End Sub
    7171
    7272        Virtual Function GetType() As TypeInfo
    73             Return typeInfo
     73            Return _system_object_member_typeInfo
    7474        End Function
    7575
  • 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.