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:
contref doesn't fit under the any heaptype hierarchy, so it should fail any dynamically-typed embedder operations that take an anyref,
contref supports, or should support cont.bind, if we have that embedder operation,
- invoking a
contref could suspend (but I think invoking a funcref can also suspend), and
- it may be represented differently, since it could be a continuation object or a pair of a version+stack resource.