cranelift-wasm: Make FuncEnvironment::translate_ref_func take a FuncIndex
It was previously taking a raw `u32`. This change makes it more clear what index space that index points into.
This commit is contained in:
@@ -1045,7 +1045,8 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
|
|||||||
state.push1(environ.translate_ref_is_null(builder.cursor(), value)?);
|
state.push1(environ.translate_ref_is_null(builder.cursor(), value)?);
|
||||||
}
|
}
|
||||||
Operator::RefFunc { function_index } => {
|
Operator::RefFunc { function_index } => {
|
||||||
state.push1(environ.translate_ref_func(builder.cursor(), *function_index)?);
|
let index = FuncIndex::from_u32(*function_index);
|
||||||
|
state.push1(environ.translate_ref_func(builder.cursor(), index)?);
|
||||||
}
|
}
|
||||||
Operator::AtomicNotify { .. }
|
Operator::AtomicNotify { .. }
|
||||||
| Operator::I32AtomicWait { .. }
|
| Operator::I32AtomicWait { .. }
|
||||||
|
|||||||
@@ -516,7 +516,7 @@ impl<'dummy_environment> FuncEnvironment for DummyFuncEnvironment<'dummy_environ
|
|||||||
fn translate_ref_func(
|
fn translate_ref_func(
|
||||||
&mut self,
|
&mut self,
|
||||||
mut pos: FuncCursor,
|
mut pos: FuncCursor,
|
||||||
_func_index: u32,
|
_func_index: FuncIndex,
|
||||||
) -> WasmResult<ir::Value> {
|
) -> WasmResult<ir::Value> {
|
||||||
Ok(pos.ins().null(self.reference_type()))
|
Ok(pos.ins().null(self.reference_type()))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -456,7 +456,11 @@ pub trait FuncEnvironment: TargetEnvironment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Translate a `ref.func` WebAssembly instruction.
|
/// Translate a `ref.func` WebAssembly instruction.
|
||||||
fn translate_ref_func(&mut self, pos: FuncCursor, func_index: u32) -> WasmResult<ir::Value>;
|
fn translate_ref_func(
|
||||||
|
&mut self,
|
||||||
|
pos: FuncCursor,
|
||||||
|
func_index: FuncIndex,
|
||||||
|
) -> WasmResult<ir::Value>;
|
||||||
|
|
||||||
/// Translate a `global.get` WebAssembly instruction at `pos` for a global
|
/// Translate a `global.get` WebAssembly instruction at `pos` for a global
|
||||||
/// that is custom.
|
/// that is custom.
|
||||||
|
|||||||
@@ -687,7 +687,7 @@ impl<'module_environment> cranelift_wasm::FuncEnvironment for FuncEnvironment<'m
|
|||||||
fn translate_ref_func(
|
fn translate_ref_func(
|
||||||
&mut self,
|
&mut self,
|
||||||
_: cranelift_codegen::cursor::FuncCursor<'_>,
|
_: cranelift_codegen::cursor::FuncCursor<'_>,
|
||||||
_: u32,
|
_: FuncIndex,
|
||||||
) -> WasmResult<ir::Value> {
|
) -> WasmResult<ir::Value> {
|
||||||
Err(WasmError::Unsupported(
|
Err(WasmError::Unsupported(
|
||||||
"the `ref.func` instruction is not supported yet".into(),
|
"the `ref.func` instruction is not supported yet".into(),
|
||||||
|
|||||||
Reference in New Issue
Block a user