Skip to content
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

Update wasi usage to latest version: wasi_snapshot_preview1 #9956

Merged
merged 2 commits into from
Dec 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -388,7 +388,7 @@ jobs:
- run:
name: get wasmer
command: |
wget https://github.com/wasmerio/wasmer/releases/download/0.9.0/wasmer-linux-amd64.tar.gz
wget https://github.com/wasmerio/wasmer/releases/download/0.11.0/wasmer-linux-amd64.tar.gz
tar -xf wasmer-linux-amd64.tar.gz
mkdir ~/vms
cp bin/wasmer ~/vms
6 changes: 5 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
@@ -22,7 +22,11 @@ Current Trunk
disabled. There is no "Module.canvas" object, no magic "null" default handling,
and DOM element 'target' parameters are taken to refer to CSS selectors, instead
of referring to DOM IDs. For more information see:
https://groups.google.com/forum/#!msg/emscripten-discuss/xScZ_LRIByk/_gEy67utDgAJ
<https://groups.google.com/forum/#!msg/emscripten-discuss/xScZ_LRIByk/_gEy67utDgAJ>
- WASI API updated to from `wasi_unstable` to `wasi_snapshot_preview1` this
is mostly an implementation detail but if you use `WASI_STANDALONE` it means
that the output of emscripten now requires a runtime with
`wasi_snapshot_preview1` support.

v1.39.4: 12/03/2019
-------------------
2 changes: 1 addition & 1 deletion src/library_syscall.js
Original file line number Diff line number Diff line change
@@ -1852,7 +1852,7 @@ var WASI_SYSCALLS = set([
'fd_sync',
]);

// Fallback for cases where the wasi_unstable.name prefixing fails,
// Fallback for cases where the wasi_interface_version.name prefixing fails,
// and we have the full name from C. This happens in fastcomp which
// lacks the attribute to set the import module and base names.
if (!WASM_BACKEND) {
2 changes: 1 addition & 1 deletion src/library_wasi.js
Original file line number Diff line number Diff line change
@@ -91,7 +91,7 @@ var WasiLibrary = {
},
};

// Fallback for cases where the wasi_unstable.name prefixing fails,
// Fallback for cases where the wasi_interface_version.name prefixing fails,
// and we have the full name from C. This happens in fastcomp which
// lacks the attribute to set the import module and base names.
if (!WASM_BACKEND) {
2 changes: 1 addition & 1 deletion src/preamble.js
Original file line number Diff line number Diff line change
@@ -933,7 +933,7 @@ function createWasm() {
// prepare imports
var info = {
'env': asmLibraryArg,
'wasi_unstable': asmLibraryArg
'{{{ WASI_MODULE_NAME }}}': asmLibraryArg
#if WASM_BACKEND == 0
,
'global': {
2 changes: 1 addition & 1 deletion src/settings.js
Original file line number Diff line number Diff line change
@@ -593,7 +593,7 @@ var ASYNCIFY_IMPORTS = [
'emscripten_idb_store', 'emscripten_idb_delete', 'emscripten_idb_exists',
'emscripten_idb_load_blob', 'emscripten_idb_store_blob', 'SDL_Delay',
'emscripten_scan_registers', 'emscripten_lazy_load_code',
'wasi_unstable.fd_sync', '__wasi_fd_sync',
'wasi_snapshot_preview1.fd_sync', '__wasi_fd_sync',
];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about defining var WASI_MODULE = "wasi_snapshot_preview1"; in this file, and then it can be added programattically here WASI_MODULE + '.fd_sync'.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm.. I don't really want to make it setting that can be controlled because there different ABIs are not compatible. I'll see if I can make it global somewhere else outside of settings..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option is to define it once in JS in say modules.js, and once in python in shared.py. However, I think it makes sense as an "internal setting"?


// Whether indirect calls can be on the stack during an unwind/rewind.
2 changes: 2 additions & 0 deletions src/settings_internal.js
Original file line number Diff line number Diff line change
@@ -81,3 +81,5 @@ var IMPLEMENTED_FUNCTIONS = [];

// Name of the file containing the Fetch *.fetch.js, if relevant
var FETCH_WORKER_FILE = '';

var WASI_MODULE_NAME = "wasi_snapshot_preview1";
2 changes: 1 addition & 1 deletion src/struct_info.json
Original file line number Diff line number Diff line change
@@ -1576,7 +1576,7 @@
]
},
{
"file": "wasi/wasi.h",
"file": "wasi/api.h",
"structs": {
"__wasi_fdstat_t": [
"fs_filetype",
2 changes: 1 addition & 1 deletion src/support.js
Original file line number Diff line number Diff line change
@@ -534,7 +534,7 @@ function loadWebAssemblyModule(binary, flags) {
},
'global.Math': Math,
env: proxy,
wasi_unstable: proxy,
{{{ WASI_MODULE_NAME }}}: proxy,
'asm2wasm': asm2wasmImports
};
#if ASSERTIONS
2 changes: 1 addition & 1 deletion system/include/libc/fcntl.h
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
#define _FCNTL_H

#ifdef __EMSCRIPTEN__
#include <wasi/wasi.h>
#include <wasi/api.h>
#endif

#ifdef __cplusplus
2 changes: 1 addition & 1 deletion system/include/libc/stdio.h
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
#define _STDIO_H

#ifdef __EMSCRIPTEN__
#include <wasi/wasi.h>
#include <wasi/api.h>
#endif

#ifdef __cplusplus
2 changes: 1 addition & 1 deletion system/include/libc/unistd.h
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
#define _UNISTD_H

#ifdef __EMSCRIPTEN__
#include <wasi/wasi.h>
#include <wasi/api.h>
#endif

#ifdef __cplusplus
Loading