wasmtime: Initial, partial support for externref

This is enough to get an `externref -> externref` identity function
passing.

However, `externref`s that are dropped by compiled Wasm code are (safely)
leaked. Follow up work will leverage cranelift's stack maps to resolve this
issue.
This commit is contained in:
Nick Fitzgerald
2020-05-22 17:12:45 -07:00
parent 137e182750
commit a8ee0554a9
41 changed files with 545 additions and 376 deletions

View File

@@ -27,7 +27,7 @@ impl wasm_memory_t {
}
fn externref(&self) -> wasmtime::ExternRef {
self.memory().externref()
self.memory().clone().into()
}
}
@@ -36,7 +36,7 @@ pub extern "C" fn wasm_memory_new(
store: &wasm_store_t,
mt: &wasm_memorytype_t,
) -> Box<wasm_memory_t> {
let memory = HostRef::new(Memory::new(&store.store.borrow(), mt.ty().ty.clone()));
let memory = HostRef::new(&store.store, Memory::new(&store.store, mt.ty().ty.clone()));
Box::new(wasm_memory_t {
ext: wasm_extern_t {
which: ExternHost::Memory(memory),