Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/api/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub enum LinkError {

/// A trap ocurred during linking.
#[cfg_attr(feature = "std", error("RuntimeError occurred during linking: {0}"))]
Trap(#[source] RuntimeError),
Trap(#[cfg_attr(feature = "std", source)] RuntimeError),
/// Insufficient resources available for linking.
#[cfg_attr(feature = "std", error("Insufficient resources: {0}"))]
Resource(String),
Expand Down
124 changes: 119 additions & 5 deletions lib/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,29 +413,143 @@
//! [`wasmi`]: https://github.com/wasmi-labs/wasmi

#[cfg(not(any(
feature = "sys",
feature = "js",
feature = "jsc",
feature = "singlepass",
feature = "cranelift",
feature = "llvm",
feature = "wamr",
feature = "wasmi",
feature = "v8",
feature = "wasmi"
feature = "js",
feature = "jsc"
)))]
compile_error!(
"One of: `sys`, `js`, `jsc` `wamr`, `wasmi` or `v8` features must be enabled. Please, pick one."
"wasmer requires enabling at least one backend feature: `sys`, `wamr`, `wasmi`, `v8`, `js`, or `jsc`."
);

#[cfg(all(
feature = "sys",
not(any(feature = "singlepass", feature = "cranelift", feature = "llvm"))
))]
compile_error!(
"the `sys` feature requires enabling at least one compiler backend: `singlepass`, `cranelift`, or `llvm`."
);

#[cfg(any(
feature = "cranelift",
feature = "singlepass",
feature = "llvm",
feature = "js",
feature = "jsc",
feature = "wamr",
feature = "v8",
feature = "wasmi"
))]
mod utils;

#[cfg(any(
feature = "cranelift",
feature = "singlepass",
feature = "llvm",
feature = "js",
feature = "jsc",
feature = "wamr",
feature = "v8",
feature = "wasmi"
))]
pub use utils::*;

#[cfg(any(
feature = "cranelift",
feature = "singlepass",
feature = "llvm",
feature = "js",
feature = "jsc",
feature = "wamr",
feature = "v8",
feature = "wasmi"
))]
mod entities;

#[cfg(any(
feature = "cranelift",
feature = "singlepass",
feature = "llvm",
feature = "js",
feature = "jsc",
feature = "wamr",
feature = "v8",
feature = "wasmi"
))]
pub use entities::memory::{location::MemoryLocation, MemoryView};

#[cfg(any(
feature = "cranelift",
feature = "singlepass",
feature = "llvm",
feature = "js",
feature = "jsc",
feature = "wamr",
feature = "v8",
feature = "wasmi"
))]
pub use entities::*;

#[cfg(any(
feature = "cranelift",
feature = "singlepass",
feature = "llvm",
feature = "js",
feature = "jsc",
feature = "wamr",
feature = "v8",
feature = "wasmi"
))]
mod error;

#[cfg(any(
feature = "cranelift",
feature = "singlepass",
feature = "llvm",
feature = "js",
feature = "jsc",
feature = "wamr",
feature = "v8",
feature = "wasmi"
))]
pub use error::*;

#[cfg(any(
feature = "cranelift",
feature = "singlepass",
feature = "llvm",
feature = "js",
feature = "jsc",
feature = "wamr",
feature = "v8",
feature = "wasmi"
))]
mod backend;
#[cfg(any(
feature = "cranelift",
feature = "singlepass",
feature = "llvm",
feature = "js",
feature = "jsc",
feature = "wamr",
feature = "v8",
feature = "wasmi"
))]
pub use backend::*;
#[cfg(any(
feature = "cranelift",
feature = "singlepass",
feature = "llvm",
feature = "js",
feature = "jsc",
feature = "wamr",
feature = "v8",
feature = "wasmi"
))]
mod vm;

pub use wasmer_types::{
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/src/engine/artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ impl Artifact {
get_got_address(RelocationTarget::LibCall(wasmer_vm::LibCall::EHPersonality)),
)?;

#[cfg(not(target_arch = "wasm32"))]
#[cfg(all(feature = "compiler", not(target_arch = "wasm32")))]
{
engine_inner.register_perfmap(&finished_functions, module_info)?;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/src/engine/inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ impl EngineInner {
.register_frame_info(frame_info);
}

#[cfg(not(target_arch = "wasm32"))]
#[cfg(all(feature = "compiler", not(target_arch = "wasm32")))]
pub(crate) fn register_perfmap(
&self,
finished_functions: &PrimaryMap<LocalFunctionIndex, FunctionExtent>,
Expand Down
10 changes: 10 additions & 0 deletions lib/compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ compile_error!("Both the `std` and `core` features are disabled. Please enable o
extern crate alloc;

#[allow(unused_imports)]
#[cfg(any(feature = "std", feature = "core"))]
mod lib {
#[cfg(feature = "core")]
pub mod std {
Expand All @@ -46,18 +47,27 @@ mod lib {
}
}

#[cfg(any(feature = "std", feature = "core"))]
mod engine;
#[cfg(any(feature = "std", feature = "core"))]
mod traits;

#[cfg(any(feature = "std", feature = "core"))]
pub mod object;
#[cfg(any(feature = "std", feature = "core"))]
pub mod serialize;
#[cfg(any(feature = "std", feature = "core"))]
pub mod types;

#[cfg(any(feature = "std", feature = "core"))]
pub use crate::engine::*;
#[cfg(any(feature = "std", feature = "core"))]
pub use crate::traits::*;

#[cfg(any(feature = "std", feature = "core"))]
mod artifact_builders;

#[cfg(any(feature = "std", feature = "core"))]
pub use self::artifact_builders::*;

#[cfg(feature = "compiler")]
Expand Down
Loading