diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2022-11-13 12:51:19 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-13 12:51:19 -0500 |
commit | bc8ba244b8524c8537eda4ca79f880312c8f4528 (patch) | |
tree | a395f0af0c73391f10b8647fc007c8a56e3b1ade /bootstraptest | |
parent | a1b460bd6e4b53ce41771669d39a4a6f414bf35f (diff) | |
download | ruby-bc8ba244b8524c8537eda4ca79f880312c8f4528.tar.gz |
YJIT: Fix invalidation for c_call and c_return (#6719)
Follow-up for 2b8191bdad7545b71f270d2b25a34cd2b3afa02f. Since that
commit, we stopped doing code invalidation the second time the call and
return events are enabled. We need to do it every time these events are
enabled because we might have generated code while these events are
disabled.
Also rename locals and edit comments to make it more clear that the iseq
rewrite code path only happens the first time a particular iseq trace
event is enabled.
Diffstat (limited to 'bootstraptest')
-rw-r--r-- | bootstraptest/test_yjit.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index 7361d2a725..c5bb681e84 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -2249,6 +2249,26 @@ assert_equal '[[:c_return, :itself, main]]', %q{ events } +# test c_call invalidation +assert_equal '[[:c_call, :itself]]', %q{ + # enable the event once to make sure invalidation + # happens the second time we enable it + TracePoint.new(:c_call) {}.enable{} + + def compiled + itself + end + + # assume first call compiles + compiled + + events = [] + tp = TracePoint.new(:c_call) { |tp| events << [tp.event, tp.method_id] } + tp.enable { compiled } + + events +} + # test enabling tracing for a suspended fiber assert_equal '[[:return, 42]]', %q{ def traced_method |