diff options
Diffstat (limited to 'src/tuplr.hpp')
-rw-r--r-- | src/tuplr.hpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/tuplr.hpp b/src/tuplr.hpp index ada5412..f51db5e 100644 --- a/src/tuplr.hpp +++ b/src/tuplr.hpp @@ -107,18 +107,15 @@ typedef void* CFunc; ///< Compiled function (opaque) ***************************************************************************/ struct Object; +struct AType; /// Garbage collector struct GC { - enum Tag { - TAG_AST = 1, ///< Abstract syntax tree node - TAG_FRAME = 2 ///< Stack frame - }; typedef std::list<const Object*> Roots; typedef std::list<Object*> Heap; GC(size_t pool_size); ~GC(); - void* alloc(size_t size, Tag tag); + void* alloc(size_t size); void collect(const Roots& roots); void addRoot(const Object* obj) { assert(obj); _roots.push_back(obj); } void lock() { _roots.insert(_roots.end(), _heap.begin(), _heap.end()); } @@ -133,7 +130,6 @@ private: struct Object { struct Header { uint8_t mark; - uint8_t tag; }; /// Always allocated with pool.alloc, so this - sizeof(Header) is a valid Header*. @@ -141,9 +137,8 @@ struct Object { inline bool marked() const { return header()->mark != 0; } inline void mark(bool b) const { header()->mark = 1; } - inline GC::Tag tag() const { return (GC::Tag)header()->tag; } - static void* operator new(size_t size) { return pool.alloc(size, GC::TAG_AST); } + static void* operator new(size_t size) { return pool.alloc(size); } static void operator delete(void* ptr) {} static GC pool; }; |