-
Notifications
You must be signed in to change notification settings - Fork 695
Trap versus embedder-specific error #1070
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Doesn't a trap lead to an embedder-specific error anyway? This becomes more interesting when WebAssembly gets something to cover try/catch functionality. Some currently-fatal errors like stack overflow become survivable. |
Yes, to clarify: Wasm cannot currently distinguish traps from other errors. Any such distinction is completely up to the API. The spec draft for now mirrors that: there is only "traps", and the above formulation merely (ab)uses the term "trap" as a generic means to express abortion of a running Wasm computation (since it's currently the only way to express that), leaving further details of its interpretation to the API spec. But I see how this may be misleading. The core spec should probably make a distinction somehow (essentially, by introducing a notion of "host error"), for the sake of easier API specification as well as possible future extensions for handling traps inside Wasm. |
The resolution here was that the "causing a trap" option was removed. The normative documentation is here, where it says "If the limits of an implementation are exceeded for a given module, then the implementation may reject the validation, compilation, or instantiation of that module with an embedder-specific error." |
Over in WebAssembly/spec#483 (comment) @rossberg-chromium and I discuss what should generate a trap versus an embedder-specific error.
AFAICT we currently generate traps for corner-cases of specific opcodes:
We allow generating embedder-specific errors when:
@rossberg-chromium's proposed text is:
Generating one or the other seems wrong to me: from my understanding of our design traps don't really fit that purpose.
So what's our approach to traps versus embedder-specific errors? We don't really have a clear approach.
The text was updated successfully, but these errors were encountered: