2007-06-02 23:36:55 +00:00
|
|
|
#ifndef HEAP_H
|
|
|
|
#define HEAP_H
|
|
|
|
|
2007-06-18 19:23:44 +00:00
|
|
|
namespace vm {
|
|
|
|
|
2007-06-02 23:36:55 +00:00
|
|
|
class Heap {
|
|
|
|
public:
|
|
|
|
enum CollectionType {
|
|
|
|
MinorCollection,
|
|
|
|
MajorCollection
|
|
|
|
};
|
|
|
|
|
|
|
|
class Visitor {
|
2007-06-03 01:58:47 +00:00
|
|
|
public:
|
2007-06-02 23:36:55 +00:00
|
|
|
virtual ~Visitor() { }
|
|
|
|
virtual void visit(void**) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Iterator {
|
2007-06-03 01:58:47 +00:00
|
|
|
public:
|
2007-06-02 23:36:55 +00:00
|
|
|
virtual ~Iterator() { }
|
|
|
|
virtual void iterate(Visitor*) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
virtual ~Heap() { }
|
|
|
|
virtual void collect(CollectionType type, Iterator* it) = 0;
|
2007-06-15 16:00:08 +00:00
|
|
|
virtual bool needsMark(void** p) = 0;
|
2007-06-20 02:28:31 +00:00
|
|
|
virtual void mark(void** p) = 0;
|
|
|
|
virtual void dispose() = 0;
|
2007-06-02 23:36:55 +00:00
|
|
|
};
|
|
|
|
|
2007-06-18 19:23:44 +00:00
|
|
|
} // namespace vm
|
|
|
|
|
2007-06-02 23:36:55 +00:00
|
|
|
#endif//HEAP_H
|