summaryrefslogtreecommitdiff
path: root/test/ruby/test_zjit.rb
diff options
context:
space:
mode:
authorStan Lo <stan.lo@shopify.com>2025-09-02 20:20:08 +0100
committerGitHub <noreply@github.com>2025-09-02 19:20:08 +0000
commit77a421fb057c16cd82adbe6e07efe0db01bf93a5 (patch)
tree900beb9c653dd4adb45987e94adba12ded0f37e8 /test/ruby/test_zjit.rb
parente0a7da93d25cf9a4fced323ce3344fc390b59ad7 (diff)
ZJIT: Clear jit entry from iseqs after TracePoint activation (#14407)
ZJIT: Remove JITed code after TracePoint is enabled
Diffstat (limited to 'test/ruby/test_zjit.rb')
-rw-r--r--test/ruby/test_zjit.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb
index e79e80fb44..0353a48eec 100644
--- a/test/ruby/test_zjit.rb
+++ b/test/ruby/test_zjit.rb
@@ -2202,6 +2202,44 @@ class TestZJIT < Test::Unit::TestCase
}
end
+ def test_global_tracepoint
+ assert_compiles 'true', %q{
+ def foo = 1
+
+ foo
+ foo
+
+ called = false
+
+ tp = TracePoint.new(:return) { |event|
+ if event.method_id == :foo
+ called = true
+ end
+ }
+ tp.enable do
+ foo
+ end
+ called
+ }
+ end
+
+ def test_local_tracepoint
+ assert_compiles 'true', %q{
+ def foo = 1
+
+ foo
+ foo
+
+ called = false
+
+ tp = TracePoint.new(:return) { |_| called = true }
+ tp.enable(target: method(:foo)) do
+ foo
+ end
+ called
+ }
+ end
+
private
# Assert that every method call in `test_script` can be compiled by ZJIT