diff options
author | Teddy <ted.sybil@gmail.com> | 2013-08-15 11:04:57 +0800 |
---|---|---|
committer | Teddy <ted.sybil@gmail.com> | 2013-08-15 11:04:57 +0800 |
commit | 9f9bd0ee34422aceb9725276292a66b0e7934c6a (patch) | |
tree | 4e9044237f3b7004b3b8598fe2c53546ab29dc25 /gc.cpp | |
parent | 06d014cb0e95f92945ea01610fd1c52a1b087502 (diff) |
tail-rec for `if` and `and`
Diffstat (limited to 'gc.cpp')
-rw-r--r-- | gc.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -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() { |