Skip to content

Commit

Permalink
Refactor last traces of "Universal" nomenclature
Browse files Browse the repository at this point in the history
  • Loading branch information
epilys committed Jul 25, 2022
1 parent 4a06b1d commit b15e8c2
Show file tree
Hide file tree
Showing 24 changed files with 56 additions and 56 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ autoexamples = false

[dependencies]
wasmer = { version = "=2.3.0", path = "lib/api", default-features = false }
wasmer-compiler = { version = "=2.3.0", path = "lib/compiler", features = ["universal_engine"] }
wasmer-compiler = { version = "=2.3.0", path = "lib/compiler", features = ["engine_compilation"] }
wasmer-compiler-cranelift = { version = "=2.3.0", path = "lib/compiler-cranelift", optional = true }
wasmer-compiler-singlepass = { version = "=2.3.0", path = "lib/compiler-singlepass", optional = true }
wasmer-compiler-llvm = { version = "=2.3.0", path = "lib/compiler-llvm", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion lib/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ default-llvm = ["default-compiler", "llvm"]
# - Engines.
engine = ["sys"]
universal = [
"engine", "wasmer-compiler/universal_engine"
"engine", "wasmer-compiler/engine_compilation"
]
default-engine = []
default-universal = [
Expand Down
2 changes: 1 addition & 1 deletion lib/c-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ middlewares = [
"wasmer-middlewares",
]
universal = [
"wasmer-compiler/universal_engine",
"wasmer-compiler/engine_compilation",
"compiler",
]
compiler = [
Expand Down
2 changes: 1 addition & 1 deletion lib/cli-compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ path = "src/bin/wasmer_compiler.rs"
doc = false

[dependencies]
wasmer-compiler = { version = "=2.3.0", path = "../compiler", features = ["universal_engine"] }
wasmer-compiler = { version = "=2.3.0", path = "../compiler", features = ["engine_compilation"] }
wasmer-types = { version = "=2.3.0", path = "../types" }
atty = "0.2"
colored = "2.0"
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ required-features = ["headless"]

[dependencies]
wasmer = { version = "=2.3.0", path = "../api", default-features = false }
wasmer-compiler = { version = "=2.3.0", path = "../compiler", features = ["universal_engine", ] }
wasmer-compiler = { version = "=2.3.0", path = "../compiler", features = ["engine_compilation", ] }
wasmer-compiler-cranelift = { version = "=2.3.0", path = "../compiler-cranelift", optional = true }
wasmer-compiler-singlepass = { version = "=2.3.0", path = "../compiler-singlepass", optional = true }
wasmer-compiler-llvm = { version = "=2.3.0", path = "../compiler-llvm", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ default = ["std", "enable-serde" ]
# `CompilerConfig`, as well as the included wasmparser.
# Disable this feature if you just want a headless engine.
translator = ["wasmparser"]
universal_engine = []
engine_compilation = []
std = ["wasmer-types/std"]
core = ["hashbrown", "wasmer-types/core"]
enable-serde = ["serde", "serde_bytes", "wasmer-types/enable-serde"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
//! Define `ArtifactBuild` to allow compiling and instantiating to be
//! done as separate steps.
#[cfg(feature = "universal_engine")]
#[cfg(feature = "engine_compilation")]
use super::trampoline::{libcall_trampoline_len, make_libcall_trampolines};
use crate::Features;
use crate::MetadataHeader;
use crate::{ArtifactCreate, EngineBuilder};
#[cfg(feature = "universal_engine")]
#[cfg(feature = "engine_compilation")]
use crate::{ModuleEnvironment, ModuleMiddlewareChain};
use enumset::EnumSet;
use std::mem;
use wasmer_types::entity::PrimaryMap;
#[cfg(feature = "universal_engine")]
#[cfg(feature = "engine_compilation")]
use wasmer_types::CompileModuleInfo;
use wasmer_types::SerializeError;
use wasmer_types::{
Expand All @@ -38,7 +38,7 @@ impl ArtifactBuild {
}

/// Compile a data buffer into a `ArtifactBuild`, which may then be instantiated.
#[cfg(feature = "universal_engine")]
#[cfg(feature = "engine_compilation")]
pub fn new(
inner_engine: &mut EngineBuilder,
data: &[u8],
Expand Down Expand Up @@ -117,7 +117,7 @@ impl ArtifactBuild {
}

/// Compile a data buffer into a `ArtifactBuild`, which may then be instantiated.
#[cfg(not(feature = "universal_engine"))]
#[cfg(not(feature = "engine_compilation"))]
pub fn new(_engine: &EngineBuilder, _data: &[u8]) -> Result<Self, CompileError> {
Err(CompileError::Codegen(
"Compilation is not enabled in the engine".to_string(),
Expand Down
9 changes: 9 additions & 0 deletions lib/compiler/src/artifact_builders/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//! Generic Artifact abstraction for Wasmer Engines.
mod artifact_builder;
mod engine_builder;
mod trampoline;

pub use self::artifact_builder::ArtifactBuild;
pub use self::engine_builder::EngineBuilder;
pub use self::trampoline::*;
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//! Define `Artifact`, based on `ArtifactBuild`
//! to allow compiling and instantiating to be done as separate steps.
use super::engine::{Engine, EngineInner};
use crate::engine::universal::link::link_module;
use crate::engine::engine::{Engine, EngineInner};
use crate::engine::link::link_module;
use crate::ArtifactBuild;
use crate::ArtifactCreate;
use crate::Features;
#[cfg(feature = "universal_engine")]
#[cfg(feature = "engine_compilation")]
use crate::ModuleEnvironment;
use crate::{
register_frame_info, resolve_imports, FunctionExtent, GlobalFrameInfoRegistration,
Expand Down Expand Up @@ -37,7 +37,7 @@ pub struct Artifact {

impl Artifact {
/// Compile a data buffer into a `ArtifactBuild`, which may then be instantiated.
#[cfg(feature = "universal_engine")]
#[cfg(feature = "engine_compilation")]
pub fn new(
engine: &Engine,
data: &[u8],
Expand Down Expand Up @@ -70,7 +70,7 @@ impl Artifact {
}

/// Compile a data buffer into a `ArtifactBuild`, which may then be instantiated.
#[cfg(not(feature = "universal_engine"))]
#[cfg(not(feature = "engine_compilation"))]
pub fn new(_engine: &Engine, _data: &[u8]) -> Result<Self, CompileError> {
Err(CompileError::Codegen(
"Compilation is not enabled in the engine".to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Backend {
}

/// Build the `Engine` for this configuration
#[cfg(feature = "universal_engine")]
#[cfg(feature = "engine_compilation")]
pub fn engine(self) -> Engine {
let target = self.target.unwrap_or_default();
if let Some(compiler_config) = self.compiler_config {
Expand All @@ -60,7 +60,7 @@ impl Backend {
}

/// Build the `Engine` for this configuration
#[cfg(not(feature = "universal_engine"))]
#[cfg(not(feature = "engine_compilation"))]
pub fn engine(self) -> Engine {
Engine::headless()
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Universal compilation.
#[cfg(feature = "universal_engine")]
#[cfg(feature = "engine_compilation")]
use crate::Compiler;
use crate::EngineBuilder;
use crate::{Artifact, CodeMemory};
Expand Down Expand Up @@ -32,7 +32,7 @@ pub struct Engine {

impl Engine {
/// Create a new `Engine` with the given config
#[cfg(feature = "universal_engine")]
#[cfg(feature = "engine_compilation")]
pub fn new(compiler: Box<dyn Compiler>, target: Target, features: Features) -> Self {
Self {
inner: Arc::new(Mutex::new(EngineInner {
Expand Down Expand Up @@ -101,7 +101,7 @@ impl Engine {
}

/// Compile a WebAssembly binary
#[cfg(feature = "universal_engine")]
#[cfg(feature = "engine_compilation")]
pub fn compile(
&self,
binary: &[u8],
Expand All @@ -111,7 +111,7 @@ impl Engine {
}

/// Compile a WebAssembly binary
#[cfg(not(feature = "universal_engine"))]
#[cfg(not(feature = "engine_compilation"))]
pub fn compile(
&self,
_binary: &[u8],
Expand Down Expand Up @@ -174,7 +174,7 @@ pub struct EngineInner {

impl EngineInner {
/// Gets the compiler associated to this engine.
#[cfg(feature = "universal_engine")]
#[cfg(feature = "engine_compilation")]
pub fn compiler(&self) -> Result<&dyn Compiler, CompileError> {
self.builder.compiler()
}
Expand Down
File renamed without changes.
22 changes: 20 additions & 2 deletions lib/compiler/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,30 @@ mod trap;
mod tunables;

#[cfg(feature = "translator")]
mod universal;
mod artifact;
#[cfg(feature = "translator")]
mod backend;
#[cfg(feature = "translator")]
mod code_memory;
#[cfg(feature = "translator")]
mod engine;
#[cfg(feature = "translator")]
mod link;
#[cfg(feature = "translator")]
mod unwind;

pub use self::error::{InstantiationError, LinkError};
pub use self::resolver::resolve_imports;
pub use self::trap::*;
pub use self::tunables::Tunables;

#[cfg(feature = "translator")]
pub use self::universal::*;
pub use self::artifact::Artifact;
#[cfg(feature = "translator")]
pub use self::backend::Backend;
#[cfg(feature = "translator")]
pub use self::code_memory::CodeMemory;
#[cfg(feature = "translator")]
pub use self::engine::Engine;
#[cfg(feature = "translator")]
pub use self::link::link_module;
18 changes: 0 additions & 18 deletions lib/compiler/src/engine/universal/mod.rs

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions lib/compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ mod lib {
}
}

mod artifact;
#[cfg(not(target_arch = "wasm32"))]
mod engine;
mod traits;

pub use crate::artifact::*;
#[cfg(not(target_arch = "wasm32"))]
pub use crate::engine::*;
pub use crate::traits::*;

#[cfg(feature = "translator")]
mod universal_artifact;
mod artifact_builders;

#[cfg(feature = "translator")]
pub use self::universal_artifact::*;
pub use self::artifact_builders::*;

#[cfg(feature = "translator")]
mod compiler;
Expand Down
File renamed without changes.
9 changes: 0 additions & 9 deletions lib/compiler/src/universal_artifact/mod.rs

This file was deleted.

0 comments on commit b15e8c2

Please sign in to comment.