-
Notifications
You must be signed in to change notification settings - Fork 36
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
Consider removing tags from proposal #32
Comments
The primary purpose of exception tags in Wasm is not to distinguish different exceptions within the same language (although you can use them for that, too), it is to distinguish exceptions from different languages. Keep in mind that Wasm effectively is a multi-language environment, where calls and exceptions can potentially cross language boundaries in arbitrary ways. In such an environment a language implementation has to be able to reliably distinguish one of its own exceptions (and corresponding assumptions about associated data) from foreign ones. The only way to achieve that reliably in an uncooperative environment is through some generative naming mechanism. In other words, C++ is a current user, and must remain so! |
My understanding of the discussion on #31 and in-person discussions with @aheejin is that because C++ needs to ensure destructors run in the presence of all exceptions, and because LLVM does not distinguish cleanup code (i.e. the code that needs to run even in the presence of a non-C++ excpetion) from catch code, the current plan is to only generate |
Even then you will still need to distinguish based on the tag (i.e., some separate matching mechanism would be needed). |
I think the plan is to do something like having a global variable like |
How would that work? Your exception could fly through some other language's frame that catches it and throws one of its own. Where would you have a chance to clear your flag? |
@rossberg That's a good point... Then we are going to need instructions like If there are another use cases, I don't particularly insist on removing the current |
This thread has given us a strong argument in favor of keeping tags. I think it also strongly suggests that we need a way to dynamically inspect an exception. Since we've now considered removing tags and decided to keep them, I'm going to mark this issue as closed. |
I recently looked into adding support for bulk memory operations into some Rust tooling in preparation for an overall threading story, and on reading the overview here I was slightly confused about a few encodings and some semantics. In the end I'm hopeful that these updates can help clarify these for future readers! No major functional change is intended here, only tweaks to wording and clarification of what I believe the original intent of the instructions were. Changes made were: * Fixed a broken `modules.html` link * Clarified some wording about how the new encoding of data segments with a flags field up front is backwards compatible. * Lifted the style of specifying encodings in `BinaryEncoding.md` to replace the current table for the new encoding of a data section. (I found this to be a bit more readable, but it should be functionally the same!) * Update `memory.*` instructions (and transitively `table.*`) to all be succeeded by an immediate index of which memory/table to operate over. This should, in the future, allow initializing/dropping data segments with multiple memories in play. * Updated the chart of instruction binary encodings to explicitly specify the following immediates of segments and tables.
Recent discussions have revealed that the tag system we are currently proposing is not very useful for implementing exceptions in C++ via LLVM. While tools are certainly welcome to ignore tags entirely and use only
catch_all
, as #31 proposes, it seems that we should consider removing the tags portion of the proposal entirely.As far as I know, we currently have no languages that are planning to use tags. This means we could be in the unfortunate position of requiring more complexity on the part of WebAssembly implementations for a feature that is unused. It seems better not to require this in the first place.
From a design standpoint, I like tags, and I can definitely see how they could be useful to some languages. If there are languages actively planning to use these features, we should pull the implementors into the design process to make sure we come up with something that meets their needs.
If we do not have current users for tags, I suggest removing them from the proposal. Ideally we would do this in a way that leaves the door open for them if they are needed in the future.
The text was updated successfully, but these errors were encountered: