Skip to content

Commit

Permalink
Temporarily use the fix from wasmerio/wasmer#3400
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-F-Bryan committed Dec 1, 2022
1 parent b1c52e6 commit b392877
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 34 deletions.
54 changes: 34 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ wasmer-vfs = { version = "3.0.2", default-features = false, features = ["mem-fs"
[profile.release]
lto = true
opt-level = 'z'

[patch.crates-io]
wasmer = { git = "https://github.com/wasmerio/wasmer", default-features = false, features = ["js", "std"], branch = "fix-downcasting" }
wasmer-wasi = { git = "https://github.com/wasmerio/wasmer", default-features = false, features = ["js"], branch = "fix-downcasting" }
wasmer-vfs = { git = "https://github.com/wasmerio/wasmer", default-features = false, features = ["mem-fs"], branch = "fix-downcasting" }
5 changes: 5 additions & 0 deletions pkg/wasmer_wasi_js.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,18 @@ export class WASI {
*/
export class WasmerRuntimeError {
free(): void;
/**
* @returns {Symbol}
*/
static __wbgd_downcast_token(): Symbol;
}

export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly __wbg_wasmerruntimeerror_free: (a: number) => void;
readonly wasmerruntimeerror___wbgd_downcast_token: () => number;
readonly __wbg_memfs_free: (a: number) => void;
readonly memfs_new: (a: number) => void;
readonly memfs_from_js: (a: number, b: number) => void;
Expand Down
51 changes: 37 additions & 14 deletions pkg/wasmer_wasi_js.js
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,13 @@ export class WasmerRuntimeError {
const ptr = this.__destroy_into_raw();
wasm.__wbg_wasmerruntimeerror_free(ptr);
}
/**
* @returns {Symbol}
*/
static __wbgd_downcast_token() {
const ret = wasm.wasmerruntimeerror___wbgd_downcast_token();
return takeObject(ret);
}
}

async function load(module, imports) {
Expand Down Expand Up @@ -935,10 +942,6 @@ function getImports() {
const ret = module.require;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbindgen_is_function = function(arg0) {
const ret = typeof(getObject(arg0)) === 'function';
return ret;
};
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
const ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret);
Expand All @@ -964,6 +967,10 @@ function getImports() {
const ret = getObject(arg0)[arg1 >>> 0];
return addHeapObject(ret);
};
imports.wbg.__wbg_call_97ae9d8645dc388b = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg0).call(getObject(arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_self_6d479506f72c6a71 = function() { return handleError(function () {
const ret = self.self;
return addHeapObject(ret);
Expand All @@ -988,10 +995,6 @@ function getImports() {
const ret = new Function(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret);
};
imports.wbg.__wbg_call_97ae9d8645dc388b = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg0).call(getObject(arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_instanceof_Function_056d5b3aef8aaa85 = function(arg0) {
let result;
try {
Expand Down Expand Up @@ -1025,6 +1028,10 @@ function getImports() {
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_is_function = function(arg0) {
const ret = typeof(getObject(arg0)) === 'function';
return ret;
};
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
takeObject(arg0);
};
Expand Down Expand Up @@ -1091,6 +1098,10 @@ function getImports() {
imports.wbg.__wbindgen_rethrow = function(arg0) {
throw takeObject(arg0);
};
imports.wbg.__wbg_static_accessor_SYMBOL_45d4d15e3c4aeb33 = function() {
const ret = Symbol;
return addHeapObject(ret);
};
imports.wbg.__wbg_newwithbyteoffsetandlength_d9aa266703cb98be = function(arg0, arg1, arg2) {
const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
return addHeapObject(ret);
Expand All @@ -1117,24 +1128,28 @@ function getImports() {
const ret = WasmerRuntimeError.__wrap(arg0);
return addHeapObject(ret);
};
imports.wbg.__wbg_getPrototypeOf_ca7be35aca69033c = function(arg0) {
const ret = Object.getPrototypeOf(getObject(arg0));
imports.wbg.__wbg_getPrototypeOf_c046822345b14263 = function() { return handleError(function (arg0) {
const ret = Reflect.getPrototypeOf(getObject(arg0));
return addHeapObject(ret);
};
}, arguments) };
imports.wbg.__wbg_constructor_20fd216941fe9866 = function(arg0) {
const ret = getObject(arg0).constructor;
return addHeapObject(ret);
};
imports.wbg.__wbg_name_da379f055623f0d3 = function(arg0) {
const ret = getObject(arg0).name;
return addHeapObject(ret);
imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
const ret = getObject(arg0) === getObject(arg1);
return ret;
};
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
const obj = getObject(arg1);
const ret = typeof(obj) === 'number' ? obj : undefined;
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
};
imports.wbg.__wbindgen_is_symbol = function(arg0) {
const ret = typeof(getObject(arg0)) === 'symbol';
return ret;
};
imports.wbg.__wbg_new0_a57059d72c5b7aee = function() {
const ret = new Date();
return addHeapObject(ret);
Expand All @@ -1155,6 +1170,14 @@ function getImports() {
const ret = BigInt.asUintN(64, arg0);
return addHeapObject(ret);
};
imports.wbg.__wbg_getPrototypeOf_ca7be35aca69033c = function(arg0) {
const ret = Object.getPrototypeOf(getObject(arg0));
return addHeapObject(ret);
};
imports.wbg.__wbg_name_da379f055623f0d3 = function(arg0) {
const ret = getObject(arg0).name;
return addHeapObject(ret);
};
imports.wbg.__wbg_new_8d2af00bc1e329ee = function(arg0, arg1) {
const ret = new Error(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret);
Expand Down
Binary file modified pkg/wasmer_wasi_js_bg.wasm
Binary file not shown.
1 change: 1 addition & 0 deletions pkg/wasmer_wasi_js_bg.wasm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* eslint-disable */
export const memory: WebAssembly.Memory;
export function __wbg_wasmerruntimeerror_free(a: number): void;
export function wasmerruntimeerror___wbgd_downcast_token(): number;
export function __wbg_memfs_free(a: number): void;
export function memfs_new(a: number): void;
export function memfs_from_js(a: number, b: number): void;
Expand Down

0 comments on commit b392877

Please sign in to comment.