Mercurial > repos > rhope
view testc.rhope @ 121:1af91ceaaf49
Fixed memory leak when an output is only attached to a single null input
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 28 Oct 2010 21:04:12 -0400 |
parents | 90c20dc3f4e5 |
children |
line wrap: on
line source
Import cbackend.rhope Main[] { prog <- C Program[] base <- [[[[[[[prog]Create Function["Fib",("n"),("out"),""] ]Allocate Var["work1", "Any Type"] ]Allocate Var["work2", "Any Type"] ]Null["out"] ]Method Call["<", [[()]Append[AddRef["n"]]]Append[AddRef[Constant["const_2"]]]] ]Move[Result[0], "work1"] ]Method Call["If", [()]Append["work1"]] {Print["base done"] } stream1 <- [[[base]Instruction Stream ]Release[Result[0]] ]Move[AddRef[Constant["const_1"]], "out"] {Print["stream1 done"]} stream3 <- [[[base]Instruction Stream ]Release["n"] ]Tail Method Call["+", ("work1","work2")] stream2 <- [[[[[[[[[[[base]Instruction Stream ]Release[Result[0]] ]Method Call["-", [[()]Append[AddRef["n"]]]Append[AddRef[Constant["const_1"]]]] ]Move[Result[0], "work1"] ]Method Call["-", [[()]Append[AddRef["n"]]]Append[AddRef[Constant["const_2"]]]] ]Move[Result[0], "work2"] ]Call["Fib", ("work1")] ]Move[Result[0], "work1"] ]Call["Fib", ("work2")] ]Move[Result[0], "work2"] ]Do If[NotCond["out"], stream3] {Print["stream2 done"]} func <- [[[base ]Do If[Result[0], stream1] ]Do If[Result[1], stream2] ]Release["n"] {Print["func done"] } Print[[[prog]Store Function[func]]Text] }