File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3672,11 +3672,7 @@ rb_execution_context_update(rb_execution_context_t *ec)
36723672 const VALUE * ep = cfp -> ep ;
36733673 cfp -> self = rb_gc_location (cfp -> self );
36743674 if (rb_zjit_enabled_p && CFP_HAS_JIT_RETURN (cfp )) {
3675- zjit_jit_frame_t * jit_frame = (zjit_jit_frame_t * )cfp -> jit_return ;
3676- if (jit_frame -> iseq ) {
3677- // ISEQ frame with JITFrame: relocate iseq in JITFrame
3678- jit_frame -> iseq = (const rb_iseq_t * )rb_gc_location ((VALUE )jit_frame -> iseq );
3679- }
3675+ rb_zjit_jit_frame_update_references ((zjit_jit_frame_t * )cfp -> jit_return );
36803676 // block_code must always be relocated. For ISEQ frames, the JIT caller
36813677 // may have written it (gen_block_handler_specval) for passing blocks.
36823678 // For C frames, rb_iterate0 may have written an ifunc to block_code
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ void rb_zjit_before_ractor_spawn(void);
4545void rb_zjit_tracing_invalidate_all (void );
4646void rb_zjit_invalidate_no_singleton_class (VALUE klass );
4747void rb_zjit_invalidate_root_box (void );
48+ void rb_zjit_jit_frame_update_references (zjit_jit_frame_t * jit_frame );
4849#else
4950#define rb_zjit_entry 0
5051static inline void rb_zjit_compile_iseq (const rb_iseq_t * iseq , rb_execution_context_t * ec , bool jit_exception ) {}
@@ -58,6 +59,7 @@ static inline void rb_zjit_before_ractor_spawn(void) {}
5859static inline void rb_zjit_tracing_invalidate_all (void ) {}
5960static inline void rb_zjit_invalidate_no_singleton_class (VALUE klass ) {}
6061static inline void rb_zjit_invalidate_root_box (void ) {}
62+ static inline void rb_zjit_jit_frame_update_references (zjit_jit_frame_t * jit_frame ) {}
6163#endif // #if USE_ZJIT
6264
6365#define rb_zjit_enabled_p (rb_zjit_entry != 0)
Original file line number Diff line number Diff line change @@ -43,6 +43,13 @@ impl JITFrame {
4343 }
4444}
4545
46+ /// Update the iseq pointer in an on-stack JITFrame during GC compaction.
47+ /// Called from rb_execution_context_update in vm.c.
48+ #[ unsafe( no_mangle) ]
49+ pub extern "C" fn rb_zjit_jit_frame_update_references ( jit_frame : * mut JITFrame ) {
50+ unsafe { & mut * jit_frame } . update_references ( ) ;
51+ }
52+
4653#[ cfg( test) ]
4754mod tests {
4855 use crate :: cruby:: { eval, inspect} ;
You can’t perform that action at this time.
0 commit comments