Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implement MemoryUsage for Instance #2201

Merged
merged 8 commits into from
Mar 23, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
chore: Remove debug instructions.
  • Loading branch information
Hywan committed Mar 23, 2021
commit 4eb7f7876e0a59b78e2fae48fa0788ceb6ca25f4
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -69,7 +69,6 @@ criterion = "0.3"
lazy_static = "1.4"
wasmer-engine-dummy = { path = "tests/lib/engine-dummy" }
tempfile = "3.1"
loupe = "0.1"

[features]
# Don't add the compiler features in default, please add them on the Makefile
8 changes: 0 additions & 8 deletions examples/hello_world.rs
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@
//! cargo run --example hello-world --release --features "cranelift"
//! ```

use loupe::size_of_val;
use wasmer::{imports, wat2wasm, Function, Instance, Module, NativeFunc, Store};
use wasmer_compiler_cranelift::Cranelift;
use wasmer_engine_jit::JIT;
@@ -46,15 +45,11 @@ fn main() -> anyhow::Result<()> {
// (`Cranelift`) and pass it to an engine (`JIT`). We then pass the engine to
// the store and are now ready to compile and run WebAssembly!
let store = Store::new(&JIT::new(Cranelift::default()).engine());
dbg!(size_of_val(&store));

// We then use our store and Wasm bytes to compile a `Module`.
// A `Module` is a compiled WebAssembly module that isn't ready to execute yet.
let module = Module::new(&store, wasm_bytes)?;

dbg!(size_of_val(&store));
dbg!(size_of_val(&module));

// Next we'll set up our `Module` so that we can execute it.

// We define a function to act as our "env" "say_hello" function imported in the
@@ -78,9 +73,6 @@ fn main() -> anyhow::Result<()> {
// and is ready to execute.
let instance = Instance::new(&module, &import_object)?;

dbg!(size_of_val(&instance));
dbg!(&instance.exports);

// We get the `NativeFunc` with no parameters and no results from the instance.
//
// Recall that the Wasm module exported a function named "run", this is getting