Wasm: Ensure result of ref.is_null is I32
The (r32|r64).is_null instruction yields a boolean type, so we must convert a Wasm `ref.is_null` to an integer so we don't get verifier errors.
This commit is contained in:
@@ -975,7 +975,8 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
|
|||||||
Operator::RefIsNull => {
|
Operator::RefIsNull => {
|
||||||
let arg = state.pop1();
|
let arg = state.pop1();
|
||||||
let val = builder.ins().is_null(arg);
|
let val = builder.ins().is_null(arg);
|
||||||
state.push1(val);
|
let val_int = builder.ins().bint(I32, val);
|
||||||
|
state.push1(val_int);
|
||||||
}
|
}
|
||||||
Operator::RefFunc { function_index } => {
|
Operator::RefFunc { function_index } => {
|
||||||
state.push1(environ.translate_ref_func(builder.cursor(), *function_index)?);
|
state.push1(environ.translate_ref_func(builder.cursor(), *function_index)?);
|
||||||
|
|||||||
Reference in New Issue
Block a user