Index: Source/heap/Visitor.h |
diff --git a/Source/heap/Visitor.h b/Source/heap/Visitor.h |
index d80f1952cb2a3a3b32877565d786e47ff8ea21b1..8195794f9a400c4eae63c5a86c2ca5151525c0c3 100644 |
--- a/Source/heap/Visitor.h |
+++ b/Source/heap/Visitor.h |
@@ -153,28 +153,10 @@ template<typename T> struct FinalizerTrait { |
static void finalize(void* obj) { FinalizerTraitImpl<T, nonTrivialFinalizer>::finalize(obj); } |
}; |
-#define DECLARE_GC_INFO \ |
-public: \ |
- static const GCInfo s_gcInfo; \ |
- template<typename Any> friend struct FinalizerTrait; \ |
-private: \ |
- |
-#define DEFINE_GC_INFO(Type) \ |
-const GCInfo Type::s_gcInfo = { \ |
- #Type, \ |
- TraceTrait<Type>::trace, \ |
- FinalizerTrait<Type>::finalize, \ |
- FinalizerTrait<Type>::nonTrivialFinalizer, \ |
- CLASSOF_FUNC(Type) \ |
-}; \ |
+#define DECLARE_GC_INFO |
+#define DEFINE_GC_INFO(Type) |
-template<typename T> |
-struct GCInfoTrait { |
- static const GCInfo* get() |
- { |
- return &T::s_gcInfo; |
- } |
-}; |
+template<typename T> struct GCInfoTrait; |
template<typename T> |
const char* getTypeMarker() |
@@ -554,5 +536,30 @@ public: |
} |
}; |
+template<typename T> |
+struct GCInfoAtBase { |
+ static const GCInfo* get() |
+ { |
+ static char pseudoTypeMarker = 'a'; // FIXME: This is to be removed |
+ static const GCInfo gcInfo = { |
+ &pseudoTypeMarker, |
+ TraceTrait<T>::trace, |
+ FinalizerTrait<T>::finalize, |
+ FinalizerTrait<T>::nonTrivialFinalizer, |
+ CLASSOF_FUNC(T) |
+ }; |
+ return &gcInfo; |
+ } |
+}; |
+ |
+template<typename T> |
+struct GCInfoTrait { |
+ static const GCInfo* get() |
+ { |
+ return GCInfoAtBase<typename T::GarbageCollectedBase>::get(); |
+ } |
+}; |
+ |
} |
+ |
#endif |