Replies: 1 comment
|
One simplification that might help here is to change the Muhcu et al approach slightly: Edit: here's a link to the implementation, along with the class hierarchy. It used an array to store the segments value, which allows for very fast invalidation and revalidation. It doesn't have the FIFO revalidation yet, but it has (non-effectful) finalizer frames, which are sufficient to have local mutable state. My code is very reminiscent of Effekt's JS backend, likely because both have some roots in Java Effekt. |
Uh oh!
There was an error while loading. Please reload this page.
I'm wondering if any work has been done on combining the Muhcu et al approach to local mutable state (which, to my understanding, is the approach used in the LLVM backend) with the Voigt et al implementation of Dynamic Wind (i.e.
onSuspendandonResumeclauses).For one, I think it's okay to ignore finalizers when doing a one-shot resumption, at least for now.
It seems really easy to support
onSuspendby modifyinginvalidateto pause when encountering a finaliser, storing the rest of the segment that it needs to invalidate in some newunwindframe. This works nicely becauseinvalidateworks from the top of the stack, all the way to the prompt, thus it's executingonSuspendclauses in LIFO order, which are the desired semantics.I can't imagine a simple implementation of
onResumewhile keeping the same semantics.revalidateworks on the segment from the top of the segment to its bottom, meaning thatonResumeclauses are discovered in LIFO order (and the revalidation, in general, goes in LIFO order). This is bad because, then, it can't have the necessaryresumeframe.This reminds me of Java-Effekt, whose implementation had
Segments that went in the opposite order from the stack, thus it would visit frames in FIFO order, which is what we need here.All reactions