Conversation
| command: | | ||
| curl https://get.wasmer.io -sSfL | sh | ||
| mkdir ~/vms | ||
| cp ~/.wasmer/bin/wasmer ~/vms |
There was a problem hiding this comment.
How about just ln -s ~/.wasmer/bin/wasmer ~/vms/. Binaries don't always work standalone when you move them like this.
There was a problem hiding this comment.
(I responded to this earlier, as it's under the general topic of why having a vms/ dir is useful.)
| wget https://github.com/CraneStation/wasmtime/releases/download/dev/wasmtime-dev-x86_64-linux.tar.xz | ||
| tar -xf wasmtime-dev-x86_64-linux.tar.xz | ||
| cp wasmtime-dev-x86_64-linux/wasmtime ~/ | ||
| cp wasmtime-dev-x86_64-linux/wasmtime ~/vms |
There was a problem hiding this comment.
ln -s wasmtime-dev-x86_64-linux/wasmtime ~/vms/.
| echo "V8_ENGINE = '`pwd`/upstream/bin/d8'" >> ~/.emscripten | ||
| echo "JS_ENGINES = [NODE_JS, V8_ENGINE]" >> ~/.emscripten | ||
| echo "WASM_ENGINES = []" >> ~/.emscripten | ||
| test -f ~/vms/wasmtime && echo "WASMTIME = os.path.expanduser(os.path.join('~', 'vms', 'wasmtime')) ; WASM_ENGINES.append(WASMTIME)" >> ~/.emscripten || true |
There was a problem hiding this comment.
If ~/.wasmer/bin is the default location why not just hardcode that here?
Same with wasmtime-dev-x86_64-linux/wasmtime.. why copy them around?
There was a problem hiding this comment.
I thought it might be nice to have a vms/ directory. Just one place we need to care about, and also we can avoid persisting to the CircleCI image anything but the necessary files.
| command_flags += ['run'] | ||
| if is_wasmer or is_wasmtime: | ||
| # in a wasm runtime, run the wasm, not the js | ||
| filename = filename[:-3] + '.wasm' |
There was a problem hiding this comment.
So we are still geneating the .js file in all cases? But then running the wasm on its own at this late stage?
I'd kind of rather push this logic back in the do_run method of the test runner, but I'm OK with cleaning this up later if you prefer?
There was a problem hiding this comment.
We still build js+wasm normally. We then test the js, and separately also test the wasm without the js. Basically, when we ask to run the app in a js vm we run the js, and in wasm vm the wasm.
I actually think this makes sense to do here. This way we can call run from anywhere, and if the vm we run in happens to be a wasm vm, it will just work. That may be useful in other, browser, etc. eventually, and not just in do_run which is mainly for core.
| # JS_ENGINES = [NODE_JS] # add V8_ENGINE or SPIDERMONKEY_ENGINE if you have them installed too. | ||
| # | ||
| # WASMER = os.path.expanduser(os.path.join('~', '.wasmer', 'bin', 'wasmer')) | ||
| # WASMTIME = os.path.expanduser(os.path.join('~', 'wasmtime')) |
There was a problem hiding this comment.
Do we need these two variables? Can we just add WASM_ENGINES and be done with it? It looks like we are detecting that type of the engine based on the filename anyway in jsrun.py
There was a problem hiding this comment.
This basically just parallels the above code for SPIDERMONKEY_ENGINE and V8_ENGINE.
I think it makes sense there, and here, because we do need to know the identities of these engines. For example, v8 requires -- before the program args, and wasmer requires run before the wasm name.
| 'JAVA', | ||
| 'JS_ENGINES', | ||
| 'WASMER', | ||
| 'WASMTIME', |
There was a problem hiding this comment.
I don't think these two are referenced anywhere.
There was a problem hiding this comment.
I think they could be used in jsrun, so
is_wasmer = 'wasmer' in jsengine
=>
is_wasmer = engine == shared.WASMER
The only reason I didn't do that is the JS engine detection doesn't work that way. But I could refactor them all that way, what do you think?
Also, some tests eventually may only run in wasmer etc., like we have tests that only run in NODE_JS etc., so having the variable is useful I think.
|
|
||
| # EM_CONFIG stuff | ||
| if JS_ENGINES is None: | ||
| JS_ENGINES = [NODE_JS] |
There was a problem hiding this comment.
You don't like defaulting to running the tests in NODE_JS?
These two lines allow normal users to avoid having JS_ENGINES in their config files, and still be able to run tests.
There was a problem hiding this comment.
Oh, I think this is just dead code. Earlier in the file we have
JS_ENGINES = []
[...]
JS_ENGINES = [listify(engine) for engine in JS_ENGINES]
so it could never be None AFAICT.
|
Could I be a pain and ask you to wrap you commit messages at 80 chars? I know this might seem silly/trivial but it makes |
|
About git commit messages, I usually copy-paste what is in the github description here... which is not wrapped. Sounds like I'd need to use a tool to wrap it? (is there an easy one?) |
|
Can you talk about the long-term vision here? Do you expect Emscripten's JS APIs will be desirable as an important foundation for the non-Web wasm ecosystem? Or do you expect Emscripten will grow to support more of WASI and ultimately be an alternative to wasi-sdk? |
|
I think the goal is the latter. For low level APIs like filesystem it I think it makes sense for emscripten and WASI to agree wherever possible. The short term goal is for emscripten binaries that don't use any weby stuff to be WASI compliant. So yes, emscripten would be an alternative to wasi-sdk for such users. Using emscripten might be overkill for some such users, but for those that also want to run on the web it might be useful because of the JS runtime support that comes built-in. |
Right but the github description is populated by you git commits initially isn't it? If you prefer to type But configuring the editor you use for |
|
@sbc100 I often rewrite the text in the github web UI here to improve it. Seems like I'd need to change what I do, but I'll try to find a convenient way. |
Yes - we'd like to support standard APIs like wasi where possible, and where there is no downside. (An example of a downside is wasi may provide a "get the time" API, but on the Web it may be better to use an existing API; this is also why we avoid using musl's time code.)
I wouldn't put it like that - each will be better at certain things - but I guess the question is "alternative for what use case"? Here's how I see it: There are 3 "big" use cases for wasm,
(there's also blockchain and others of course) For the Web, Emscripten wants to emit Web API calls. We'll use wasi where possible though, just to have fewer "oddities", as mentioned earlier. For the server, wasi APIs makes the most sense obviously. As Emscripten emits more wasi calls, perhaps it can be useful here too. For the custom embedding case, wasi is a good basis, but each embedding will add its own extra stuff, either because wasi doesn't support them yet, or because it just needs custom things - say an image manipulation program that uses wasm plugins would need different things than an audio editor (each will probably have imports/exports to run the plugin on an image/audio, but the parameters etc. would vary widely). But basic stuff like printing may as well use wasi, and that's a big main reason I think emscripten should support wasi. Overall, custom embeddings have the option to add support for nonstandard stuff that they need, like their own APIs, or emscripten APIs, or other stuff if that's useful. Emscripten's
Overall, probably not. But non-Web is pretty wide, so as mentioned earlier, custom embeddings may support some stuff. But I don't have a prediction about this being widespread or not. |
Since we are guaranteed that `NODE_JS` is part of the config (since all users need this) we can set a sensible default for `JS_ENGINES`. This default was supposed to be part of #9469, but a bug meant the code was dead and it was removed in #9499. `JS_ENGINES` is needed for any users that want to run test code. Fix `gen_struct_info.py` to explicitly use NODE_JS since this is the only engine we expect users to have installed and the only one we officially support outside of test code.
Since we are guaranteed that `NODE_JS` is part of the config (since all users need this) we can set a sensible default for `JS_ENGINES`. This default was supposed to be part of #9469, but a bug meant the code was dead and it was removed in #9499. `JS_ENGINES` is needed for any users that want to run test code. Fix `gen_struct_info.py` to explicitly use NODE_JS since this is the only engine we expect users to have installed and the only one we officially support outside of test code.
Since we are guaranteed that `NODE_JS` is part of the config (since all users need this) we can set a sensible default for `JS_ENGINES`. This default was supposed to be part of #9469, but a bug meant the code was dead and it was removed in #9499. `JS_ENGINES` is needed for any users that want to run test code.
) The initial landing of STANDALONE_WASM support had testing, but it was pretty hackish, just enough to get us going. This adds more proper support. This defines WASM_ENGINES in the settings file, parallel to JS_ENGINES. Adds support for running in those runtimes - in particular, we run the wasm and not the JS. Adds also_with_standalone_wasm to core, which allows us to add files to be tested in this mode. So far I added two tests. Ignore temp file leaks on /tmp/wasmer/ as it appears to add a bunch of temp files there sometimes.
Since we are guaranteed that `NODE_JS` is part of the config (since all users need this) we can set a sensible default for `JS_ENGINES`. This default was supposed to be part of emscripten-core#9469, but a bug meant the code was dead and it was removed in emscripten-core#9499. `JS_ENGINES` is needed for any users that want to run test code.
The initial landing of
STANDALONE_WASMsupport had testing, but it was pretty hackish, just enough to get us going. This adds more proper support.This defines
WASM_ENGINESin the settings file, parallel toJS_ENGINES. Adds support for running in those runtimes - in particular, we run the wasm and not the JS.Adds
also_with_standalone_wasmtocore, which allows us to add files to be tested in this mode. So far I added two tests.Ignore temp file leaks on
/tmp/wasmer/as it appears to add a bunch of temp files there sometimes.