Skip to content

Commit

Permalink
!fifth
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Mar 16, 2021
1 parent cc2730d commit c75fb8a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions lib/engine-object-file/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ bincode = "1.3"
leb128 = "0.2"
libloading = "0.7"
tempfile = "3.1"
loupe = { path = "../../../loupe/crates/loupe" }
loupe-derive = { path = "../../../loupe/crates/loupe-derive" }

[features]
# Enable the `compiler` feature if you want the engine to compile
Expand Down
8 changes: 7 additions & 1 deletion lib/engine-object-file/src/engine.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::ObjectFileArtifact;
use loupe_derive::MemoryUsage;
use std::io::Read;
use std::path::Path;
use std::sync::{Arc, Mutex};
Expand All @@ -12,7 +13,7 @@ use wasmer_types::FunctionType;
use wasmer_vm::{SignatureRegistry, VMSharedSignatureIndex};

/// A WebAssembly `ObjectFile` Engine.
#[derive(Clone)]
#[derive(Clone, MemoryUsage)]
pub struct ObjectFileEngine {
inner: Arc<Mutex<ObjectFileEngineInner>>,
/// The target for the compiler
Expand Down Expand Up @@ -165,19 +166,24 @@ impl Engine for ObjectFileEngine {
}

/// The inner contents of `ObjectFileEngine`
#[derive(MemoryUsage)]
pub struct ObjectFileEngineInner {
/// The compiler
#[cfg(feature = "compiler")]
compiler: Option<Box<dyn Compiler>>,

/// The WebAssembly features to use
#[cfg(feature = "compiler")]
features: Features,

/// The signature registry is used mainly to operate with trampolines
/// performantly.
signatures: SignatureRegistry,

/// The prefixer returns the a String to prefix each of
/// the functions in the shared object generated by the `ObjectFileEngine`,
/// so we can assure no collisions.
#[memoryusage(ignore)]
prefixer: Option<Box<dyn Fn(&[u8]) -> String + Send>>,
}

Expand Down
2 changes: 2 additions & 0 deletions tests/lib/engine-dummy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ wasmer-engine = { path = "../../../lib/engine", version = "1.0.2" }
serde = { version = "1.0", features = ["derive", "rc"], optional = true }
serde_bytes = { version = "0.11", optional = true }
bincode = { version = "1.2", optional = true }
loupe = { path = "../../../../loupe/crates/loupe" }
loupe-derive = { path = "../../../../loupe/crates/loupe-derive" }

[features]
# Enable the `compiler` feature if you want the engine to compile
Expand Down
3 changes: 2 additions & 1 deletion tests/lib/engine-dummy/src/engine.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Dummy Engine.
use crate::DummyArtifact;
use loupe_derive::MemoryUsage;
use std::sync::Arc;
use wasmer_compiler::{CompileError, Features, Target};
use wasmer_engine::{Artifact, DeserializeError, Engine, EngineId, Tunables};
Expand All @@ -17,7 +18,7 @@ extern "C" fn dummy_trampoline(
}

/// A WebAssembly `Dummy` Engine.
#[derive(Clone)]
#[derive(Clone, MemoryUsage)]
pub struct DummyEngine {
signatures: Arc<SignatureRegistry>,
features: Arc<Features>,
Expand Down

0 comments on commit c75fb8a

Please sign in to comment.