-
Notifications
You must be signed in to change notification settings - Fork 256
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
Remove last remaining "process" dependencies #26
Comments
You're proposing removing |
proposing renaming to |
Why "store"? What does that mean in this context? Edit: followed the link on the op, I understand what "store" means here, but it's not a widely used word. Most people would use "instance" I think. |
it will be more widely used if we use it :) |
I think "instance" would be more clear than "store" unless there is some meaningful difference between them in this context. I'm very familiar with the sense of store used in the spec, but its still not the sense that would come to mind if I saw it in this context. |
"Instance" isn't what I was picturing here, because multiple (module) instances can be linked together and it'd be messy if one disappeared while others are still live. Using "store" would avoid that problem by ensuring that everything linked together is terminated together. |
I see what you mean, Dan. Still, the "store" keyword doesn't imply the right context to me, perhaps there's another word that'd be better? I'd like to hear other's thoughts. |
Maybe the problem is that the |
the wasm c api uses "store" as well: https://github.com/WebAssembly/wasm-c-api/blob/master/include/wasm.h |
Maybe I'm an outlier, but I don't really understand what "store" represents in the context of WebAssembly. The spec says
which is a bit vague. The thing is, you don't need to worry about "all" when you're trying to access the data you need, but when it's the thing you're about to delete, defining "all" becomes rather important. For instance, if you call
I think that reasoning is an artifact of thinking in terms of processes, where there are chunks of running code that are strongly decoupled from the outside world, have strong boundaries with each other and can be assumed to hold invariants within themselves. When these boundaries exist, then dropping everything inside them when an error occurs is a natural design path. Given the direction WASI+WASM is heading, I don't think these assumptions hold anymore, and |
It is called "store" in the WASM spec because the term is commonly found in the literature when describing the semantics of a language. http://matt.might.net/articles/cesk-machines/ is a pretty accessible example but there are tons of papers out there that use it. There are ways that The Module itself is a separate concept from the store, and there would be no interference between instances of the same module that do not share a store. |
I think @binji's comment points to underlying problem here -- thinking in terms of VM objects first. An alternative is to define Unwinding a program's threads back to their entrypoints and unregistering them from callbacks may imply that instances or perhaps even the whole store could be terminated under some circumstances, such as when the store only contains instances loaded for that program. (Some embeddings could still simply call the host There are still details to work out, but thinking in terms of unwinding threads and unregistering callbacks first feels like a better starting point. |
Yes, this is what I was getting at. What would unwinding a thread involve? Would it be equivalent to throwing an exception inside that thread, where you call destructors and |
Derived from ca26654f7747e2c9ce9d80d05c23a4ed48ec126c in https://github.com/alexcrichton/wat (PR #26)
Derived from ca26654f7747e2c9ce9d80d05c23a4ed48ec126c in https://github.com/alexcrichton/wat (PR #26)
Derived from ca26654f7747e2c9ce9d80d05c23a4ed48ec126c in https://github.com/alexcrichton/wat (PR #26)
* witx: add support for parsing multiple top-level witx files * tests: test parsing multiple top-level witx files * witx: add a multimodule test that rejects redefined names and rename the path to be a litle shorter * witx: add `CommentSyntax` and `Documented` parsers Derived from ca26654f7747e2c9ce9d80d05c23a4ed48ec126c in https://github.com/alexcrichton/wat (PR #26) * witx: Parse comments of top level definitions, render crude markdown * filter for doc comments, trim whitespace * some progress on doc comments. wip * more wip! * complete adding doc parsing to AST * bugfixes, use a subcommand to emit docs * witx: forgot to add docs to module. add docs to output for roundtrip testing * wasi documents: convert all comments to doc-comments sed -i -E "s/ ;; / ;;; /" **/*.witx sed -i -E "s/^;; /;;; /" **/*.witx * fix fd_advise doc comments to come before parameters * tests: try to narrow failure a bit * witx files: normalize leading whitespace in doc-comments this was stopping the roundtripping test from passing, since the whitespace in the AST is slightly different after a roundtrip. I am not feeling clever enough to think of an elegant solution now, so I'll just hack up these files to not hit the bug. * witx files: very top comment is not a doc
As an update here, |
@sunfishcode In that case, would throwing a specific |
@lachlansneff Yes, with unwinding in the language, WASI wouldn't necessarily need to define an |
Thank you @leonwanghui for pointing this out in WebAssembly#26
Hello @sunfishcode So, is the conclusion here that the semantics of The semantics of I'm currently working on WASI implementation of our wasm runtime and want to clarify the current semantics of |
I believe the instance should never be considered usable after a call to proc_exit. This is why Trap seems like a reasonable implementation. With WASI commands its very obvious because the instance gets thrown away on each call.. and there is no state maintained between calls. Remember that most calls to |
Thanks for your quick response, Sam!
Thanks for the clarification. So, |
WASI has no concept of a "process", and the current WASI Core has had most parts that depend on this concept removed already, but a few bits remain:
__WASI_CLOCK_PROCESS_CPUTIME_ID
,proc_exit
, andproc_raise
.For
proc_exit
and__WASI_CLOCK_PROCESS_CPUTIME_ID
, one option is to change them from "process" to "store". Implementations which don't wish to support__WASI_CLOCK_PROCESS_CPUTIME_ID
may return an error code from__wasi_clock_time_get
,__WASI_EINVAL
, instead.proc_raise
probably makes sense to remove regardless, since there is no other support for signal handling.For reference, in wasi-sysroot,
__WASI_CLOCK_PROCESS_CPUTIME_ID
is used in C functionsclock
(C standard),times
(POSIX), andgetrusage
(POSIX).The text was updated successfully, but these errors were encountered: