* src/vm/classcache.cpp (classcache_get_loaded_classes): Removed obsolete method.
[cacao.git] / src / mm / dumpmemory.hpp
index c871d3e04a7dd3bd342946bbab338682cd227145..ff53ad42af885b75bab7884506ec08814c05e325 100644 (file)
@@ -49,6 +49,17 @@ class DumpMemoryAllocation;
 #endif
 
 
+/**
+ * All classes intended to be allocated on dump memory should extend this
+ * base class to inherit the appropriate allocation operators.
+ */
+class DumpClass {
+public:
+       void* operator new(size_t size);
+       void operator delete(void* p);
+};
+
+
 /**
  * Thread-local dump memory structure.
  */
@@ -209,7 +220,7 @@ public:
 
 
 // Includes.
-#include "mm/memory.h"
+#include "mm/memory.hpp"
 
 #include "threads/thread.hpp"
 
@@ -222,6 +233,16 @@ public:
 
 // Inline functions.
 
+inline void* DumpClass::operator new(size_t size)
+{
+       return DumpMemory::allocate(size);
+}
+
+inline void DumpClass::operator delete(void* p)
+{
+       // We don't need to deallocate on dump memory.
+}
+
 inline DumpMemory* DumpMemory::get_current()
 {
        // Get the DumpMemory object of the current thread.