Open salmanahmad opened 10 years ago
Another example is with actor thread migrations:
try({
actor.lockThread()
someJavaNativeCallThatDoesBlockingIO()
} finally {
actor.unlockThread()
})
Instead of embedding an interned string with the fully qualified name of the function, Can I just ignore it and carry on? The frames
array in the ExecutionContext
will hold data but it will just be overwritten eventually, wouldn't it?
If a resumed Fiber throws an exception that function that catches the exception will not have the local variables initialized correctly and will also not clear the relevant execution frames to prevent replaying the execution over and over again.
The first step is easy - inside all catch blocks I should emit code that re-sets the local variables if the
ExecutionContext
has a status ofTHROWING
(as opposed toRUNNING
orYIELDING
).The second step is much harder - how do I invalidate all of the ExecutionFrames? I need a mechanism that allows me to determine which ExecutionFrame belongs to the current function, find it, and then remove all ExecutionFrames on-top of it. One idea is to embed an interned string with the fully qualified name of the function. I then call a utility method that iterates through the ExecutionFrames in reverse and returns the first frame that matches the fully qualified name. It then "nulls" out the rest.