aboutsummaryrefslogtreecommitdiff
path: root/gc.cpp
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2013-08-15 11:04:57 +0800
committerTeddy <ted.sybil@gmail.com>2013-08-15 11:04:57 +0800
commit9f9bd0ee34422aceb9725276292a66b0e7934c6a (patch)
tree4e9044237f3b7004b3b8598fe2c53546ab29dc25 /gc.cpp
parent06d014cb0e95f92945ea01610fd1c52a1b087502 (diff)
tail-rec for `if` and `and`
Diffstat (limited to 'gc.cpp')
-rw-r--r--gc.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/gc.cpp b/gc.cpp
index 4df2d46..28a7360 100644
--- a/gc.cpp
+++ b/gc.cpp
@@ -3,8 +3,8 @@
#include "consts.h"
#include <vector>
-#if defined(GC_DEBUG) || defined (GC_INFO)
#include <cstdio>
+#if defined(GC_DEBUG) || defined (GC_INFO)
typedef unsigned long long ull;
#endif
@@ -24,16 +24,18 @@ GarbageCollector::PendingEntry::PendingEntry(
void GarbageCollector::expose(EvalObj *ptr) {
if (ptr == NULL) return;
#ifdef GC_DEBUG
- fprintf(stderr, "GC: 0x%llx exposed. count = %lu \"%s\"\n",
+ fprintf(stderr, "GC: 0x%llx exposed. count = %lu \"%s\"\n",
(ull)ptr, ptr->gc_get_cnt() - 1, ptr->ext_repr().c_str());
#endif
- if (ptr->gc_dec())
- {
+ /* if (ptr->gc_get_cnt() == 0)
+ puts("oops");*/
+ if (ptr->gc_dec())
+ {
#ifdef GC_DEBUG
- fprintf(stderr, "GC: 0x%llx pending. \n", (ull)ptr);
+ fprintf(stderr, "GC: 0x%llx pending. \n", (ull)ptr);
#endif
- pending_list = new PendingEntry(ptr, pending_list);
- }
+ pending_list = new PendingEntry(ptr, pending_list);
+ }
}
void GarbageCollector::force() {