-
Notifications
You must be signed in to change notification settings - Fork 5.5k
ZJIT: Clear jit entry from iseqs after TracePoint activation #14407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZJIT: Clear jit entry from iseqs after TracePoint activation #14407
Conversation
4a292de
to
6a4b985
Compare
zjit/src/codegen.rs
Outdated
// Do not test the JIT code in HIR tests | ||
if cfg!(test) { | ||
return std::ptr::null(); | ||
} | ||
|
||
// Check if c_call or c_return tracing is enabled - if so, don't compile | ||
if unsafe { rb_c_method_tracing_currently_enabled(ec) } { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why check that here? If you're trying to mimic what YJIT does, it should be a side exit on HIR instructions for C method calls (or dynamic dispatch that can be C method calls). We generally don't want to fail the compilation (return null()
).
It only impacts JIT entries after TracePoint is enabled, which would miss returning from a non-leaf call to JIT code since we have no such patch points yet, but I guess it's fine to start from supporting just that. |
82465f8
to
328ef59
Compare
328ef59
to
07eb3b6
Compare
Thanks for the pointer. I tried to add a new patch point for that in #14420 but it's currently not working 😞 I'll log more info about it there |
zjit/src/gc.rs
Outdated
@@ -222,3 +222,14 @@ pub fn remove_gc_offsets(payload_ptr: *mut IseqPayload, removed_range: &Range<Co | |||
fn ranges_overlap<T>(left: &Range<T>, right: &Range<T>) -> bool where T: PartialOrd { | |||
left.start < right.end && right.start < left.end | |||
} | |||
|
|||
/// Iterate over all existing ISEQs | |||
pub fn for_each_iseq<F: FnMut(IseqPtr)>(mut callback: F) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about putting this in cruby.rs
? Unless gc.rs
uses it by itself, it has nothing to do with GC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
07eb3b6
to
2a5a9bf
Compare
This will allow TracePoint events to be triggered when calling previously JITed methods from the interpreter.
I also opened #14420 to find ways to add a new patch point for TracePoint but it's not working atm.