Skip to content

Commit

Permalink
Remove loupe dependency
Browse files Browse the repository at this point in the history
Closes #2731
Closes #2744
  • Loading branch information
epilys authored and ptitSeb committed Oct 20, 2022
1 parent 5461bae commit f8848eb
Show file tree
Hide file tree
Showing 99 changed files with 126 additions and 479 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C
- [#2802](https://github.com/wasmerio/wasmer/pull/2802) Support Dylib engine with Singlepass
- [#2836](https://github.com/wasmerio/wasmer/pull/2836) Improve TrapInformation data stored at runtime
- [#2864](https://github.com/wasmerio/wasmer/pull/2864) `wasmer-cli`: remove wasi-experimental-io-devices from default builds
- #2864 wasmer-cli: remove wasi-experimental-io-devices from default builds
### Changed
- #2868 Removed loupe crate dependency

### Fixed
- [#2829](https://github.com/wasmerio/wasmer/pull/2829) Improve error message oriented from JS object.
Expand Down
44 changes: 3 additions & 41 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ serial_test = "0.5"
wasmer-engine-dummy = { path = "tests/lib/engine-dummy" }
compiler-test-derive = { path = "tests/lib/compiler-test-derive" }
tempfile = "3.1"
loupe = "0.1"
# For logging tests using the `RUST_LOG=debug` when testing
test-log = { version = "0.2", default-features = false, features = ["trace"] }
tracing = { version = "0.1", default-features = false, features = ["log"] }
Expand Down
2 changes: 0 additions & 2 deletions examples/tunables_limit_memory.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::ptr::NonNull;
use std::sync::Arc;

use loupe::MemoryUsage;
use wasmer::{
imports,
vm::{self, MemoryError, MemoryStyle, TableStyle, VMMemoryDefinition, VMTableDefinition},
Expand All @@ -15,7 +14,6 @@ use wasmer_engine_universal::Universal;
///
/// After adjusting the memory limits, it delegates all other logic
/// to the base tunables.
#[derive(MemoryUsage)]
pub struct LimitingTunables<T: Tunables> {
/// The maximum a linear memory is allowed to be (in Wasm pages, 64 KiB each).
/// Since Wasmer ensures there is only none or one memory, this is practically
Expand Down
1 change: 0 additions & 1 deletion lib/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ 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 }
loupe = "0.1"
# - Optional dependencies for `sys`.
wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "=2.3.0", optional = true }
wasmer-compiler-cranelift = { path = "../compiler-cranelift", version = "=2.3.0", optional = true }
Expand Down
3 changes: 1 addition & 2 deletions lib/api/src/sys/exports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use crate::sys::externals::{Extern, Function, Global, Memory, Table};
use crate::sys::native::NativeFunc;
use crate::sys::WasmTypeList;
use indexmap::IndexMap;
use loupe::MemoryUsage;
use std::fmt;
use std::iter::{ExactSizeIterator, FromIterator};
use thiserror::Error;
Expand Down Expand Up @@ -60,7 +59,7 @@ pub enum ExportError {
/// the types of instances.
///
/// TODO: add examples of using exports
#[derive(Clone, Default, MemoryUsage)]
#[derive(Clone, Default)]
pub struct Exports {
map: IndexMap<String, Extern>,
}
Expand Down
3 changes: 1 addition & 2 deletions lib/api/src/sys/externals/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use crate::sys::RuntimeError;
use crate::sys::WasmerEnv;
pub use inner::{FromToNativeWasmType, HostFunction, WasmTypeList, WithEnv, WithoutEnv};

use loupe::MemoryUsage;
use std::cmp::max;
use std::ffi::c_void;
use std::fmt;
Expand Down Expand Up @@ -37,7 +36,7 @@ use wasmer_vm::{
/// with native functions. Attempting to create a native `Function` with one will
/// result in a panic.
/// [Closures as host functions tracking issue](https://github.com/wasmerio/wasmer/issues/1840)
#[derive(PartialEq, MemoryUsage)]
#[derive(PartialEq)]
pub struct Function {
pub(crate) store: Store,
pub(crate) exported: ExportFunction,
Expand Down
2 changes: 0 additions & 2 deletions lib/api/src/sys/externals/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use crate::sys::types::Val;
use crate::sys::GlobalType;
use crate::sys::Mutability;
use crate::sys::RuntimeError;
use loupe::MemoryUsage;
use std::fmt;
use std::sync::Arc;
use wasmer_engine::Export;
Expand All @@ -17,7 +16,6 @@ use wasmer_vm::{Global as RuntimeGlobal, VMGlobal};
/// It consists of an individual value and a flag indicating whether it is mutable.
///
/// Spec: <https://webassembly.github.io/spec/core/exec/runtime.html#global-instances>
#[derive(MemoryUsage)]
pub struct Global {
store: Store,
vm_global: VMGlobal,
Expand Down
3 changes: 1 addition & 2 deletions lib/api/src/sys/externals/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::sys::externals::Extern;
use crate::sys::store::Store;
use crate::sys::MemoryType;
use crate::MemoryAccessError;
use loupe::MemoryUsage;
use std::convert::TryInto;
use std::mem;
use std::mem::MaybeUninit;
Expand All @@ -27,7 +26,7 @@ use wasmer_vm::{MemoryError, VMMemory};
/// mutable from both host and WebAssembly.
///
/// Spec: <https://webassembly.github.io/spec/core/exec/runtime.html#memory-instances>
#[derive(Debug, MemoryUsage)]
#[derive(Debug)]
pub struct Memory {
store: Store,
vm_memory: VMMemory,
Expand Down
3 changes: 1 addition & 2 deletions lib/api/src/sys/externals/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ pub use self::table::Table;
use crate::sys::exports::{ExportError, Exportable};
use crate::sys::store::{Store, StoreObject};
use crate::sys::ExternType;
use loupe::MemoryUsage;
use std::fmt;
use wasmer_engine::Export;

/// An `Extern` is the runtime representation of an entity that
/// can be imported or exported.
///
/// Spec: <https://webassembly.github.io/spec/core/exec/runtime.html#external-values>
#[derive(Clone, MemoryUsage)]
#[derive(Clone)]
pub enum Extern {
/// A external [`Function`].
Function(Function),
Expand Down
2 changes: 0 additions & 2 deletions lib/api/src/sys/externals/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::sys::store::Store;
use crate::sys::types::{Val, ValFuncRef};
use crate::sys::RuntimeError;
use crate::sys::TableType;
use loupe::MemoryUsage;
use std::sync::Arc;
use wasmer_engine::Export;
use wasmer_vm::{Table as RuntimeTable, TableElement, VMTable};
Expand All @@ -18,7 +17,6 @@ use wasmer_vm::{Table as RuntimeTable, TableElement, VMTable};
/// mutable from both host and WebAssembly.
///
/// Spec: <https://webassembly.github.io/spec/core/exec/runtime.html#table-instances>
#[derive(MemoryUsage)]
pub struct Table {
store: Store,
vm_table: VMTable,
Expand Down
3 changes: 1 addition & 2 deletions lib/api/src/sys/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::sys::imports::Imports;
use crate::sys::module::Module;
use crate::sys::store::Store;
use crate::sys::{HostEnvInitError, LinkError, RuntimeError};
use loupe::MemoryUsage;
use std::fmt;
use std::sync::{Arc, Mutex};
use thiserror::Error;
Expand All @@ -18,7 +17,7 @@ use wasmer_vm::{InstanceHandle, VMContext};
/// interacting with WebAssembly.
///
/// Spec: <https://webassembly.github.io/spec/core/exec/runtime.html#module-instances>
#[derive(Clone, MemoryUsage)]
#[derive(Clone)]
pub struct Instance {
handle: Arc<Mutex<InstanceHandle>>,
module: Module,
Expand Down
3 changes: 1 addition & 2 deletions lib/api/src/sys/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use crate::sys::exports::Exportable;
use crate::sys::store::Store;
use crate::sys::types::{ExportType, ImportType};
use crate::sys::InstantiationError;
use loupe::MemoryUsage;
use std::fmt;
use std::io;
use std::path::Path;
Expand Down Expand Up @@ -33,7 +32,7 @@ pub enum IoCompileError {
///
/// Cloning a module is cheap: it does a shallow copy of the compiled
/// contents rather than a deep copy.
#[derive(Clone, MemoryUsage)]
#[derive(Clone)]
pub struct Module {
// The field ordering here is actually significant because of the drop
// order: we want to drop the artifact before dropping the engine.
Expand Down
4 changes: 1 addition & 3 deletions lib/api/src/sys/store.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::sys::tunables::BaseTunables;
use loupe::MemoryUsage;
use std::fmt;
use std::sync::{Arc, RwLock};
#[cfg(all(feature = "compiler", feature = "engine"))]
Expand All @@ -17,11 +16,10 @@ use wasmer_vm::{init_traps, TrapHandler, TrapHandlerFn};
/// [`Tunables`] (that are used to create the memories, tables and globals).
///
/// Spec: <https://webassembly.github.io/spec/core/exec/runtime.html#store>
#[derive(Clone, MemoryUsage)]
#[derive(Clone)]
pub struct Store {
engine: Arc<dyn Engine + Send + Sync>,
tunables: Arc<dyn Tunables + Send + Sync>,
#[loupe(skip)]
trap_handler: Arc<RwLock<Option<Box<TrapHandlerFn>>>>,
}

Expand Down
3 changes: 1 addition & 2 deletions lib/api/src/sys/tunables.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::sys::{MemoryType, Pages, TableType};
use loupe::MemoryUsage;
use std::ptr::NonNull;
use std::sync::Arc;
use target_lexicon::PointerWidth;
Expand All @@ -19,7 +18,7 @@ use wasmer_vm::{
/// implementation or use composition to wrap your Tunables around
/// this one. The later approach is demonstrated in the
/// tunables-limit-memory example.
#[derive(Clone, MemoryUsage)]
#[derive(Clone)]
pub struct BaseTunables {
/// For static heaps, the size in wasm pages of the heap protected by bounds checking.
pub static_memory_bound: Pages,
Expand Down
2 changes: 0 additions & 2 deletions lib/artifact/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ edition = "2018"
[dependencies]
wasmer-types = { path = "../types", version = "=2.3.0" }
wasmer-compiler = { path = "../compiler", version = "=2.3.0" }
loupe = "0.1"
thiserror = "1.0"
enumset = "1.0"

[badges]
maintenance = { status = "actively-developed" }

Loading

0 comments on commit f8848eb

Please sign in to comment.