Skip to content

Commit

Permalink
feat: Use latest version of loupe.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Mar 23, 2021
1 parent 906079f commit d801eb4
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 22 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ wasmer-cache = { version = "1.0.2", path = "lib/cache", optional = true }
wasmer-types = { version = "1.0.2", path = "lib/wasmer-types" }
wasmer-middlewares = { version = "1.0.2", path = "lib/middlewares", optional = true }
cfg-if = "1.0"
loupe = { path = "../loupe/crates/loupe" }

[workspace]
members = [
Expand Down
2 changes: 1 addition & 1 deletion lib/api/src/exports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::import_object::LikeNamespace;
use crate::native::NativeFunc;
use crate::WasmTypeList;
use indexmap::IndexMap;
use loupe_derive::MemoryUsage;
use loupe::MemoryUsage;
use std::fmt;
use std::iter::{ExactSizeIterator, FromIterator};
use std::sync::Arc;
Expand Down
4 changes: 2 additions & 2 deletions lib/api/src/externals/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub use inner::{FromToNativeWasmType, HostFunction, WasmTypeList, WithEnv, Witho
#[cfg(feature = "deprecated")]
pub use inner::{UnsafeMutableEnv, WithUnsafeMutableEnv};

use loupe_derive::MemoryUsage;
use loupe::MemoryUsage;
use std::cmp::max;
use std::ffi::c_void;
use std::fmt;
Expand All @@ -26,7 +26,7 @@ use wasmer_vm::{
#[derive(Clone, PartialEq, MemoryUsage)]
pub struct WasmFunctionDefinition {
// Address of the trampoline to do the call.
#[memoryusage(ignore)]
#[loupe(skip)]
pub(crate) trampoline: VMTrampoline,
}

Expand Down
2 changes: 1 addition & 1 deletion lib/api/src/externals/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::types::Val;
use crate::GlobalType;
use crate::Mutability;
use crate::RuntimeError;
use loupe_derive::MemoryUsage;
use loupe::MemoryUsage;
use std::fmt;
use std::sync::Arc;
use wasmer_engine::{Export, ExportGlobal};
Expand Down
2 changes: 1 addition & 1 deletion lib/api/src/externals/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::exports::{ExportError, Exportable};
use crate::externals::Extern;
use crate::store::Store;
use crate::{MemoryType, MemoryView};
use loupe_derive::MemoryUsage;
use loupe::MemoryUsage;
use std::convert::TryInto;
use std::slice;
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion lib/api/src/externals/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub use self::table::Table;
use crate::exports::{ExportError, Exportable};
use crate::store::{Store, StoreObject};
use crate::ExternType;
use loupe_derive::MemoryUsage;
use loupe::MemoryUsage;
use std::fmt;
use wasmer_engine::Export;

Expand Down
2 changes: 1 addition & 1 deletion lib/api/src/externals/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::store::Store;
use crate::types::{Val, ValFuncRef};
use crate::RuntimeError;
use crate::TableType;
use loupe_derive::MemoryUsage;
use loupe::MemoryUsage;
use std::sync::Arc;
use wasmer_engine::{Export, ExportTable};
use wasmer_vm::{Table as RuntimeTable, VMCallerCheckedAnyfunc, VMExportTable};
Expand Down
2 changes: 1 addition & 1 deletion lib/api/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::externals::Extern;
use crate::module::Module;
use crate::store::Store;
use crate::{HostEnvInitError, LinkError, RuntimeError};
use loupe_derive::MemoryUsage;
use loupe::MemoryUsage;
use std::fmt;
use std::sync::{Arc, Mutex};
use thiserror::Error;
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/src/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::error::ParseCpuFeatureError;
use crate::lib::std::str::FromStr;
use crate::lib::std::string::{String, ToString};
use enumset::{EnumSet, EnumSetType};
use loupe_derive::MemoryUsage;
use loupe::MemoryUsage;
pub use target_lexicon::{
Architecture, BinaryFormat, CallingConvention, Endianness, OperatingSystem, PointerWidth,
Triple,
Expand Down
2 changes: 1 addition & 1 deletion lib/engine-native/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use crate::NativeArtifact;
use libloading::Library;
use loupe_derive::MemoryUsage;
use loupe::MemoryUsage;
use std::path::Path;
use std::sync::Arc;
use std::sync::Mutex;
Expand Down
8 changes: 4 additions & 4 deletions lib/engine/src/export.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use loupe_derive::MemoryUsage;
use loupe::MemoryUsage;
use std::sync::Arc;
use wasmer_vm::{
ImportInitializerFuncPtr, VMExport, VMExportFunction, VMExportGlobal, VMExportMemory,
Expand Down Expand Up @@ -76,19 +76,19 @@ pub struct ExportFunctionMetadata {
/// we create the `api::Instance`.
// This one is optional for now because dynamic host envs need the rest
// of this without the init fn
#[memoryusage(ignore)]
#[loupe(skip)]
pub(crate) import_init_function_ptr: Option<ImportInitializerFuncPtr>,

/// A function analogous to `Clone::clone` that returns a leaked `Box`.
#[memoryusage(ignore)]
#[loupe(skip)]
pub(crate) host_env_clone_fn: fn(*mut std::ffi::c_void) -> *mut std::ffi::c_void,

/// The destructor to free the host environment.
///
/// # Safety
/// - This function should only be called in when properly synchronized.
/// For example, in the `Drop` implementation of this type.
#[memoryusage(ignore)]
#[loupe(skip)]
pub(crate) host_env_drop_fn: unsafe fn(*mut std::ffi::c_void),
}

Expand Down
4 changes: 2 additions & 2 deletions lib/vm/src/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::instance::InstanceRef;
use crate::memory::{Memory, MemoryStyle};
use crate::table::{Table, TableStyle};
use crate::vmcontext::{VMFunctionBody, VMFunctionEnvironment, VMFunctionKind, VMTrampoline};
use loupe_derive::MemoryUsage;
use loupe::MemoryUsage;
use std::sync::Arc;
use wasmer_types::{FunctionType, MemoryType, TableType};

Expand Down Expand Up @@ -47,7 +47,7 @@ pub struct VMExportFunction {
///
/// May be `None` when the function is a host function (`FunctionType`
/// == `Dynamic` or `vmctx` == `nullptr`).
#[memoryusage(ignore)]
#[loupe(skip)]
pub call_trampoline: Option<VMTrampoline>,

/// A “reference” to the instance through the
Expand Down
7 changes: 3 additions & 4 deletions lib/vm/src/instance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use crate::vmcontext::{
use crate::{FunctionBodyPtr, ModuleInfo, VMOffsets};
use crate::{VMExportFunction, VMExportGlobal, VMExportMemory, VMExportTable};
use loupe::{MemoryUsage, MemoryUsageTracker};
use loupe_derive::MemoryUsage;
use memoffset::offset_of;
use more_asserts::assert_lt;
use std::any::Any;
Expand Down Expand Up @@ -80,7 +79,7 @@ pub(crate) struct Instance {
functions: BoxedSlice<LocalFunctionIndex, FunctionBodyPtr>,

/// Pointers to function call trampolines in executable memory.
#[memoryusage(ignore)]
#[loupe(skip)]
function_call_trampolines: BoxedSlice<SignatureIndex, VMTrampoline>,

/// Passive elements in this instantiation. As `elem.drop`s happen, these
Expand All @@ -95,7 +94,7 @@ pub(crate) struct Instance {
host_state: Box<dyn Any>,

/// Handler run when `SIGBUS`, `SIGFPE`, `SIGILL`, or `SIGSEGV` are caught by the instance thread.
#[memoryusage(ignore)]
#[loupe(skip)]
pub(crate) signal_handler: Cell<Option<Box<SignalHandler>>>,

/// Functions to operate on host environments in the imports
Expand All @@ -109,7 +108,7 @@ pub(crate) struct Instance {
/// field is last, and represents a dynamically-sized array that
/// extends beyond the nominal end of the struct (similar to a
/// flexible array member).
#[memoryusage(ignore)]
#[loupe(skip)]
vmctx: VMContext,
}

Expand Down
2 changes: 1 addition & 1 deletion lib/vm/src/vmoffsets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

use crate::module::ModuleInfo;
use crate::VMBuiltinFunctionIndex;
use loupe_derive::MemoryUsage;
use loupe::MemoryUsage;
use more_asserts::assert_lt;
use std::convert::TryFrom;
use wasmer_types::{
Expand Down

0 comments on commit d801eb4

Please sign in to comment.