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

ruby-changes:53225

From: k0kubun <ko1@a...>
Date: Tue, 30 Oct 2018 23:57:09 +0900 (JST)
Subject: [ruby-changes:53225] k0kubun:r65440 (trunk): _mjit_compile_send.erb: do not inline tailcall ISeq

k0kubun	2018-10-30 23:57:03 +0900 (Tue, 30 Oct 2018)

  New Revision: 65440

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65440

  Log:
    _mjit_compile_send.erb: do not inline tailcall ISeq
    
    because it's not supported by this file. Also, shared `def_iseq_ptr`
    instead of copying the main definition of it.
    
    vm_core.h: moved `def_iseq_ptr` to this place. added `inline` to avoid
    compiler warnings since it's not used in some files including vm_core.h.
    vm_insnhelper.c: moved `def_iseq_ptr` to vm_core.h.

  Modified files:
    trunk/tool/ruby_vm/views/_mjit_compile_send.erb
    trunk/vm_core.h
    trunk/vm_insnhelper.c
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 65439)
+++ vm_core.h	(revision 65440)
@@ -507,6 +507,15 @@ rb_iseq_check(const rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/vm_core.h#L507
     return iseq;
 }
 
+static inline const rb_iseq_t *
+def_iseq_ptr(rb_method_definition_t *def)
+{
+#if VM_CHECK_MODE > 0
+    if (def->type != VM_METHOD_TYPE_ISEQ) rb_bug("def_iseq_ptr: not iseq (%d)", def->type);
+#endif
+    return rb_iseq_check(def->body.iseq.iseqptr);
+}
+
 enum ruby_special_exceptions {
     ruby_error_reenter,
     ruby_error_nomemory,
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 65439)
+++ vm_insnhelper.c	(revision 65440)
@@ -1590,15 +1590,6 @@ static inline VALUE vm_call_method(rb_ex https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1590
 
 static vm_call_handler vm_call_iseq_setup_func(const struct rb_call_info *ci, const int param_size, const int local_size);
 
-static const rb_iseq_t *
-def_iseq_ptr(rb_method_definition_t *def)
-{
-#if VM_CHECK_MODE > 0
-    if (def->type != VM_METHOD_TYPE_ISEQ) rb_bug("def_iseq_ptr: not iseq (%d)", def->type);
-#endif
-    return rb_iseq_check(def->body.iseq.iseqptr);
-}
-
 static VALUE
 vm_call_iseq_setup_tailcall_0start(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
 {
Index: tool/ruby_vm/views/_mjit_compile_send.erb
===================================================================
--- tool/ruby_vm/views/_mjit_compile_send.erb	(revision 65439)
+++ tool/ruby_vm/views/_mjit_compile_send.erb	(revision 65440)
@@ -23,7 +23,8 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_mjit_compile_send.erb#L23
         argc += ((ci->flag & VM_CALL_ARGS_BLOCKARG) ? 1 : 0);
 % end
 
-        if (cc_copy->me->def->type == VM_METHOD_TYPE_ISEQ && inlinable_iseq_p(ci, cc_copy, iseq = rb_iseq_check(cc_copy->me->def->body.iseq.iseqptr))) { /* CC_SET_FASTPATH in vm_callee_setup_arg */
+        if (!(ci->flag & VM_CALL_TAILCALL) && /* inlining non-tailcall path */
+            cc_copy->me->def->type == VM_METHOD_TYPE_ISEQ && inlinable_iseq_p(ci, cc_copy, iseq = def_iseq_ptr(cc_copy->me->def)) /* CC_SET_FASTPATH in vm_callee_setup_arg */) {
             int param_size = iseq->body->param.size; /* TODO: check calling->argc for argument_arity_error */
 
             fprintf(f, "{\n");

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

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