Disconnects Store state fields from Compiler (#1761)

*  Moves CodeMemory, VMInterrupts and SignatureRegistry from Compiler
*  CompiledModule holds CodeMemory and GdbJitImageRegistration
*  Store keeps track of its JIT code
*  Makes "jit_int.rs" stuff Send+Sync
*  Adds the threads example.
This commit is contained in:
Yury Delendik
2020-06-02 13:44:39 -05:00
committed by GitHub
parent b41330393d
commit 15c68f2cc1
61 changed files with 982 additions and 663 deletions

View File

@@ -37,7 +37,8 @@ You can also see how this works in the Rust API like so:
use wasmtime::*;
# fn main() -> anyhow::Result<()> {
let store = Store::default();
let engine = Engine::default();
let store = Store::new(&engine);
let wat = r#"
(module
(func (export "add") (param i32 i32) (result i32)
@@ -45,8 +46,8 @@ let wat = r#"
local.get 1
i32.add))
"#;
let module = Module::new(&store, wat)?;
let instance = Instance::new(&module, &[])?;
let module = Module::new(&engine, wat)?;
let instance = Instance::new(&store, &module, &[])?;
let add = instance.get_func("add").unwrap();
let add = add.get2::<i32, i32, i32>()?;
println!("1 + 2 = {}", add(1, 2)?);