Remove all checked in *.wasm files to the repo (#563)
* Tidy up the `hello` example for `wasmtime` * Remove the `*.wat` and `*.wasm` files and instead just inline the `*.wat` into the example. * Touch up comments so they're not just a repeat of the `println!` below. * Move `*.wat` for `memory` example inline No need to handle auxiliary files with the ability to parse it inline! * Move `multi.wasm` inline into `multi.rs` example * Move `*.wasm` for gcd example inline * Move `*.wat` inline with `import_calling_export` test * Remove checked in `lightbeam/test.wasm` Instead move the `*.wat` into the source and parse it into wasm there. * Run rustfmt
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
//! Translation of the memory example
|
||||
|
||||
use anyhow::{bail, ensure, Context as _, Error};
|
||||
use core::cell::Ref;
|
||||
use std::fs::read;
|
||||
use std::cell::Ref;
|
||||
use wasmtime_api::*;
|
||||
|
||||
fn get_export_memory(exports: &[Extern], i: usize) -> Result<HostRef<Memory>, Error> {
|
||||
@@ -69,7 +68,23 @@ fn main() -> Result<(), Error> {
|
||||
|
||||
// Load binary.
|
||||
println!("Loading binary...");
|
||||
let binary = read("examples/memory.wasm")?;
|
||||
let binary = wat::parse_str(
|
||||
r#"
|
||||
(module
|
||||
(memory (export "memory") 2 3)
|
||||
|
||||
(func (export "size") (result i32) (memory.size))
|
||||
(func (export "load") (param i32) (result i32)
|
||||
(i32.load8_s (local.get 0))
|
||||
)
|
||||
(func (export "store") (param i32 i32)
|
||||
(i32.store8 (local.get 0) (local.get 1))
|
||||
)
|
||||
|
||||
(data (i32.const 0x1000) "\01\02\03\04")
|
||||
)
|
||||
"#,
|
||||
)?;
|
||||
|
||||
// Compile.
|
||||
println!("Compiling module...");
|
||||
|
||||
Reference in New Issue
Block a user