[when updating a global caf, store an indirect as we might not have enough room for a full node
John Meacham <john@repetae.net>**20070227100400] hunk ./C/FromGrin2.hs 47
+--    wCAFS :: [Doc],
hunk ./C/FromGrin2.hs 82
+    --ans = vcat $ includes ++ [text "", enum_tag_t, header, text "/* CAFS */", vcat cafs,buildConstants finalHcHash, body]
hunk ./C/FromGrin2.hs 89
-    cafs = text "/* CAFS */" $$ (vcat $ map ccaf (grinCafs grin))
hunk ./C/FromGrin2.hs 91
+        --cs <- mapM doCAF (grinCafs grin)
+        --tell mempty { wCAFS = cs }
hunk ./C/FromGrin2.hs 101
+
+    cafs = text "/* CAFS */" $$ (vcat $ map ccaf (grinCafs grin))
+
hunk ./C/FromGrin2.hs 372
-convertExp (Update v@(Var vv _) (NodeC t as)) | getType v == TyPtr TyNode = do
+convertExp (Update v@(Var vv _) tn@(NodeC t as)) | getType v == TyPtr TyNode = do
hunk ./C/FromGrin2.hs 377
-    s <- if tagIsSuspFunction t then do
-        en <- declareEvalFunc t
-        return $ getTag tmp' =* f_EVALTAG (reference (variable en))
+    if not (tagIsSuspFunction t) && vv < v0 then do
+        (nns, nn) <- newNode tn
+        return (nns & getTag (f_NODEP(f_DETAG v')) =* nn,emptyExpression)
hunk ./C/FromGrin2.hs 381
-        declareStruct t
-        tell mempty { wTags = Set.singleton t }
-        return $ getTag tmp' =* constant (enum (nodeTagName t))
-    let ass = [project' (arg i) tmp' =* a | a <- as' | i <- [(1 :: Int) ..] ]
-    return (mconcat $ profile_update_inc:s:ass,emptyExpression)
+        s <- if tagIsSuspFunction t then do
+            en <- declareEvalFunc t
+            return $ getTag tmp' =* f_EVALTAG (reference (variable en))
+         else do
+            declareStruct t
+            tell mempty { wTags = Set.singleton t }
+            return $ getTag tmp' =* constant (enum (nodeTagName t))
+        let ass = [project' (arg i) tmp' =* a | a <- as' | i <- [(1 :: Int) ..] ]
+        return (mconcat $ profile_update_inc:s:ass,emptyExpression)
hunk ./C/FromGrin2.hs 393
-ccaf (v,val) = text "/* " <> text (show v) <> text " = " <> (text $ P.render (pprint val)) <> text "*/\n" <> text "static node_t _" <> tshow (varName v) <> text ";\n" <> text "#define " <> tshow (varName v) <+>  text "(EVALTAG(&_" <> tshow (varName v) <> text "))\n";
+ccaf (v,val) = text "/* " <> text (show v) <> text " = " <> (text $ P.render (pprint val)) <> text "*/\n" <>
+     text "static node_t _" <> tshow (varName v) <> text ";\n" <>
+     text "#define " <> tshow (varName v) <+>  text "(EVALTAG(&_" <> tshow (varName v) <> text "))\n";
hunk ./C/FromGrin2.hs 519
-        update =  functionCall (toName "update") [cast wptr_t (variable aname),rvar]
+        update =  f_update (cast wptr_t (variable aname)) rvar
hunk ./C/FromGrin2.hs 563
+f_NODEP e = functionCall (name "NODEP") [e]
hunk ./C/FromGrin2.hs 565
+f_update x y = functionCall (name "update") [x,y]
hunk ./C/FromGrin2.hs 682
+
+
hunk ./Grin/FromE.hs 630
-            v <- f ds x
-            return $ (e :>>= n1 :-> Store n1) :>>= toVal t :-> v
+            z <- newNodeVar
+            v <- localEvaled [t] z $ f ds x
+            return $ (e :>>= z :-> Store z) :>>= toVal t :-> v