@@ -580,16 +580,7 @@ impl ExecutingFrame<'_> {
580580
581581 let lasti_before = self . lasti ( ) ;
582582 let result = self . execute_instruction ( op, arg, & mut do_extend_arg, vm) ;
583- // Skip past CACHE code units, but only if the instruction did not
584- // modify lasti (i.e., it did not jump). Jump targets already point
585- // past CACHE entries since labels include them.
586- if self . lasti ( ) == lasti_before {
587- let base_op = op. to_base ( ) . unwrap_or ( op) ;
588- let caches = base_op. cache_entries ( ) ;
589- if caches > 0 {
590- self . update_lasti ( |i| * i += caches as u32 ) ;
591- }
592- }
583+ self . skip_caches_if_fallthrough ( op, lasti_before) ;
593584 match result {
594585 Ok ( None ) => { }
595586 Ok ( Some ( value) ) => {
@@ -2865,14 +2856,7 @@ impl ExecutingFrame<'_> {
28652856 let mut do_extend_arg = false ;
28662857 self . execute_instruction ( original_op, arg, & mut do_extend_arg, vm)
28672858 } ;
2868- // Skip CACHE entries for the real instruction (only if it didn't jump)
2869- if self . lasti ( ) == lasti_before_dispatch {
2870- let base = original_op. to_base ( ) . unwrap_or ( original_op) ;
2871- let caches = base. cache_entries ( ) ;
2872- if caches > 0 {
2873- self . update_lasti ( |i| * i += caches as u32 ) ;
2874- }
2875- }
2859+ self . skip_caches_if_fallthrough ( original_op, lasti_before_dispatch) ;
28762860 result
28772861 }
28782862 Instruction :: InstrumentedInstruction => {
@@ -2904,14 +2888,7 @@ impl ExecutingFrame<'_> {
29042888 let mut do_extend_arg = false ;
29052889 self . execute_instruction ( original_op, arg, & mut do_extend_arg, vm)
29062890 } ;
2907- // Skip CACHE entries for the real instruction (only if it didn't jump)
2908- if self . lasti ( ) == lasti_before_dispatch {
2909- let base = original_op. to_base ( ) . unwrap_or ( original_op) ;
2910- let caches = base. cache_entries ( ) ;
2911- if caches > 0 {
2912- self . update_lasti ( |i| * i += caches as u32 ) ;
2913- }
2914- }
2891+ self . skip_caches_if_fallthrough ( original_op, lasti_before_dispatch) ;
29152892 result
29162893 }
29172894 _ => {
@@ -3575,6 +3552,19 @@ impl ExecutingFrame<'_> {
35753552 self . update_lasti ( |i| * i = target) ;
35763553 }
35773554
3555+ /// Skip past CACHE code units after an instruction, but only if the
3556+ /// instruction did not modify lasti (i.e., it did not jump).
3557+ #[ inline]
3558+ fn skip_caches_if_fallthrough ( & mut self , op : Instruction , lasti_before : u32 ) {
3559+ if self . lasti ( ) == lasti_before {
3560+ let base = op. to_base ( ) . unwrap_or ( op) ;
3561+ let caches = base. cache_entries ( ) ;
3562+ if caches > 0 {
3563+ self . update_lasti ( |i| * i += caches as u32 ) ;
3564+ }
3565+ }
3566+ }
3567+
35783568 #[ inline]
35793569 fn pop_jump_if_relative (
35803570 & mut self ,
0 commit comments