[fix GC bugs so garbage collection works
John Meacham <john@repetae.net>**20100327005713
 Ignore-this: 4f0b2cc940c1e6223b56276aee18d3f5
] hunk ./src/C/FromGrin2.hs 855
-        addroot =  if  fopts FO.Jgc then f_gc_add_root rvar else emptyExpression
+        addroot =  if isCAF && fopts FO.Jgc then f_gc_add_root rvar else emptyExpression
hunk ./src/C/FromGrin2.hs 892
-jhc_malloc_ptrs sz | fopts FO.Jgc =  functionCall (name "gc_alloc") [v_gc,tbsize sz, tbsize sz]
+jhc_malloc_ptrs sz | fopts FO.Jgc =  functionCall (name "gc_alloc_tag") [v_gc,tbsize sz, tbsize sz, toExpression False]
hunk ./src/Grin/Devolve.hs 115
+    f x | fopts FO.Jgc && isUsing x && isAllocing x = do
+        roots <- asks envRoots
+        let nroots = Set.fromList [ Var v t | (v,t) <- Set.toList (freeVars x), isNode t, v > v0] Set.\\ roots
+        local (\e -> e { envRoots = envRoots e `Set.union` nroots}) $ do
+            ne <- mapExpVal twiddleVal x
+            return $ gcRoots (Set.toList nroots) ne
hunk ./src/Grin/Devolve.hs 128
+    isAllocing (BaseOp Eval {} _) = True
hunk ./src/data/rts/jhc_jgc.h 10
+#define JGC_STATUS 1
+
hunk ./src/data/rts/jhc_jgc.h 31
-#define GC_MINIMUM_SIZE 2
+#define GC_MINIMUM_SIZE 1
hunk ./src/data/rts/jhc_jgc.h 48
+#define FOOF 0xF00DF00FACEBAFFUL
hunk ./src/data/rts/jhc_jgc.h 78
-#if 1
+#if 0
hunk ./src/data/rts/jhc_jgc.h 214
+#if JGC_STATUS
hunk ./src/data/rts/jhc_jgc.h 216
+#endif
+#if 0
+        for((J1F(r,gc_free,ix)); r; (J1N(r,gc_free,ix))) {
+                entry_t *e = (entry_t *)(ix * GC_BASE);
+                mem_inuse -= (e->u.v.count + 1)*GC_BASE;
+                J1U(r,gc_free,ix);
+                free(e);
+        }
+#endif
hunk ./src/data/rts/jhc_jgc.h 260
+#if JGC_STATUS
hunk ./src/data/rts/jhc_jgc.h 264
+#endif