aboutsummaryrefslogtreecommitdiff
path: root/eval.cpp
diff options
context:
space:
mode:
authorTeddy <[email protected]>2013-08-13 00:31:11 +0800
committerTeddy <[email protected]>2013-08-13 00:31:11 +0800
commit79a2ecc929b30ae40f9324c258d8ded99ecde259 (patch)
treed90ca620d8b5ffb805add4aa3c044326ab459cdc /eval.cpp
parentca12d00e80d76214d44443bf4f5e62554e526089 (diff)
gc can now work
Diffstat (limited to 'eval.cpp')
-rw-r--r--eval.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/eval.cpp b/eval.cpp
index 7370187..5112232 100644
--- a/eval.cpp
+++ b/eval.cpp
@@ -92,6 +92,7 @@ void Evaluator::add_builtin_routines() {
Evaluator::Evaluator() {
envt = new Environment(NULL); // Top-level Environment
+ gc.attach(envt);
add_builtin_routines();
}
@@ -175,10 +176,17 @@ EvalObj *Evaluator::run_expr(Pair *prog) {
cont->proc_body = nexp;
if (nexp == empty_list)
{
- *top_ptr = args->car;
+ *top_ptr = gc.attach(args->car);
+
+ gc.expose(envt);
envt = cont->envt;
+ gc.attach(envt);
+
pc = cont->pc->next;
+
+ gc.expose(cont);
cont = cont->prev_cont;
+ gc.attach(cont);
}
else pc = nexp;
top_ptr++;