Closed yamt closed 1 month ago
Yes, see this part of the spec: https://webassembly.github.io/gc/core/appendix/implementation.html#execution
If the runtime limits of an implementation are exceeded during execution of a computation, then it may terminate that computation and report an embedder-specific error to the invoking code.
"terminate that computation" effectively means a trap, although the error returned to the embedder may or may not be different from the error for a trap.
"Terminate the computation" can mean other means. It's intentionally vague, since it depends on implementation and host environment how reliable they can still operate at such a point. For example, if the embedder is JavaScript and Wasm runs out of memory to allocate, then running more JavaScript will most likely not be possible either. Hence a catchable trap might not be an option.
Closing this as answered, but feel free to reopen if there are follow-on questions.
a naive implementation of things like
struct.new
would involve dynamic memory allocation. eg. malloc in C. when it fails, what should happen? a trap?