Remove wasmer-{artifact,engine} and merge it into wasmer-compiler and wasmer-vm

This commit is contained in:
Manos Pitsidianakis
2022-06-13 12:39:45 +03:00
parent 8f539d134b
commit a6173f9746
61 changed files with 136 additions and 776 deletions

View File

@@ -22,7 +22,6 @@ edition = "2018"
# Shared dependencies.
[dependencies]
# - Mandatory shared dependencies.
wasmer-artifact = { path = "../artifact", version = "=2.3.0" }
indexmap = { version = "1.6", features = ["serde-1"] }
cfg-if = "1.0"
thiserror = "1.0"
@@ -36,7 +35,6 @@ wat = { version = "1.0", optional = true }
wasmer-vm = { path = "../vm", version = "=2.3.0" }
wasmer-compiler = { path = "../compiler", version = "=2.3.0" }
wasmer-derive = { path = "../derive", version = "=2.3.0" }
wasmer-engine = { path = "../engine", version = "=2.3.0" }
wasmer-types = { path = "../types", version = "=2.3.0" }
target-lexicon = { version = "0.12.2", default-features = false }
# - Optional dependencies for `sys`.

View File

@@ -90,7 +90,7 @@ pub enum WasmError {
/// The Serialize error can occur when serializing a
/// compiled Module into a binary.
/// Copied from wasmer_engine::SerializeError
/// Copied from wasmer_compiler::SerializeError
#[derive(Debug)]
#[cfg_attr(feature = "std", derive(Error))]
pub enum SerializeError {
@@ -104,7 +104,7 @@ pub enum SerializeError {
/// The Deserialize error can occur when loading a
/// compiled Module from a binary.
/// Copied from wasmer_engine::DeSerializeError
/// Copied from wasmer_compiler::DeSerializeError
#[derive(Error, Debug)]
pub enum DeserializeError {
/// An IO error

View File

@@ -44,7 +44,7 @@ impl Extern {
}
}
/// Create an `Extern` from an `wasmer_engine::Export`.
/// Create an `Extern` from an `wasmer_compiler::Export`.
pub fn from_vm_export(store: &Store, export: Export) -> Self {
match export {
Export::Function(f) => Self::Function(Function::from_vm_export(store, f)),

View File

@@ -53,7 +53,7 @@ impl RuntimeError {
///
/// # Example
/// ```
/// let trap = wasmer_engine::RuntimeError::new("unexpected error");
/// let trap = wasmer_compiler::RuntimeError::new("unexpected error");
/// assert_eq!("unexpected error", trap.message());
/// ```
pub fn new<I: Into<String>>(message: I) -> Self {

View File

@@ -5,7 +5,7 @@ use indexmap::IndexMap;
use std::fmt;
use std::iter::{ExactSizeIterator, FromIterator};
use thiserror::Error;
use wasmer_engine::Export;
use wasmer_compiler::Export;
/// The `ExportError` can happen when trying to get a specific
/// export [`Extern`] from the [`Instance`] exports.

View File

@@ -12,7 +12,7 @@ use std::cmp::max;
use std::ffi::c_void;
use std::fmt;
use std::sync::Arc;
use wasmer_engine::{Export, ExportFunction, ExportFunctionMetadata};
use wasmer_compiler::{Export, ExportFunction, ExportFunctionMetadata};
use wasmer_vm::{
on_host_stack, raise_user_trap, resume_panic, wasmer_call_trampoline, ImportInitializerFuncPtr,
VMCallerCheckedAnyfunc, VMDynamicFunctionContext, VMFuncRef, VMFunction, VMFunctionBody,

View File

@@ -7,7 +7,7 @@ use crate::sys::Mutability;
use crate::sys::RuntimeError;
use std::fmt;
use std::sync::Arc;
use wasmer_engine::Export;
use wasmer_compiler::Export;
use wasmer_vm::{Global as RuntimeGlobal, VMGlobal};
/// A WebAssembly `global` instance.

View File

@@ -8,7 +8,7 @@ use std::mem;
use std::mem::MaybeUninit;
use std::slice;
use std::sync::Arc;
use wasmer_engine::Export;
use wasmer_compiler::Export;
use wasmer_types::Pages;
use wasmer_vm::{MemoryError, VMMemory};

View File

@@ -15,7 +15,7 @@ use crate::sys::exports::{ExportError, Exportable};
use crate::sys::store::{Store, StoreObject};
use crate::sys::ExternType;
use std::fmt;
use wasmer_engine::Export;
use wasmer_compiler::Export;
/// An `Extern` is the runtime representation of an entity that
/// can be imported or exported.
@@ -44,7 +44,7 @@ impl Extern {
}
}
/// Create an `Extern` from an `wasmer_engine::Export`.
/// Create an `Extern` from an `wasmer_compiler::Export`.
pub fn from_vm_export(store: &Store, export: Export) -> Self {
match export {
Export::Function(f) => Self::Function(Function::from_vm_export(store, f)),

View File

@@ -5,7 +5,7 @@ use crate::sys::types::{Val, ValFuncRef};
use crate::sys::RuntimeError;
use crate::sys::TableType;
use std::sync::Arc;
use wasmer_engine::Export;
use wasmer_compiler::Export;
use wasmer_vm::{Table as RuntimeTable, TableElement, VMTable};
/// A WebAssembly `table` instance.

View File

@@ -4,7 +4,7 @@
use crate::{Exports, Extern, Module};
use std::collections::HashMap;
use std::fmt;
use wasmer_engine::LinkError;
use wasmer_compiler::LinkError;
use wasmer_types::ImportError;
/// All of the import data used when instantiating.

View File

@@ -69,12 +69,12 @@ pub enum InstantiationError {
HostEnvInitialization(HostEnvInitError),
}
impl From<wasmer_engine::InstantiationError> for InstantiationError {
fn from(other: wasmer_engine::InstantiationError) -> Self {
impl From<wasmer_compiler::InstantiationError> for InstantiationError {
fn from(other: wasmer_compiler::InstantiationError) -> Self {
match other {
wasmer_engine::InstantiationError::Link(e) => Self::Link(e),
wasmer_engine::InstantiationError::Start(e) => Self::Start(e),
wasmer_engine::InstantiationError::CpuFeature(e) => Self::CpuFeature(e),
wasmer_compiler::InstantiationError::Link(e) => Self::Link(e),
wasmer_compiler::InstantiationError::Start(e) => Self::Start(e),
wasmer_compiler::InstantiationError::CpuFeature(e) => Self::CpuFeature(e),
}
}
}

View File

@@ -50,9 +50,10 @@ pub use target_lexicon::{Architecture, CallingConvention, OperatingSystem, Tripl
pub use wasmer_compiler::{
wasmparser, CompilerConfig, FunctionMiddleware, MiddlewareReaderState, ModuleMiddleware,
};
pub use wasmer_compiler::{CpuFeature, Features, Target};
pub use wasmer_compiler::{
CpuFeature, Engine, Export, Features, FrameInfo, LinkError, RuntimeError, Target, Tunables,
};
pub use wasmer_derive::ValueType;
pub use wasmer_engine::{Engine, Export, FrameInfo, LinkError, RuntimeError, Tunables};
pub use wasmer_types::is_wasm;
#[cfg(feature = "experimental-reference-types-extern-ref")]
pub use wasmer_types::ExternRef;

View File

@@ -7,7 +7,7 @@ use std::io;
use std::path::Path;
use std::sync::Arc;
use thiserror::Error;
use wasmer_engine::Artifact;
use wasmer_compiler::Artifact;
#[cfg(feature = "wat")]
use wasmer_types::WasmError;
use wasmer_types::{

View File

@@ -12,7 +12,7 @@ use std::marker::PhantomData;
use crate::sys::externals::function::{DynamicFunction, VMDynamicFunction};
use crate::sys::{FromToNativeWasmType, Function, RuntimeError, Store, WasmTypeList};
use std::panic::{catch_unwind, AssertUnwindSafe};
use wasmer_engine::ExportFunction;
use wasmer_compiler::ExportFunction;
use wasmer_types::NativeWasmType;
use wasmer_vm::{VMDynamicFunctionContext, VMFunctionBody, VMFunctionEnvironment, VMFunctionKind};

View File

@@ -3,7 +3,7 @@ use std::fmt;
use std::sync::{Arc, RwLock};
#[cfg(all(feature = "compiler", feature = "engine"))]
use wasmer_compiler::CompilerConfig;
use wasmer_engine::{Engine, Tunables};
use wasmer_compiler::{Engine, Tunables};
use wasmer_vm::{init_traps, TrapHandler, TrapHandlerFn};
/// The store represents all global state that can be manipulated by

View File

@@ -2,8 +2,7 @@ use crate::sys::{MemoryType, Pages, TableType};
use std::ptr::NonNull;
use std::sync::Arc;
use target_lexicon::PointerWidth;
use wasmer_compiler::Target;
use wasmer_engine::Tunables;
use wasmer_compiler::{Target, Tunables};
use wasmer_vm::MemoryError;
use wasmer_vm::{
LinearMemory, LinearTable, Memory, MemoryStyle, Table, TableStyle, VMMemoryDefinition,

View File

@@ -70,7 +70,7 @@ impl ValFuncRef for Val {
.engine()
.lookup_signature(item.type_index)
.expect("Signature not found in store");
let export = wasmer_engine::ExportFunction {
let export = wasmer_compiler::ExportFunction {
// TODO:
// figure out if we ever need a value here: need testing with complicated import patterns
metadata: None,