aboutsummaryrefslogtreecommitdiffstats
path: root/gc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gc.cpp')
-rw-r--r--gc.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/gc.cpp b/gc.cpp
index 1cfd087..6221e7f 100644
--- a/gc.cpp
+++ b/gc.cpp
@@ -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);
}