@@ -3076,11 +3076,15 @@ c_callable! {
30763076 unsafe { Rc :: increment_strong_count( iseq_call_ptr as * const IseqCall ) ; }
30773077 let iseq_call = unsafe { Rc :: from_raw( iseq_call_ptr as * const IseqCall ) } ;
30783078 let iseq = iseq_call. iseq. get( ) ;
3079- let entry_insn_idxs = crate :: hir:: jit_entry_insns( iseq) ;
3079+ let params = unsafe { iseq. params( ) } ;
3080+ let entry_idx = iseq_call. jit_entry_idx. to_usize( ) ;
3081+ let entry_insn_idx = params. opt_table_slice( ) . get( entry_idx)
3082+ . unwrap_or_else( || panic!( "function_stub: opt_table out of bounds. {params:#?}, entry_idx={entry_idx}" ) )
3083+ . as_u32( ) ;
30803084 // gen_push_frame() doesn't set PC or ISEQ, so we need to set them before exit.
30813085 // function_stub_hit_body() may allocate and call gc_validate_pc(), so we always set PC and ISEQ.
30823086 // Clear jit_return so the interpreter reads cfp->pc and cfp->iseq directly.
3083- let pc = unsafe { rb_iseq_pc_at_idx( iseq, entry_insn_idxs [ iseq_call . jit_entry_idx . to_usize ( ) ] ) } ;
3087+ let pc = unsafe { rb_iseq_pc_at_idx( iseq, entry_insn_idx ) } ;
30843088 unsafe { rb_set_cfp_pc( cfp, pc) } ;
30853089 unsafe { ( * cfp) . _iseq = iseq } ;
30863090 unsafe { ( * cfp) . jit_return = std:: ptr:: null_mut( ) } ;
@@ -3501,7 +3505,7 @@ impl Assembler {
35013505
35023506/// Store info about a JIT entry point
35033507pub struct JITEntry {
3504- /// Index that corresponds to [crate::hir::jit_entry_insns ]
3508+ /// Index that corresponds to an entry in [crate::cruby::IseqParameters::opt_table_slice ]
35053509 jit_entry_idx : usize ,
35063510 /// Position where the entry point starts
35073511 start_addr : Cell < Option < CodePtr > > ,
@@ -3524,7 +3528,7 @@ pub struct IseqCall {
35243528 /// Callee ISEQ that start_addr jumps to
35253529 pub iseq : Cell < IseqPtr > ,
35263530
3527- /// Index that corresponds to [crate::hir::jit_entry_insns ]
3531+ /// Index that corresponds to an entry in [crate::cruby::IseqParameters::opt_table_slice ]
35283532 jit_entry_idx : u16 ,
35293533
35303534 /// Argument count passing to the HIR function
0 commit comments