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,11 +1,8 @@
//! Translation of multi example
extern crate alloc;
use alloc::rc::Rc;
use anyhow::{ensure, format_err, Context as _, Result};
use core::cell::Ref;
use std::fs::read;
use std::cell::Ref;
use std::rc::Rc;
use wasmtime_api::*;
struct Callback;
@@ -21,6 +18,31 @@ impl Callable for Callback {
}
}
const WAT: &str = r#"
(module
(func $f (import "" "f") (param i32 i64) (result i64 i32))
(func $g (export "g") (param i32 i64) (result i64 i32)
(call $f (local.get 0) (local.get 1))
)
(func $round_trip_many
(export "round_trip_many")
(param i64 i64 i64 i64 i64 i64 i64 i64 i64 i64)
(result i64 i64 i64 i64 i64 i64 i64 i64 i64 i64)
local.get 0
local.get 1
local.get 2
local.get 3
local.get 4
local.get 5
local.get 6
local.get 7
local.get 8
local.get 9)
)
"#;
fn main() -> Result<()> {
// Initialize.
println!("Initializing...");
@@ -29,7 +51,7 @@ fn main() -> Result<()> {
// Load binary.
println!("Loading binary...");
let binary = read("examples/multi.wasm")?;
let binary = wat::parse_str(WAT)?;
// Compile.
println!("Compiling module...");