Skip to content

Commit

Permalink
fix: Update loupe to 0.1.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Mar 23, 2021
1 parent 03486f3 commit deb097c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

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

10 changes: 2 additions & 8 deletions examples/tunables_limit_memory.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use std::mem;
use std::ptr::NonNull;
use std::sync::Arc;

use loupe::{MemoryUsage, MemoryUsageTracker};
use loupe::MemoryUsage;
use wasmer::{
imports,
vm::{self, MemoryError, MemoryStyle, TableStyle, VMMemoryDefinition, VMTableDefinition},
Expand All @@ -16,6 +15,7 @@ use wasmer_engine_jit::JIT;
///
/// 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 Expand Up @@ -133,12 +133,6 @@ impl<T: Tunables> Tunables for LimitingTunables<T> {
}
}

impl<T: Tunables> MemoryUsage for LimitingTunables<T> {
fn size_of_val(&self, _tracker: &mut dyn MemoryUsageTracker) -> usize {
mem::size_of_val(self)
}
}

fn main() -> Result<(), Box<dyn std::error::Error>> {
// A Wasm module with one exported memory (min: 7 pages, max: unset)
let wat = br#"(module (memory 7) (export "memory" (memory 0)))"#;
Expand Down
2 changes: 1 addition & 1 deletion lib/engine-object-file/src/artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct ObjectFileArtifact {
metadata: ModuleMetadata,
module_bytes: Vec<u8>,
finished_functions: BoxedSlice<LocalFunctionIndex, FunctionBodyPtr>,
#[memoryusage(ignore)]
#[loupe(skip)]
finished_function_call_trampolines: BoxedSlice<SignatureIndex, VMTrampoline>,
finished_dynamic_function_trampolines: BoxedSlice<FunctionIndex, FunctionBodyPtr>,
signatures: BoxedSlice<SignatureIndex, VMSharedSignatureIndex>,
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/engine-dummy/src/artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! done as separate steps.

use crate::engine::DummyEngine;
use loupe_derive::MemoryUsage;
use loupe::MemoryUsage;
#[cfg(feature = "serialize")]
use serde::{Deserialize, Serialize};
use std::sync::Arc;
Expand Down Expand Up @@ -40,7 +40,7 @@ pub struct DummyArtifactMetadata {
pub struct DummyArtifact {
metadata: DummyArtifactMetadata,
finished_functions: BoxedSlice<LocalFunctionIndex, FunctionBodyPtr>,
#[memoryusage(ignore)]
#[loupe(skip)]
finished_function_call_trampolines: BoxedSlice<SignatureIndex, VMTrampoline>,
finished_dynamic_function_trampolines: BoxedSlice<FunctionIndex, FunctionBodyPtr>,
signatures: BoxedSlice<SignatureIndex, VMSharedSignatureIndex>,
Expand Down

0 comments on commit deb097c

Please sign in to comment.