@@ -443,7 +443,7 @@ impl<'a, C: ContextObject> JitCompiler<'a, C> {
443443
444444 match insn. opc {
445445 ebpf:: LD_DW_IMM if !self . executable . get_sbpf_version ( ) . disable_lddw ( ) => {
446- self . emit_validate_and_profile_instruction_count ( Some ( self . pc + 2 ) ) ;
446+ self . emit_validate_and_profile_instruction_count ( self . pc + 2 ) ;
447447 self . pc += 1 ;
448448 self . result . pc_section [ self . pc ] = unsafe { self . anchors [ ANCHOR_CALL_UNSUPPORTED_INSTRUCTION ] . offset_from ( self . result . text_section . as_ptr ( ) ) as u32 } ;
449449 ebpf:: augment_lddw_unchecked ( self . program , & mut insn) ;
@@ -722,7 +722,7 @@ impl<'a, C: ContextObject> JitCompiler<'a, C> {
722722
723723 // BPF_JMP class
724724 ebpf:: JA => {
725- self . emit_validate_and_profile_instruction_count ( Some ( target_pc) ) ;
725+ self . emit_validate_and_profile_instruction_count ( target_pc) ;
726726 let jump_offset = self . relative_to_target_pc ( target_pc, 5 ) ;
727727 self . emit_ins ( X86Instruction :: jump_immediate ( jump_offset) ) ;
728728 } ,
@@ -792,7 +792,7 @@ impl<'a, C: ContextObject> JitCompiler<'a, C> {
792792 || ( insn. opc == ebpf:: RETURN && !self . executable . get_sbpf_version ( ) . static_syscalls ( ) ) {
793793 return Err ( EbpfError :: UnsupportedInstruction ) ;
794794 }
795- self . emit_validate_and_profile_instruction_count ( Some ( 0 ) ) ;
795+ self . emit_validate_and_profile_instruction_count ( 0 ) ;
796796
797797 let call_depth_access = X86IndirectAccess :: Offset ( self . slot_in_vm ( RuntimeEnvironmentSlot :: CallDepth ) ) ;
798798 // If env.call_depth == 0, we've reached the exit instruction of the entry point
@@ -817,7 +817,7 @@ impl<'a, C: ContextObject> JitCompiler<'a, C> {
817817 if self . offset_in_text_section + MAX_MACHINE_CODE_LENGTH_PER_INSTRUCTION * 2 >= self . result . text_section . len ( ) {
818818 return Err ( EbpfError :: ExhaustedTextSegment ( self . pc ) ) ;
819819 }
820- self . emit_validate_and_profile_instruction_count ( Some ( self . pc + 1 ) ) ;
820+ self . emit_validate_and_profile_instruction_count ( self . pc + 1 ) ;
821821 self . emit_ins ( X86Instruction :: load_immediate ( REGISTER_SCRATCH , self . pc as i64 ) ) ; // Save pc
822822 self . emit_set_exception_kind ( EbpfError :: ExecutionOverrun ) ;
823823 self . emit_ins ( X86Instruction :: jump_immediate ( self . relative_to_anchor ( ANCHOR_THROW_EXCEPTION , 5 ) ) ) ;
@@ -982,8 +982,7 @@ impl<'a, C: ContextObject> JitCompiler<'a, C> {
982982 }
983983
984984 #[ inline]
985- fn emit_validate_and_profile_instruction_count ( & mut self , target_pc : Option < usize > ) {
986- let target_pc = target_pc. unwrap ( ) ;
985+ fn emit_validate_and_profile_instruction_count ( & mut self , target_pc : usize ) {
987986 self . last_instruction_meter_validation_pc = self . pc ;
988987 self . emit_ins ( X86Instruction :: load_immediate ( REGISTER_SCRATCH , ( ( ( target_pc << 32 ) | self . pc ) as i64 ) ^ self . immediate_value_key ) ) ;
989988 self . emit_ins ( X86Instruction :: call_immediate ( self . relative_to_anchor ( ANCHOR_VALIDATE_AND_PROFILE_INSTRUCTION_COUNT , 5 ) ) ) ;
@@ -1143,7 +1142,7 @@ impl<'a, C: ContextObject> JitCompiler<'a, C> {
11431142
11441143 #[ inline]
11451144 fn emit_syscall_dispatch ( & mut self , function : BuiltinFunction < C > ) {
1146- self . emit_validate_and_profile_instruction_count ( Some ( 0 ) ) ;
1145+ self . emit_validate_and_profile_instruction_count ( 0 ) ;
11471146 self . emit_ins ( X86Instruction :: load_immediate ( REGISTER_SCRATCH , function as usize as i64 ) ) ;
11481147 self . emit_ins ( X86Instruction :: call_immediate ( self . relative_to_anchor ( ANCHOR_EXTERNAL_FUNCTION_CALL , 5 ) ) ) ;
11491148 self . emit_undo_profile_instruction_count ( 0 ) ;
@@ -1218,7 +1217,7 @@ impl<'a, C: ContextObject> JitCompiler<'a, C> {
12181217
12191218 #[ inline]
12201219 fn emit_conditional_branch_reg ( & mut self , op : u8 , bitwise : bool , first_operand : X86Register , second_operand : X86Register , target_pc : usize ) {
1221- self . emit_validate_and_profile_instruction_count ( Some ( target_pc) ) ;
1220+ self . emit_validate_and_profile_instruction_count ( target_pc) ;
12221221 if bitwise { // Logical
12231222 self . emit_ins ( X86Instruction :: test ( OperandSize :: S64 , first_operand, second_operand, None ) ) ;
12241223 } else { // Arithmetic
@@ -1231,7 +1230,7 @@ impl<'a, C: ContextObject> JitCompiler<'a, C> {
12311230
12321231 #[ inline]
12331232 fn emit_conditional_branch_imm ( & mut self , op : u8 , bitwise : bool , immediate : i64 , second_operand : X86Register , target_pc : usize ) {
1234- self . emit_validate_and_profile_instruction_count ( Some ( target_pc) ) ;
1233+ self . emit_validate_and_profile_instruction_count ( target_pc) ;
12351234 if self . should_sanitize_constant ( immediate) {
12361235 self . emit_ins ( X86Instruction :: mov_mmx ( OperandSize :: S64 , REGISTER_SCRATCH , MM0 ) ) ;
12371236 self . emit_sanitized_load_immediate ( REGISTER_SCRATCH , immediate) ;
0 commit comments