-
Notifications
You must be signed in to change notification settings - Fork 18
Unhandled suspension in embedding API #95
Description
Some offline discussion turned up the issue of how to represent unhandled suspensions in the embedder API. Let's use this issue to discuss.
AFAICT an unhandled suspension is a pair of (something like) an exnref and a contref. An exnref is itself a pair of a tag and a payload, i.e. a vector of values. Tags in stack-switching add results, but I think they are only relevant for the static typing of handlers in the bytecode.
@rossberg had brought up the concept of a "meta-continuation". My understanding that that is basically a contref that could/should be resumable via the embedding API.
I think contref is pretty similar to a funcref from the embedder's perspective; invoking it is a meta-level operation which is dynamically-typed. The only differences I can see are:
contrefdoesn't fit under theanyheaptype hierarchy, so it should fail any dynamically-typed embedder operations that take ananyref,contrefsupports, or should supportcont.bind, if we have that embedder operation,- invoking a
contrefcould suspend (but I think invoking afuncrefcan also suspend), and - it may be represented differently, since it could be a continuation object or a pair of a version+stack resource.