]> gitweb.factorcode.org Git - factor.git/blobdiff - vm/data_gc.h
Fix conflict from master
[factor.git] / vm / data_gc.h
index b59cb0eb9eeedf150c9ca9208815913a5c4f5e62..a1184d53d4ef07495eac115a2025a27a257b52ce 100755 (executable)
@@ -58,7 +58,7 @@ INLINE bool should_copy(CELL untagged)
                return true;
        else if(HAVE_AGING_P && collecting_gen == AGING)
                return !in_zone(&data_heap->generations[TENURED],untagged);
-       else if(HAVE_NURSERY_P && collecting_gen == NURSERY)
+       else if(collecting_gen == NURSERY)
                return in_zone(&nursery,untagged);
        else
        {
@@ -78,6 +78,11 @@ allocation (which does not call GC because of possible roots in volatile
 registers) does not run out of memory */
 #define ALLOT_BUFFER_ZONE 1024
 
+/* If this is defined, we GC every 100 allocations. This catches missing local roots */
+#ifdef GC_DEBUG
+int gc_count;
+#endif
+
 /*
  * It is up to the caller to fill in the object's fields in a meaningful
  * fashion!
@@ -85,10 +90,18 @@ registers) does not run out of memory */
 int count;
 INLINE void *allot_object(CELL type, CELL a)
 {
-  if(!gc_off) { if(count++ % 100 == 0) { printf("!\n"); gc(); } }
+#ifdef GC_DEBUG
+       if(!gc_off)
+       {
+               if(gc_count++ % 1000 == 0)
+                       gc();
+
+       }
+#endif
+
        CELL *object;
 
-       if(HAVE_NURSERY_P && nursery.size - ALLOT_BUFFER_ZONE > a)
+       if(nursery.size - ALLOT_BUFFER_ZONE > a)
        {
                /* If there is insufficient room, collect the nursery */
                if(nursery.here + ALLOT_BUFFER_ZONE + a > nursery.end)