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

@@ -4,9 +4,9 @@ use wasmtime::*;
fn get_none() {
let store = Store::default();
let ty = TableType::new(ValType::FuncRef, Limits::new(1, None));
let table = Table::new(&store, ty, Val::ExternRef(ExternRef::Null)).unwrap();
let table = Table::new(&store, ty, Val::ExternRef(None)).unwrap();
match table.get(0) {
Some(Val::ExternRef(ExternRef::Null)) => {}
Some(Val::ExternRef(None)) => {}
_ => panic!(),
}
assert!(table.get(1).is_none());