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

ruby-changes:68747

From: Alan <ko1@a...>
Date: Thu, 21 Oct 2021 08:13:25 +0900 (JST)
Subject: [ruby-changes:68747] 56ce40e8be (master): Only compile iseqs with simple parameters. Enable get_local_wc1

https://git.ruby-lang.org/ruby.git/commit/?id=56ce40e8be

From 56ce40e8becc26afd089802cee7c09e8c3d698ce Mon Sep 17 00:00:00 2001
From: Alan Wu <XrXr@u...>
Date: Wed, 3 Feb 2021 16:54:25 -0500
Subject: Only compile iseqs with simple parameters. Enable get_local_wc1

---
 ujit_codegen.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/ujit_codegen.c b/ujit_codegen.c
index ad5d1b18b0..50bc4f77b1 100644
--- a/ujit_codegen.c
+++ b/ujit_codegen.c
@@ -1112,6 +1112,8 @@ gen_opt_swb_cfunc(jitstate_t* jit, ctx_t* ctx, struct rb_call_data * cd, const r https://github.com/ruby/ruby/blob/trunk/ujit_codegen.c#L1112
     return true;
 }
 
+bool rb_simple_iseq_p(const rb_iseq_t *iseq);
+
 static bool
 gen_opt_swb_iseq(jitstate_t* jit, ctx_t* ctx, struct rb_call_data * cd, const rb_callable_method_entry_t *cme, int32_t argc)
 {
@@ -1120,13 +1122,19 @@ gen_opt_swb_iseq(jitstate_t* jit, ctx_t* ctx, struct rb_call_data * cd, const rb https://github.com/ruby/ruby/blob/trunk/ujit_codegen.c#L1122
     int num_params = iseq->body->param.size;
     int num_locals = iseq->body->local_table_size - num_params;
 
-    rb_gc_register_mark_object((VALUE)iseq); // FIXME: intentional LEAK!
-
     if (num_params != argc) {
         //fprintf(stderr, "param argc mismatch\n");
         return false;
     }
 
+    if (!rb_simple_iseq_p(iseq)) {
+        // Only handle iseqs that have simple parameters.
+        // See vm_callee_setup_arg().
+        return false;
+    }
+
+    rb_gc_register_mark_object((VALUE)iseq); // FIXME: intentional LEAK!
+
     // Create a size-exit to fall back to the interpreter
     uint8_t* side_exit = ujit_side_exit(jit, ctx);
 
@@ -1375,7 +1383,7 @@ ujit_init_codegen(void) https://github.com/ruby/ruby/blob/trunk/ujit_codegen.c#L1383
     ujit_reg_op(BIN(putobject_INT2FIX_1_), gen_putobject_int2fix, false);
     ujit_reg_op(BIN(putself), gen_putself, false);
     ujit_reg_op(BIN(getlocal_WC_0), gen_getlocal_wc0, false);
-    //ujit_reg_op(BIN(getlocal_WC_1), gen_getlocal_wc1, false);
+    ujit_reg_op(BIN(getlocal_WC_1), gen_getlocal_wc1, false);
     ujit_reg_op(BIN(setlocal_WC_0), gen_setlocal_wc0, false);
     ujit_reg_op(BIN(getinstancevariable), gen_getinstancevariable, false);
     ujit_reg_op(BIN(setinstancevariable), gen_setinstancevariable, false);
-- 
cgit v1.2.1


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

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