Closed felixSchl closed 3 years ago
This was about as much time I could afford putting into this. It's pretty close and the TODO list above has been kept up-to-date. It would probably take another week or two to tow this across the line, not to mention updating libraries. If there's anyone who wants to take it up from here, I'd be happy to provide the necessary aid and assistance to familiarise you with the codebase and what needs to be done and so on. Otherwise expect slowing progress from here on out.
So I am updating the existing ported libraries for this PR and as was raised in #54 Control.Lazy
does indeed cause a retain cycle and unreleased memory. I wonder what the best way to deal with this is. It seems the same problem also exists for non-TCO-ed recursive functions, e.g.:
go 10 = 10
go n = n + go (n + 1)
I wonder if we could drop in a tracing GC similar to what they do here https://github.com/brian-carroll/elm_c_wasm just for tracking these scenarios? This is the deep end of the pool for me though :)
Depends on #59
Introduce reference counting in order to avoid having to rely on a tracing GC.
Checklist, in order of priority:
purs_cons_t
reference counted and implement a free function on itpurs_cons_t
foreign
member in thepurs_any_t
structurepurs_str_new
struct purs_scope
purs_cons_t
usagepurs_foreign_t
usage*_new
callspurs_any_unthunk
- release intermediate resultsreleaseResources
transform. The current implementation requires a ton of variables on the stack to ensure variables are not freed to early. Since dependencies between the variables is clearly visible, we should be able to re-use variables on the stack by releasing resources sooner (as soon as we know it's been retained by whatever ast node it was created for.) Clang/GCC compiler extension looks interesting: https://en.wikipedia.org/wiki/Resource_acquisition_is_initialization#Clang_and_GCC_%22cleanup%22_extension_for_Cfatal error: bracket nesting level exceeded maximum of 256
~ out of scope, see-fbracket-depth=