RefNull may return any reference type.

This commit is contained in:
Nick Lewycky
2021-03-01 13:40:04 -08:00
parent 3c6168d0bb
commit 40f40bb7d4

View File

@ -9348,8 +9348,10 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
* Reference types.
* https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md
***************************/
Operator::RefNull { .. } => {
self.state.push1(self.intrinsics.funcref_ty.const_null());
Operator::RefNull { ty } => {
let ty = wptype_to_type(ty).map_err(to_compile_error)?;
let ty = type_to_llvm(self.intrinsics, ty)?;
self.state.push1(ty.const_zero());
}
Operator::RefIsNull => {
let value = self.state.pop1()?.into_pointer_value();