summaryrefslogtreecommitdiff
path: root/yjit
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2024-05-01 10:22:41 -0400
committerGitHub <noreply@github.com>2024-05-01 10:22:41 -0400
commit2a978ee04732e719fb905af1baa03932b68a048a (patch)
tree79ed5387c12ef6ff2384ef4ecdef74a48e8c51e3 /yjit
parentf4c6479eeabc2b691f07f9421b7e7d59a7f53921 (diff)
YJIT: Fix `Struct` accessors not firing tracing events (#10690)
* YJIT: Fix `Struct` accessors not firing tracing events Reading and writing to structs should fire `c_call` and `c_return`, but YJIT wasn't correctly dropping those calls when tracing. This has been missing since this functionality was added in 3081c83169c, but the added test only fails when ran in isolation with `--yjit-call-threshold=1`. The test sometimes failed on CI. * RJIT: YJIT: Fix `Struct` readers not firing tracing events Same issue as YJIT, but it looks like RJIT doesn't support writing to structs, so only reading needs changing.
Diffstat (limited to 'yjit')
-rw-r--r--yjit/src/codegen.rs20
1 files changed, 16 insertions, 4 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index ab5f00db1b..072d96f1b0 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -8309,6 +8309,13 @@ fn gen_struct_aref(
}
}
+ if c_method_tracing_currently_enabled(jit) {
+ // Struct accesses need fire c_call and c_return events, which we can't support
+ // See :attr-tracing:
+ gen_counter_incr(asm, Counter::send_cfunc_tracing);
+ return None;
+ }
+
// This is a .send call and we need to adjust the stack
if flags & VM_CALL_OPT_SEND != 0 {
handle_opt_send_shift_stack(asm, argc);
@@ -8353,6 +8360,13 @@ fn gen_struct_aset(
return None;
}
+ if c_method_tracing_currently_enabled(jit) {
+ // Struct accesses need fire c_call and c_return events, which we can't support
+ // See :attr-tracing:
+ gen_counter_incr(asm, Counter::send_cfunc_tracing);
+ return None;
+ }
+
// This is a .send call and we need to adjust the stack
if flags & VM_CALL_OPT_SEND != 0 {
handle_opt_send_shift_stack(asm, argc);
@@ -8619,10 +8633,8 @@ fn gen_send_general(
// Handling the C method tracing events for attr_accessor
// methods is easier than regular C methods as we know the
// "method" we are calling into never enables those tracing
- // events. Once global invalidation runs, the code for the
- // attr_accessor is invalidated and we exit at the closest
- // instruction boundary which is always outside of the body of
- // the attr_accessor code.
+ // events. We are never inside the code that needs to be
+ // invalidated when invalidation happens.
gen_counter_incr(asm, Counter::send_cfunc_tracing);
return None;
}