@@ -44,7 +44,7 @@ use crate::{
4444 TryIntoCmpBranchInstr as _,
4545 } ,
4646 labels:: { LabelRef , LabelRegistry } ,
47- utils:: { Instr , IntoShiftAmount , ToBits , WasmFloat , WasmInteger } ,
47+ utils:: { OpPos , IntoShiftAmount , ToBits , WasmFloat , WasmInteger } ,
4848 WasmTranslator ,
4949 } ,
5050 BlockType ,
@@ -329,7 +329,7 @@ impl FuncTranslator {
329329 fn move_operands_to_temp (
330330 & mut self ,
331331 len : usize ,
332- consume_fuel : Option < Instr > ,
332+ consume_fuel : Option < OpPos > ,
333333 ) -> Result < SlotSpan , Error > {
334334 for n in 0 ..len {
335335 let operand = self . stack . operand_to_temp ( n) ;
@@ -349,7 +349,7 @@ impl FuncTranslator {
349349 fn copy_branch_params (
350350 & mut self ,
351351 target : & impl ControlFrameBase ,
352- consume_fuel_instr : Option < Instr > ,
352+ consume_fuel_instr : Option < OpPos > ,
353353 ) -> Result < ( ) , Error > {
354354 let len_branch_params = target. len_branch_params ( & self . engine ) ;
355355 let Some ( branch_results) = self . frame_results ( target) ? else {
@@ -392,7 +392,7 @@ impl FuncTranslator {
392392 & mut self ,
393393 results : SlotSpan ,
394394 len_values : u16 ,
395- consume_fuel_instr : Option < Instr > ,
395+ consume_fuel_instr : Option < OpPos > ,
396396 ) -> Result < ( ) , Error > {
397397 match len_values {
398398 0 => Ok ( ( ) ) ,
@@ -415,8 +415,8 @@ impl FuncTranslator {
415415 & mut self ,
416416 result : Slot ,
417417 value : Operand ,
418- consume_fuel_instr : Option < Instr > ,
419- ) -> Result < Option < Instr > , Error > {
418+ consume_fuel_instr : Option < OpPos > ,
419+ ) -> Result < Option < OpPos > , Error > {
420420 let Some ( copy_instr) = Self :: make_copy_instr ( result, value, & mut self . layout ) ? else {
421421 // Case: no-op copy instruction
422422 return Ok ( None ) ;
@@ -490,7 +490,7 @@ impl FuncTranslator {
490490 results : SlotSpan ,
491491 values : SlotSpan ,
492492 len : u16 ,
493- consume_fuel_instr : Option < Instr > ,
493+ consume_fuel_instr : Option < OpPos > ,
494494 ) -> Result < ( ) , Error > {
495495 if results == values {
496496 // Case: results and values are equal and therefore the copy is a no-op
@@ -516,7 +516,7 @@ impl FuncTranslator {
516516 & mut self ,
517517 results : SlotSpan ,
518518 len : u16 ,
519- consume_fuel_instr : Option < Instr > ,
519+ consume_fuel_instr : Option < OpPos > ,
520520 ) -> Result < ( ) , Error > {
521521 self . peek_operands_into_buffer ( usize:: from ( len) ) ;
522522 let values = & self . operands [ ..] ;
@@ -689,7 +689,7 @@ impl FuncTranslator {
689689 !can_avoid_copies
690690 }
691691
692- /// Pins the `label` to the next [`Instr `].
692+ /// Pins the `label` to the next [`OpPos `].
693693 fn pin_label ( & mut self , label : LabelRef ) {
694694 self . labels
695695 . pin_label ( label, self . instrs . next_instr ( ) )
@@ -704,7 +704,7 @@ impl FuncTranslator {
704704 fn copy_operand_to_temp (
705705 & mut self ,
706706 operand : Operand ,
707- consume_fuel : Option < Instr > ,
707+ consume_fuel : Option < OpPos > ,
708708 ) -> Result < Slot , Error > {
709709 let result = self . layout . temp_to_slot ( operand. index ( ) ) ?;
710710 self . encode_copy ( result, operand, consume_fuel) ?;
@@ -758,7 +758,7 @@ impl FuncTranslator {
758758 & mut self ,
759759 instr : Op ,
760760 fuel_costs : impl FnOnce ( & FuelCostsProvider ) -> u64 ,
761- ) -> Result < Instr , Error > {
761+ ) -> Result < OpPos , Error > {
762762 let consume_fuel = self . stack . consume_fuel_instr ( ) ;
763763 let instr = self . instrs . push_instr ( instr, consume_fuel, fuel_costs) ?;
764764 Ok ( instr)
@@ -885,7 +885,7 @@ impl FuncTranslator {
885885 }
886886
887887 /// Encodes a generic return instruction.
888- fn encode_return ( & mut self , consume_fuel : Option < Instr > ) -> Result < Instr , Error > {
888+ fn encode_return ( & mut self , consume_fuel : Option < OpPos > ) -> Result < OpPos , Error > {
889889 let len_results = self . func_type_with ( FuncType :: len_results) ;
890890 let instr = match len_results {
891891 0 => Op :: Return { } ,
@@ -982,7 +982,7 @@ impl FuncTranslator {
982982 fn try_form_regspan_or_move (
983983 & mut self ,
984984 len : usize ,
985- consume_fuel_instr : Option < Instr > ,
985+ consume_fuel_instr : Option < OpPos > ,
986986 ) -> Result < SlotSpan , Error > {
987987 if let Some ( span) = self . try_form_regspan ( len) ? {
988988 return Ok ( span) ;
@@ -1099,7 +1099,7 @@ impl FuncTranslator {
10991099 _ => true ,
11001100 } ;
11011101 if end_of_else_reachable {
1102- let consume_fuel_instr: Option < Instr > = frame. consume_fuel_instr ( ) ;
1102+ let consume_fuel_instr: Option < OpPos > = frame. consume_fuel_instr ( ) ;
11031103 self . copy_branch_params ( & frame, consume_fuel_instr) ?;
11041104 }
11051105 self . push_frame_results ( & frame) ?;
@@ -1229,7 +1229,7 @@ impl FuncTranslator {
12291229 }
12301230
12311231 /// Encodes an unconditional Wasm `branch` instruction.
1232- fn encode_br ( & mut self , label : LabelRef ) -> Result < Instr , Error > {
1232+ fn encode_br ( & mut self , label : LabelRef ) -> Result < OpPos , Error > {
12331233 let instr = self . instrs . next_instr ( ) ;
12341234 let offset = self . labels . try_resolve_label ( label, instr) ?;
12351235 let br_instr = self . push_instr ( Op :: branch ( offset) , FuelCostsProvider :: base) ?;
@@ -1333,7 +1333,7 @@ impl FuncTranslator {
13331333 /// - Returns `Ok(None)`, otherwise.
13341334 fn try_make_fused_branch_cmp_instr (
13351335 & mut self ,
1336- instr : Instr ,
1336+ instr : OpPos ,
13371337 condition : TempOperand ,
13381338 label : LabelRef ,
13391339 negate : bool ,
0 commit comments