summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2022-11-13 12:51:19 -0500
committerGitHub <noreply@github.com>2022-11-13 12:51:19 -0500
commitbc8ba244b8524c8537eda4ca79f880312c8f4528 (patch)
treea395f0af0c73391f10b8647fc007c8a56e3b1ade /bootstraptest
parenta1b460bd6e4b53ce41771669d39a4a6f414bf35f (diff)
downloadruby-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.rb20
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