Conversation
|
Awesome, thanks! Once this is in the tests won't actually execute because I'm not generating the .wast files with |
|
"Env" sounds like a fairly non-temporary name. What are the future plans for this module? Env.abort: Is the existing Env.exit: I haven't thought about this deeply, but should we make this an instruction too? In a JS context, one can just call out to JS, have it throw an exception, and unwind all the wasm frames. However in a non-JS context, there isn't a way to say "unwind all the stack frames and exit" short of trapping, but that has the additional effect of indicating a failure of some kind. |
|
FWIW when we get a nice wasm libc that we all agree on (and our tests link to it) these will change names and be __syscall_abort and __syscall_exit or something like that. It'll be a simple rename from what @rossberg-chromium adds here. The libc won't be Standard since it'll all be user-space, but it'l be what we end up agreeing to use. |
|
If we know the names we want, let's just use those from the start. If we don't and want to defer making that decision, let's use sufficiently temporary-looking names so that we don't get confused. Env.abort: Is the existing unreachable instruction insufficient? Env.exit: I haven't thought about this deeply, but should we make this an instruction too? In a JS context, one can just call out to JS, have it throw an exception, and unwind all the wasm frames. However in a non-JS context, there isn't a way to say "unwind all the stack frames and exit" short of trapping, but that has the additional effect of indicating a failure of some kind. |
|
@sunfishcode, the point of this change isn't expressiveness, but to be able to run various tests from the waterfall, many of which try to import one of these functions. I don't care about the module name, although I actually agree that |
|
@rossberg-chromium So this is a hack to underpin another hack. There may be a motivation for this, but I will at least request that hacks be clearly labeled for what they are, because it's very confusing to have so many hacks mixed in with the real design when we're trying to work on the real design at the same time.
|
|
We already have |
|
@sunfishcode, @lukewagner, "builtins" mock a useful execution environment, they are not part of the spec. Naming needs to match the other relevant testing/execution environments, otherwise it's useless. The Eventually we should find policies for allocating names in the global namespace of modules, but is that a relevant concern right now? Should development block on it? We can easily adjust tests later. |
|
Agreed on it not being part of the spec... but how is that different than |
|
It's not a grab bag, it's mocking (a subset of) a concrete module that the libc tests on the waterfall import. It does not have any relation to |
|
Ah, I see the distinction now. Seems fine then. |
|
Putting it on "env" would collide with existing code, that sends exit or abort there, as e.g. asm2wasm does. I think |
|
"env" comes from binaryen: I don't really care what it is, but I think we're putting too much thought into something pretty simple. This isn't just for the waterfall, I want to run code in spec as well as d8 and other interpreters, and I've put off getting agreement on libc at other's prompting. |
|
The env there is for real imports arriving from the outside, though. And exit and abort will in fact be provided in a lot of existing code. Whereas this adds env.exit and abort to the actual spec, if I understand correctly? In other words, this moves a userspace issue into something to be standardized? That doesn't feel right. |
|
I'm fine with changing the name to whatever is decided upon, and adding support for it in binaryen. Just pick a name. |
|
@kripken, "builtins" are not part of the spec. Maybe the name is misleading. They are part of the |
|
Okay, I refactored the handling of imports to make it (a) more modular and configurable, (b) clearer that the actual modules provided by the host are custom. Renamed |
|
Perhaps it's worth documenting the distinction that the stuff in |
|
@kripken, done. PTAL |
|
lgtm, thanks. |
|
lgtm as well. |
| @@ -0,0 +1,39 @@ | |||
| open Values | |||
| open Types | |||
|
|
|||
There was a problem hiding this comment.
The name env is confusing to me. The name waterfalltest was suggested in this PR; I'd be ok with that.
There was a problem hiding this comment.
Also, please add a top-level comment to this file explaining what its purpose is. The text in the README.md is a good introduction, but we should be clear about what these various builtin modules are for.
There was a problem hiding this comment.
This isn't just for the waterfall.
There was a problem hiding this comment.
Running compiled code as a stopgap until we have agreement on what libc should look like. When we have an agreed libc we'll likely do something like syscalls, and abort/exit will be simple renames. libc still won't be "standard", but it'll be an ad-hoc thing we end up using.
I'll be testing this on the waterfall, but something that only works on the waterfall is a silly idea so I want to avoid silly.
There was a problem hiding this comment.
Please put this in a comment in the file then, so that we can all know what it is we're dealing with here.
Also, please rename the module to stopgap or something similarly descriptive.
There was a problem hiding this comment.
Added comments to spectest and env modules explaining their purpose. PTAL
@sunfishcode, as explained before, the env module emulates the respective module imported by Binaryen code. Renaming it here would defeat the purpose. Binaryen would have to decide that.
|
Thinking about this some more, I'm not sure of the scope plans here. This adds If there's a clear line that explains why |
|
@kripken same reasoning as for: We're waayyyyy over thinking things right now. |
|
I agree let's not overthink this. Just seems worth documenting "this is stuff specifically for the torture tests, and not intended to include any significant parts of libc", or something along those lines. I added some docs to binaryen now for that one hack we have. |
|
Okay, is anybody still opposed to landing this? |
|
"A subset of the Also, binaryen is changeable. We can rename things. "env" is a very generic name. I think we should rename this module, and teach Binaryen about the new name, to help avoid ending up making something which outlives its intended use, such after all this is, as JF says, a stopgap. |
|
Tweaked comment to express the purpose. Landing, but happy to keep this in sync with any name change Binaryen chooses to implement. |
Implement env.exit and env.abort
|
Why are you so unwilling to put what you're actually doing here in a comment in the file? |
This just adds a comment, using wording that JF used to explain what this file is for, in [this comment](#244 (comment)).
Clarify that the natural alignment is always the size of the loaded data. Resolves WebAssembly#230 and resolves and WebAssembly#162.
… everywhere. (WebAssembly#241) This addresses additional review comments to PR WebAssembly#222, that were made after it was merged. The last review comment in the discussion suggests to adjust all validation labels to use label types instead of just result types. Should address all occurrences of validation labels. Additionally adds a boolean catch_label to control frames in the validation algorithm, and some related functionality, fixing the cases for opcodes `catch` and `catch_all`. * Apply suggestions from code review Co-authored-by: Andreas Rossberg <rossberg@mpi-sws.org> Co-authored-by: Heejin Ahn <aheejin@gmail.com> * Reverting changes to typing of CAUGHTadm. Changes to this rule are now done in PR WebAssembly#244
* Fixes the typing rule of CAUGHTadm as suggested in: WebAssembly/exception-handling#229 (comment) * Applying suggestion from PR WebAssembly#241 https://github.com/WebAssembly/exception-handling/pull/241/files/201ff276be6c458e7a819662eb2862bd475f2fcd..f97c9d108a999c3c3fd30f25554a113822bed1b8#r1030097793 * Applied suggestions from code review, fixed notation, also adding the missing _n to CAUGHTadm. The subscript is introduced by the changes in PR WebAssembly#226
Should make the waterfall significantly happier.