@@ -63,17 +63,14 @@ pub(super) fn gc_fastpath_new_obj(
6363 return slow_path ( asm) ;
6464 } ;
6565
66- // The default GC's inline fast path bumps the ractor cache cursor in emitted
67- // code without calling rb_newobj, so it can't fire the NEWOBJ internal event.
68- // If such a hook is active, use the C path instead; otherwise assume none is
69- // active and install a patch point that discards this code if one is enabled
70- // later. (MMTk's fast path checks for the hook at run time, so it needs neither.)
71- if let PreparedNewObjFastpath :: Default ( _) = & fastpath {
72- if unsafe { rb_zjit_newobj_hook_enabled_p ( ) } {
73- return slow_path ( asm) ;
74- }
75- gen_patch_point ( jit, asm, function, & Invariant :: NoNewObjHook , state) ;
66+ // Both inline fast paths bump an allocation cursor without calling rb_newobj,
67+ // so neither fires the NEWOBJ internal event. If such a hook is active, use the
68+ // C path; otherwise assume none is active and install a patch point that
69+ // discards this code if one is enabled later.
70+ if unsafe { rb_zjit_newobj_hook_enabled_p ( ) } {
71+ return slow_path ( asm) ;
7672 }
73+ gen_patch_point ( jit, asm, function, & Invariant :: NoNewObjHook , state) ;
7774
7875 asm_comment ! ( asm, "GC inline allocation" ) ;
7976
@@ -122,7 +119,6 @@ fn prepare_new_obj_fastpath(alloc_size: usize, flags: u64, klass: VALUE) -> Opti
122119 let fastpath = unsafe { fastpath. data . mmtk } ;
123120 if fastpath. objspace . is_null ( )
124121 || fastpath. gc_stress_p_func == 0
125- || fastpath. newobj_tracing_p_func == 0
126122 || fastpath. post_alloc_func == 0
127123 || fastpath. min_obj_align == 0
128124 || !fastpath. min_obj_align . is_power_of_two ( )
@@ -246,17 +242,11 @@ fn emit_mmtk_new_obj_fastpath(
246242 . try_into ( )
247243 . ok ( ) ?;
248244 let value_size_shift: u64 = fastpath. value_size_shift . try_into ( ) . ok ( ) ?;
249- let newobj_tracing_p_func = ( fastpath. newobj_tracing_p_func != 0 )
250- . then_some ( fastpath. newobj_tracing_p_func as * const u8 ) ?;
251245 let gc_stress_p_func = ( fastpath. gc_stress_p_func != 0 )
252246 . then_some ( fastpath. gc_stress_p_func as * const u8 ) ?;
253247 let post_alloc_func = ( fastpath. post_alloc_func != 0 )
254248 . then_some ( fastpath. post_alloc_func as * const u8 ) ?;
255249
256- let event_hook = asm. ccall ( newobj_tracing_p_func, vec ! [ ] ) ;
257- asm. test ( event_hook, event_hook) ;
258- asm. jnz ( jit, miss. clone ( ) ) ;
259-
260250 let objspace_const = Opnd :: const_ptr ( fastpath. objspace ) ;
261251 let gc_stress = asm. ccall ( gc_stress_p_func, vec ! [ objspace_const] ) ;
262252 asm. test ( gc_stress, gc_stress) ;
0 commit comments