Implement the new Context API for the core API

Co-authored-by: ptitSeb <sebastien.chev@gmail.com>
This commit is contained in:
Amanieu d'Antras
2022-05-20 12:38:28 +01:00
committed by Manos Pitsidianakis
parent f16bd35d3c
commit 738a66f719
63 changed files with 2716 additions and 4821 deletions

View File

@@ -631,19 +631,6 @@ impl fmt::Debug for Function {
}
}
// This is needed for reference types
impl wasmer_types::WasmValueType for Function {
/// Write the value.
unsafe fn write_value_to(&self, _p: *mut i128) {
unimplemented!();
}
/// Read the value.
unsafe fn read_value_from(_store: &dyn std::any::Any, _p: *const i128) -> Self {
unimplemented!();
}
}
/// This private inner module contains the low-level implementation
/// for `Function` and its siblings.
mod inner {
@@ -655,8 +642,6 @@ mod inner {
use std::marker::PhantomData;
use std::panic::{self, AssertUnwindSafe};
#[cfg(feature = "experimental-reference-types-extern-ref")]
pub use wasmer_types::{ExternRef, VMExternRef};
use wasmer_types::{FunctionType, NativeWasmType, Type};
// use wasmer::{raise_user_trap, resume_panic};
@@ -749,18 +734,6 @@ mod inner {
f64 => f64
);
#[cfg(feature = "experimental-reference-types-extern-ref")]
unsafe impl FromToNativeWasmType for ExternRef {
type Native = VMExternRef;
fn to_native(self) -> Self::Native {
self.into()
}
fn from_native(n: Self::Native) -> Self {
n.into()
}
}
#[cfg(test)]
mod test_from_to_native_wasm_type {
use super::*;

View File

@@ -1,7 +1,6 @@
//! The import module contains the implementation data structures and helper functions used to
//! manipulate and access a wasm module's imports including memories, tables, globals, and
//! functions.
use crate::js::export::Export;
use crate::js::exports::{Exportable, Exports};
use crate::js::instance::InstantiationError;
use crate::js::module::Module;
@@ -302,7 +301,7 @@ macro_rules! import_namespace {
#[cfg(test)]
mod test {
use super::*;
use crate::js::export::Export;
use crate::js::exports::Exportable;
use crate::js::Type;
use crate::js::{Global, Store, Val};

View File

@@ -4,9 +4,11 @@ use crate::js::imports::Imports;
use crate::js::store::Store;
use crate::js::types::{ExportType, ImportType};
// use crate::js::InstantiationError;
use crate::js::error::CompileError;
#[cfg(feature = "wat")]
use crate::js::error::WasmError;
use crate::js::error::{CompileError, DeserializeError, SerializeError};
#[cfg(feature = "js-serializable-module")]
use crate::js::error::{DeserializeError, SerializeError};
use crate::js::RuntimeError;
use js_sys::{Reflect, Uint8Array, WebAssembly};
use std::fmt;

View File

@@ -16,7 +16,6 @@ use crate::js::types::param_from_js;
use js_sys::Array;
use std::iter::FromIterator;
use wasm_bindgen::JsValue;
use wasmer_types::NativeWasmType;
/// A WebAssembly function that can be called natively
/// (using the Native ABI).

View File

@@ -2,13 +2,10 @@ use crate::js::{externals::Memory, FromToNativeWasmType};
use crate::{MemoryAccessError, WasmRef, WasmSlice};
use std::convert::TryFrom;
use std::{fmt, marker::PhantomData, mem};
use wasmer_types::{NativeWasmType, ValueType};
pub use wasmer_types::MemorySize;
pub use wasmer_types::Memory32;
pub use wasmer_types::Memory64;
pub use wasmer_types::MemorySize;
use wasmer_types::ValueType;
/// Alias for `WasmPtr<T, Memory64>.
pub type WasmPtr64<T> = WasmPtr<T, Memory64>;