[前][次][番号順一覧][スレッド一覧]

ruby-changes:69061

From: John <ko1@a...>
Date: Thu, 21 Oct 2021 08:20:42 +0900 (JST)
Subject: [ruby-changes:69061] 3edf29668e (master): Add opt_regexpmatch2

https://git.ruby-lang.org/ruby.git/commit/?id=3edf29668e

From 3edf29668ee2f8015d560508accbb35c85568823 Mon Sep 17 00:00:00 2001
From: John Hawthorn <john@h...>
Date: Fri, 18 Jun 2021 17:32:13 -0700
Subject: Add opt_regexpmatch2

---
 test/ruby/test_yjit.rb | 10 ++++++++++
 yjit_codegen.c         |  7 +++++++
 2 files changed, 17 insertions(+)

diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb
index e485e5f64f..95e768ee0c 100644
--- a/test/ruby/test_yjit.rb
+++ b/test/ruby/test_yjit.rb
@@ -110,6 +110,16 @@ class TestYJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_yjit.rb#L110
     RUBY
   end
 
+  def test_opt_regexpmatch2
+    assert_compiles(<<~RUBY, insns: %i[opt_regexpmatch2], result: 0)
+      def foo(str)
+        str =~ /foo/
+      end
+
+      foo("foobar")
+    RUBY
+  end
+
   def test_compile_opt_getinlinecache
     assert_compiles(<<~RUBY, insns: %i[opt_getinlinecache], result: 123, min_calls: 2)
       def get_foo
diff --git a/yjit_codegen.c b/yjit_codegen.c
index b4733ef1ee..40feda345f 100644
--- a/yjit_codegen.c
+++ b/yjit_codegen.c
@@ -2240,6 +2240,12 @@ gen_opt_length(jitstate_t *jit, ctx_t *ctx) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L2240
     return gen_opt_send_without_block(jit, ctx);
 }
 
+static codegen_status_t
+gen_opt_regexpmatch2(jitstate_t *jit, ctx_t *ctx)
+{
+    return gen_opt_send_without_block(jit, ctx);
+}
+
 void
 gen_branchif_branch(codeblock_t* cb, uint8_t* target0, uint8_t* target1, uint8_t shape)
 {
@@ -3718,6 +3724,7 @@ yjit_init_codegen(void) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L3724
     yjit_reg_op(BIN(opt_not), gen_opt_not);
     yjit_reg_op(BIN(opt_size), gen_opt_size);
     yjit_reg_op(BIN(opt_length), gen_opt_length);
+    yjit_reg_op(BIN(opt_regexpmatch2), gen_opt_regexpmatch2);
     yjit_reg_op(BIN(opt_getinlinecache), gen_opt_getinlinecache);
     yjit_reg_op(BIN(opt_invokebuiltin_delegate), gen_opt_invokebuiltin_delegate);
     yjit_reg_op(BIN(opt_invokebuiltin_delegate_leave), gen_opt_invokebuiltin_delegate);
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]