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:
Alex Crichton
2019-11-13 13:00:06 -06:00
committed by GitHub
parent 5ca38bdd4a
commit 399295a708
19 changed files with 128 additions and 108 deletions

View File

@@ -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...");