diff options
author | Teddy <ted.sybil@gmail.com> | 2013-08-12 19:37:57 +0800 |
---|---|---|
committer | Teddy <ted.sybil@gmail.com> | 2013-08-12 19:37:57 +0800 |
commit | 4d3ed205fc2b86180f81fea388e488f5fa96cef9 (patch) | |
tree | 31f8ad22e11da45a439d5aad873ba08a1896be81 /builtin.cpp | |
parent | 301c949362d243bb6b69956355e0e7ecccc43ce4 (diff) |
basic gc
Diffstat (limited to 'builtin.cpp')
-rw-r--r-- | builtin.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/builtin.cpp b/builtin.cpp index 760aa2a..e9669b5 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -7,6 +7,7 @@ #include "model.h" #include "exc.h" #include "types.h" +#include "gc.h" using std::stringstream; @@ -45,7 +46,7 @@ Pair *SpecialOptIf::call(Pair *args, Environment * &envt, { if (ret_info->state == empty_list) { - *top_ptr++ = TO_PAIR(args->cdr)->car; + *top_ptr++ = gc.attach(TO_PAIR(args->cdr)->car); return ret_addr->next; // Move to the next instruction } else @@ -73,7 +74,7 @@ Pair *SpecialOptIf::call(Pair *args, Environment * &envt, } else { - *top_ptr++ = unspec_obj; + *top_ptr++ = gc.attach(unspec_obj); return ret_addr->next; } } @@ -160,7 +161,7 @@ Pair *SpecialOptLambda::call(Pair *args, Environment * &envt, for (Pair *ptr = body; ptr != empty_list; ptr = TO_PAIR(ptr->cdr)) ptr->next = NULL; // Make each expression isolated - *top_ptr++ = new ProcObj(body, envt, params); + *top_ptr++ = gc.attach(new ProcObj(body, envt, params)); return ret_addr->next; // Move to the next instruction } |