From 04910ab90de4e63d1bff73fbe77e7b0a074e56e3 Mon Sep 17 00:00:00 2001 From: John Sharratt's Shared Account Date: Thu, 18 Aug 2022 11:25:41 +1000 Subject: [PATCH] Added some fixes for javascipt --- lib/api/src/js/export.rs | 1 + lib/api/src/js/mod.rs | 6 ++++++ lib/api/src/js/module.rs | 1 + lib/api/src/js/native.rs | 1 - 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/api/src/js/export.rs b/lib/api/src/js/export.rs index f396e617c53..1ac317af9db 100644 --- a/lib/api/src/js/export.rs +++ b/lib/api/src/js/export.rs @@ -7,6 +7,7 @@ use std::fmt; use wasm_bindgen::{JsCast, JsValue}; use wasmer_types::{ExternType, FunctionType, GlobalType, MemoryType, TableType}; +/// Represents linear memory that is managed by the javascript runtime #[derive(Clone, Debug, PartialEq)] pub struct VMMemory { pub(crate) memory: Memory, diff --git a/lib/api/src/js/mod.rs b/lib/api/src/js/mod.rs index 14594839a15..a88509086e0 100644 --- a/lib/api/src/js/mod.rs +++ b/lib/api/src/js/mod.rs @@ -73,6 +73,12 @@ pub use crate::js::types::{ pub use crate::js::value::Value; pub use crate::js::value::Value as Val; +pub mod vm { + //! The `vm` module re-exports wasmer-vm types. + + pub use crate::js::export::VMMemory; +} + pub use wasmer_types::is_wasm; pub use wasmer_types::{ Bytes, ExportIndex, GlobalInit, LocalFunctionIndex, Pages, ValueType, WASM_MAX_PAGES, diff --git a/lib/api/src/js/module.rs b/lib/api/src/js/module.rs index 975d1bee5d5..529bb243bac 100644 --- a/lib/api/src/js/module.rs +++ b/lib/api/src/js/module.rs @@ -20,6 +20,7 @@ use wasmer_types::{ ExportsIterator, ExternType, FunctionType, GlobalType, ImportsIterator, MemoryType, Mutability, Pages, TableType, Type, }; +use tracing::{debug, warn}; #[derive(Debug)] #[cfg_attr(feature = "std", derive(Error))] diff --git a/lib/api/src/js/native.rs b/lib/api/src/js/native.rs index 0e9066edac8..69b350652a1 100644 --- a/lib/api/src/js/native.rs +++ b/lib/api/src/js/native.rs @@ -11,7 +11,6 @@ use std::marker::PhantomData; use crate::js::externals::Function; use crate::js::store::{AsStoreMut, AsStoreRef, StoreHandle}; -use crate::js::FunctionEnv; use crate::js::{FromToNativeWasmType, RuntimeError, WasmTypeList}; // use std::panic::{catch_unwind, AssertUnwindSafe}; use crate::js::export::VMFunction;