cranelift-wasm: Allow more customization of ref type representations

* Allow different Cranelift IR types to be used for different Wasm reference
  types.

* Do not assume that all Wasm reference types are always a Cranelift IR
  reference type. For example, `funcref`s might not need GC in some
  implementations, and can therefore be represented with a pointer rather than a
  reference type.
This commit is contained in:
Nick Fitzgerald
2020-06-23 15:19:22 -07:00
parent 28fccaedc4
commit 03165e0cb5
5 changed files with 54 additions and 13 deletions

View File

@@ -197,6 +197,14 @@ impl<'dummy_environment> DummyFuncEnvironment<'dummy_environment> {
));
sig
}
fn reference_type(&self) -> ir::Type {
match self.pointer_type() {
ir::types::I32 => ir::types::R32,
ir::types::I64 => ir::types::R64,
_ => panic!("unsupported pointer type"),
}
}
}
impl<'dummy_environment> TargetEnvironment for DummyFuncEnvironment<'dummy_environment> {