diff options
Diffstat (limited to 'gc.cpp')
-rw-r--r-- | gc.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -25,18 +25,18 @@ void* GC::alloc(size_t size) { void* ret = malloc(size); - _heap.push_back((AST*)ret); + _heap.push_back((Object*)ret); return ret; } inline void -mark(CEnv& cenv, const AST* ast) +mark(CEnv& cenv, const Object* obj) { - if (!ast || ast->used) + if (!obj || obj->used) return; - ast->used = true; - const ATuple* tup = ast->to<const ATuple*>(); + obj->used = true; + const ATuple* tup = dynamic_cast<const ATuple*>(obj); if (tup) { FOREACH(ATuple::const_iterator, i, *tup) { mark(cenv, *i); @@ -57,10 +57,10 @@ GC::collect(CEnv& cenv, const Roots& roots) if ((*i)->used) { (*i)->used = false; } else { - AType* t = (*i)->to<AType*>(); + AType* t = dynamic_cast<AType*>(*i); // Don't delete types that are keys in the current type substitution if (!t || cenv.tsubst.find(t) == cenv.tsubst.end()) { - (*i)->~AST(); + (*i)->~Object(); free(*i); _heap.erase(i); } |