Interpret: Create a blackhole while evaluating a thunk

Bug #584875 reported by Matt Giuca
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mars
Triaged
Wishlist
Matt Giuca

Bug Description

Haskell's G-machine uses a "blackhole" [1] to avoid space leaks and detect certain forms of nontermination. We can do the same quite easily.

Before evaluating a thunk, extract the value from the localtable and replace it with a "blackhole" node (containing no data). This allows the garbage collector to collect anything referenced by the thunk, which it would otherwise be unable to collect. If you have to evaluate a blackhole, just raise an error, as it indicates infinite recursion in thunk evaluation.

[1] Jones, Richard. Tail Recursion Without Space Leaks
http://reference.kfupm.edu.sa/content/t/a/tail_recursion_without_space_leaks__1003476.pdf

Tags: interpreter
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.