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

ruby-changes:73261

From: Takashi <ko1@a...>
Date: Tue, 30 Aug 2022 01:05:15 +0900 (JST)
Subject: [ruby-changes:73261] 2b85295d28 (master): Port objtostring to the new backend (https://github.com/Shopify/ruby/pull/369)

https://git.ruby-lang.org/ruby.git/commit/?id=2b85295d28

From 2b85295d2845ee7ebefe04bcdda48970694ff0ad Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Fri, 5 Aug 2022 10:47:35 -0700
Subject: Port objtostring to the new backend
 (https://github.com/Shopify/ruby/pull/369)

---
 bootstraptest/test_yjit.rb |  4 ++--
 yjit/src/codegen.rs        | 16 +++++++---------
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb
index 16eda7fa84..826e0066fa 100644
--- a/bootstraptest/test_yjit.rb
+++ b/bootstraptest/test_yjit.rb
@@ -3096,7 +3096,7 @@ assert_equal 'true', %q{ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_yjit.rb#L3096
     foo()
 }
 
-# toregexp
+# toregexp, objtostring
 assert_equal '/true/', %q{
     def foo()
       /#{true}/
@@ -3104,7 +3104,7 @@ assert_equal '/true/', %q{ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_yjit.rb#L3104
     foo().inspect
 }
 
-# concatstrings
+# concatstrings, objtostring
 assert_equal '9001', %q{
     def foo()
       "#{9001}"
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index 8b724a1fc9..d054697e53 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -2274,7 +2274,7 @@ fn gen_concatstrings( https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L2274
     // Save the PC and SP because we are allocating
     jit_prepare_routine_call(jit, ctx, asm);
 
-    let values_ptr = ctx.sp_opnd(-((SIZEOF_VALUE as isize) * n.as_isize()));
+    let values_ptr = asm.lea(ctx.sp_opnd(-((SIZEOF_VALUE as isize) * n.as_isize())));
 
     // call rb_str_concat_literals(long n, const VALUE *strings);
     let return_value = asm.ccall(
@@ -5317,15 +5317,14 @@ fn gen_anytostring( https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L5317
     KeepCompiling
 }
 
-/*
 fn gen_objtostring(
     jit: &mut JITState,
     ctx: &mut Context,
-    cb: &mut CodeBlock,
+    asm: &mut Assembler,
     ocb: &mut OutlinedCb,
 ) -> CodegenStatus {
     if !jit_at_current_insn(jit) {
-        defer_compilation(jit, ctx, cb, ocb);
+        defer_compilation(jit, ctx, asm, ocb);
         return EndBlock;
     }
 
@@ -5338,7 +5337,7 @@ fn gen_objtostring( https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L5337
         jit_guard_known_klass(
             jit,
             ctx,
-            cb,
+            asm,
             ocb,
             comptime_recv.class_of(),
             recv,
@@ -5351,10 +5350,9 @@ fn gen_objtostring( https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L5350
         KeepCompiling
     } else {
         let cd = jit_get_arg(jit, 0).as_ptr();
-        gen_send_general(jit, ctx, cb, ocb, cd, None)
+        gen_send_general(jit, ctx, asm, ocb, cd, None)
     }
 }
-*/
 
 fn gen_intern(
     jit: &mut JITState,
@@ -5388,7 +5386,7 @@ fn gen_toregexp( https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L5386
     // raise an exception.
     jit_prepare_routine_call(jit, ctx, asm);
 
-    let values_ptr = ctx.sp_opnd(-((SIZEOF_VALUE as isize) * (cnt as isize)));
+    let values_ptr = asm.lea(ctx.sp_opnd(-((SIZEOF_VALUE as isize) * (cnt as isize))));
     ctx.stack_pop(cnt);
 
     let ary = asm.ccall(
@@ -6011,7 +6009,7 @@ fn get_gen_fn(opcode: VALUE) -> Option<InsnGenFn> { https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L6009
         YARVINSN_getglobal => Some(gen_getglobal),
         YARVINSN_setglobal => Some(gen_setglobal),
         YARVINSN_anytostring => Some(gen_anytostring),
-        //YARVINSN_objtostring => Some(gen_objtostring),
+        YARVINSN_objtostring => Some(gen_objtostring),
         YARVINSN_intern => Some(gen_intern),
         YARVINSN_toregexp => Some(gen_toregexp),
         YARVINSN_getspecial => Some(gen_getspecial),
-- 
cgit v1.2.1


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

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