[GC cleanups
John Meacham <john@repetae.net>**20100327185913
 Ignore-this: a54268e31dc24ba007829a110bde67f5
] hunk ./src/data/rts/jhc_jgc.h 62
-// static inline void *
-// gc_alloc_tag(gc_t gc,size_t count, unsigned nptrs, int tag)
-// {
-//         void *ptr = gc_alloc(gc, TO_BLOCKS(count), 0);
-//         return ptr;
-// }
-
hunk ./src/data/rts/jhc_jgc.h 63
-gc_alloc_bytes(gc_t gc,size_t count)
-{
+gc_alloc_bytes(gc_t gc,size_t count) {
hunk ./src/data/rts/jhc_jgc.h 85
-static Pvoid_t gc_roots = NULL;
-static Pvoid_t gc_allocated = NULL;
-//static Pvoid_t gc_free = NULL;
-
-// we allow new malloced memory until this threshold is reached
-static size_t heap_threshold = 2048;
-
-// how much memory is currently in use
-static size_t mem_inuse;
+static Pvoid_t gc_roots = NULL;       // extra roots in addition to the stack
+static Pvoid_t gc_allocated = NULL;   // black set of currently allocated memory
+static size_t heap_threshold = 2048;  // threshold at which we want to run a gc rather than malloc more memory
+static size_t mem_inuse;              // amount of memory in use by gc'ed memory
+static unsigned number_gcs;           // number of garbage collections
+static unsigned number_allocs;        // number of allocations since last garbage collection
hunk ./src/data/rts/jhc_jgc.h 92
-unsigned number_gcs;
-unsigned number_allocs;
-
-
-// #define SHOULD_FOLLOW(w)  (w && !((uintptr_t)w & 0x3))
-// #define SHOULD_FOLLOW(w)  (IS_PTR(w) && ((w) < &_start || (w) >= &_end))
hunk ./src/data/rts/jhc_jgc.h 96
-        entry_header_t v;
-        void * _dummy;
+                entry_header_t v;
+                void * _dummy;
hunk ./src/data/rts/jhc_jgc.h 103
-bool
+static bool
hunk ./src/data/rts/jhc_jgc.h 110
-        } else {
+        } else 
hunk ./src/data/rts/jhc_jgc.h 112
-        }
hunk ./src/data/rts/jhc_jgc.h 114
-bool
+static bool
hunk ./src/data/rts/jhc_jgc.h 121
-        } else {
+        } else 
hunk ./src/data/rts/jhc_jgc.h 123
-        }
hunk ./src/data/rts/jhc_jgc.h 125
-void
+static void
hunk ./src/data/rts/jhc_jgc.h 131
-//        J1C(n_free,gc_free,0,-1);
hunk ./src/data/rts/jhc_jgc.h 134
-void
+static void
hunk ./src/data/rts/jhc_jgc.h 215
-
-//        Word_t w;
-        // add any contents of the old list free list to our new one
-//        for((J1F(r,gc_free,ix)); r; (J1N(r,gc_free,ix))) {
- //               int d; J1S(d,gc_allocated,ix);
- //       }
-//        J1FA(w,gc_free);
-//        gc_free = gc_allocated;
hunk ./src/data/rts/jhc_jgc.h 216
-
hunk ./src/data/rts/jhc_jgc.h 231
-void *
+static void *
hunk ./src/data/rts/jhc_jgc.h 257
-
-/*
-
-void *
-gc_alloc_tag(gc_t gc,unsigned count, unsigned nptrs, int tag)
-{
-        profile_push(&gc_alloc_time);
-        assert(nptrs <= count);
-        int r;
-        Word_t ix = 0;
-        bool retried = false;
-        size_t initial_mem = mem_inuse;
-retry:
-        for((J1F(r,gc_free,ix)); r; (J1N(r,gc_free,ix))) {
-                entry_t *e = (entry_t *)(ix * GC_BASE);
-                if(e->u.v.count == count) {
-                        debugf("Reusing space: %p %i %i %i\n",(void *)e,count,nptrs,tag);
-                        J1S(r,gc_allocated,ix);
-                        J1U(r,gc_free,ix);
-                        e->u.v.nptrs = nptrs;
-                        e->u.v.tag = tag;
-                        memset(e + 1,0,count*GC_BASE);
-                        profile_pop(&gc_alloc_time);
-                        return (void *)(e + 1);
-                } else {
-                        mem_inuse -= (e->u.v.count + 1)*GC_BASE;
-                        J1U(r,gc_free,ix);
-                        free(e);
-                }
-        }
-        // if we didn't free up
-        if(retried) {
-        if(mem_inuse > ((heap_threshold * 7) / 10)) {
-                heap_threshold *= 2;
-#if JGC_STATUS
-                fprintf(stderr, "Increasing heap threshold to %u bytes.\n", (unsigned) heap_threshold);
-        } else {
-                fprintf(stderr, "Freed %u bytes.\n", (unsigned) (initial_mem - mem_inuse));
-#endif
-        }
-        }
-        entry_t *e;
-        if(mem_inuse < heap_threshold && (e = malloc((count + 1)*GC_BASE))) {
-                mem_inuse += (count + 1)*GC_BASE;
-                e->u.v.count = count;
-                e->u.v.nptrs = nptrs;
-                e->u.v.tag = tag;
-                int r;
-                debugf("allocated: %p %i %i %i\n",(void *)e, count, nptrs, tag);
-                J1S(r,gc_allocated,(Word_t)e / GC_BASE);
-                profile_pop(&gc_alloc_time);
-                return (void *)(e + 1);
-        } else {
-                gc_perform_gc(gc);
-                retried = true;
-                goto retry;
-        }
-}
-
-*/