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

ruby-changes:51556

From: shyouhei <ko1@a...>
Date: Thu, 28 Jun 2018 11:13:33 +0900 (JST)
Subject: [ruby-changes:51556] shyouhei:r63763 (trunk): give up insn attr handles_frame

shyouhei	2018-06-27 18:28:09 +0900 (Wed, 27 Jun 2018)

  New Revision: 63763

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

  Log:
    give up insn attr handles_frame
    
    I introduced this mechanism in r62051 to speed things up. Later it
    was reported that the change causes problems.  I searched for
    workarounds but nothing seemed appropriate.  I hereby officially
    give it up.  The idea to move ADD_PC around was a mistake.
    
    Fixes [Bug #14809] and [Bug #14834].
    
    Signed-off-by: Urabe, Shyouhei <shyouhei@r...>

  Modified files:
    trunk/gc.c
    trunk/insns.def
    trunk/test/ruby/test_settracefunc.rb
    trunk/tool/ruby_vm/models/bare_instructions.rb
    trunk/tool/ruby_vm/views/_insn_entry.erb
    trunk/tool/ruby_vm/views/_mjit_compile_insn_body.erb
    trunk/tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb
    trunk/vm_insnhelper.c
    trunk/vm_insnhelper.h
Index: gc.c
===================================================================
--- gc.c	(revision 63762)
+++ gc.c	(revision 63763)
@@ -1805,10 +1805,7 @@ rb_objspace_set_event_hook(const rb_even https://github.com/ruby/ruby/blob/trunk/gc.c#L1805
 static void
 gc_event_hook_body(rb_execution_context_t *ec, rb_objspace_t *objspace, const rb_event_flag_t event, VALUE data)
 {
-    /* increment PC because source line is calculated with PC-1 */
-    ec->cfp->pc++;
     EXEC_EVENT_HOOK(ec, event, ec->cfp->self, 0, 0, 0, data);
-    ec->cfp->pc--;
 }
 
 #define gc_event_hook_available_p(objspace) ((objspace)->flags.has_hook)
@@ -9955,4 +9952,3 @@ ruby_xrealloc2(void *ptr, size_t n, size https://github.com/ruby/ruby/blob/trunk/gc.c#L9952
 #endif
     return ruby_xrealloc2_body(ptr, n, new_size);
 }
-
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 63762)
+++ vm_insnhelper.c	(revision 63763)
@@ -1237,11 +1237,11 @@ vm_throw(const rb_execution_context_t *e https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1237
 }
 
 static inline void
-vm_expandarray(VALUE *sp, VALUE ary, rb_num_t num, int flag)
+vm_expandarray(rb_control_frame_t *cfp, VALUE ary, rb_num_t num, int flag)
 {
     int is_splat = flag & 0x01;
     rb_num_t space_size = num + is_splat;
-    VALUE *base = sp - 1;
+    VALUE *base = cfp->sp;
     const VALUE *ptr;
     rb_num_t len;
     const VALUE obj = ary;
@@ -1256,6 +1256,8 @@ vm_expandarray(VALUE *sp, VALUE ary, rb_ https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1256
 	len = (rb_num_t)RARRAY_LEN(ary);
     }
 
+    cfp->sp += space_size;
+
     if (flag & 0x02) {
 	/* post: ..., nil ,ary[-1], ..., ary[0..-num] # top */
 	rb_num_t i = 0, j;
Index: vm_insnhelper.h
===================================================================
--- vm_insnhelper.h	(revision 63762)
+++ vm_insnhelper.h	(revision 63763)
@@ -111,8 +111,6 @@ enum vm_regan_acttype { https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.h#L111
 #define INC_SP(x)  (VM_REG_SP += (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
 #define DEC_SP(x)  (VM_REG_SP -= (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
 #define SET_SV(x)  (*GET_SP() = (x))
-  /* set current stack value as x */
-#define ADJ_SP(x)  INC_SP(x)
 
 /* instruction sequence C struct */
 #define GET_ISEQ() (GET_CFP()->iseq)
@@ -192,6 +190,9 @@ enum vm_regan_acttype { https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.h#L190
 
 #define GET_BLOCK_HANDLER() (GET_LEP()[VM_ENV_DATA_INDEX_SPECVAL])
 
+#define WIDTH_OF_opt_send_without_block \
+    ((rb_snum_t)attr_width_opt_send_without_block(0, 0))
+
 /**********************************************************/
 /* deal with control flow 3: exception                    */
 /**********************************************************/
Index: tool/ruby_vm/views/_mjit_compile_insn_body.erb
===================================================================
--- tool/ruby_vm/views/_mjit_compile_insn_body.erb	(revision 63762)
+++ tool/ruby_vm/views/_mjit_compile_insn_body.erb	(revision 63763)
@@ -77,31 +77,6 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_mjit_compile_insn_body.erb#L77
         }
         fprintf(f, "            goto cancel;\n");
 %   else
-%     if insn.handles_frame?
-%       # If insn.handles_frame? is true, cfp->sp might be changed inside insns (like vm_caller_setup_arg_block)
-%       # and thus we need to use cfp->sp, even when local_stack_p is TRUE. When insn.handles_frame? is true,
-%       # cfp->sp should be available too because _mjit_compile_pc_and_sp.erb sets it.
         fprintf(f, <%= to_cstr.call(line) %>);
-%     else
-%       # If local_stack_p is TRUE and insn.handles_frame? is false, stack values are only available in local variables
-%       # for stack. So we need to replace those macros if local_stack_p is TRUE here.
-%       case line
-%       when /\bGET_SP\(\)/
-%         # reg_cfp->sp
-        fprintf(f, <%= to_cstr.call(line.sub(/\bGET_SP\(\)/, '%s')) %>, (status->local_stack_p ? "(stack + stack_size)" : "GET_SP()"));
-%       when /\bSTACK_ADDR_FROM_TOP\((?<num>[^)]+)\)/
-%         # #define STACK_ADDR_FROM_TOP(n) (GET_SP()-(n))
-%         num = Regexp.last_match[:num]
-        fprintf(f, <%= to_cstr.call(line.sub(/\bSTACK_ADDR_FROM_TOP\(([^)]+)\)/, '%s')) %>,
-                (status->local_stack_p ? "stack + (stack_size - (<%= num %>))" : "STACK_ADDR_FROM_TOP(<%= num %>)"));
-%       when /\bTOPN\((?<num>[^)]+)\)/
-%         # #define TOPN(n) (*(GET_SP()-(n)-1))
-%         num = Regexp.last_match[:num]
-        fprintf(f, <%= to_cstr.call(line.sub(/\bTOPN\(([^)]+)\)/, '%s')) %>,
-              (status->local_stack_p ? "*(stack + (stack_size - (<%= num %>) - 1))" : "TOPN(<%= num %>)"));
-%       else
-        fprintf(f, <%= to_cstr.call(line) %>);
-%       end
-%     end
 %   end
 % end
Index: tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb
===================================================================
--- tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb	(revision 63762)
+++ tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb	(revision 63763)
@@ -8,33 +8,19 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb#L8
 % # JIT: Move pc so that catch table lookup condition is met. If the ISeq might not catch an exception,
 % # the pc motion is optimized away and thus pc should be set properly before `goto cancel`.
         if (body->catch_except_p) {
-% if insn.handles_frame?
             fprintf(f, "    reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
-% else
-            fprintf(f, "    reg_cfp->pc = original_body_iseq + %d;\n", pos);
-% end
         }
 %
 % # JIT: move sp to use or preserve stack variables
         if (status->local_stack_p) {
-% # sp motion is optimized away for `handles_frame? #=> false` case.
-% # Thus sp should be set properly before `goto cancel`.
-% if insn.handles_frame?
 %           # JIT-only behavior (pushing JIT's local variables to VM's stack):
-            {
                 rb_snum_t i, push_size;
                 push_size = -<%= insn.call_attribute('sp_inc') %> + <%= insn.rets.size %> - <%= insn.pops.size %>;
                 fprintf(f, "    reg_cfp->sp = (VALUE *)reg_cfp->bp + %ld + 1;\n", push_size); /* POPN(INSN_ATTR(popn)); */
                 for (i = 0; i < push_size; i++) { /* TODO: use memcpy? */
                     fprintf(f, "    *(reg_cfp->sp + %ld) = stack[%ld];\n", i - push_size, (rb_snum_t)b->stack_size - push_size + i);
                 }
-            }
-% end
         }
         else {
-% if insn.handles_frame?
             fprintf(f, "    reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1 - <%= insn.pops.size %>); /* POPN(INSN_ATTR(popn)); */
-% else
-            fprintf(f, "    reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
-% end
         }
Index: tool/ruby_vm/views/_insn_entry.erb
===================================================================
--- tool/ruby_vm/views/_insn_entry.erb	(revision 63762)
+++ tool/ruby_vm/views/_insn_entry.erb	(revision 63763)
@@ -29,28 +29,17 @@ INSN_ENTRY(<%= insn.name %>) https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_insn_entry.erb#L29
     <%= pop[:name] %> = <%= insn.cast_from_VALUE pop, "TOPN(#{i})"%>;
 % end
     DEBUG_ENTER_INSN(INSN_ATTR(name));
-% if insn.handles_frame?
     ADD_PC(INSN_ATTR(width));
     POPN(INSN_ATTR(popn));
-% end
     COLLECT_USAGE_INSN(INSN_ATTR(bin));
 % insn.opes.each_with_index do |ope, i|
     COLLECT_USAGE_OPERAND(INSN_ATTR(bin), <%= i %>, <%= ope[:name] %>);
 % end
 <%= render_c_expr insn.expr -%>
     CHECK_VM_STACK_OVERFLOW_FOR_INSN(VM_REG_CFP, INSN_ATTR(retn));
-% if insn.handles_frame?
-%   insn.rets.reverse_each do |ret|
+%   insn.rets.each do |ret|
     PUSH(<%= insn.cast_to_VALUE ret %>);
 %   end
-% else
-    ADJ_SP(INSN_ATTR(sp_inc));
-%   insn.rets.reverse_each.with_index do |ret, i|
-    TOPN(<%= i %>) = <%= insn.cast_to_VALUE ret %>;
-%   end
-    ADD_PC(INSN_ATTR(width));
-    PREFETCH(GET_PC());
-% end
     END_INSN(<%= insn.name %>);
 #   undef INSN_ATTR
 #   undef NAME_OF_CURRENT_INSN
Index: tool/ruby_vm/models/bare_instructions.rb
===================================================================
--- tool/ruby_vm/models/bare_instructions.rb	(revision 63762)
+++ tool/ruby_vm/models/bare_instructions.rb	(revision 63763)
@@ -101,10 +101,6 @@ class RubyVM::BareInstructions https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/models/bare_instructions.rb#L101
     }.join
   end
 
-  def handles_frame?
-    /\b(false|0)\b/ !~ @attrs['handles_frame'].expr.expr
-  end
-
   def inspect
     sprintf "#<%s %s@%s:%d>", self.class.name, @name, @loc[0], @loc[1]
   end
@@ -129,7 +125,6 @@ class RubyVM::BareInstructions https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/models/bare_instructions.rb#L125
     generate_attribute 'rb_num_t', 'retn', rets.size
     generate_attribute 'rb_num_t', 'width', width
     generate_attribute 'rb_snum_t', 'sp_inc', rets.size - pops.size
-    generate_attribute 'bool', 'handles_frame', false
   end
 
   def typesplit a
Index: test/ruby/test_settracefunc.rb
===================================================================
--- test/ruby/test_settracefunc.rb	(revision 63762)
+++ test/ruby/test_settracefunc.rb	(revision 63763)
@@ -1901,4 +1901,17 @@ class TestSetTraceFunc < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/ruby/test_settracefunc.rb#L1901
     assert_equal ["c-call", base_line + 35],   events[9] # Thread#set_trace_func
     assert_equal nil,                          events[10]
   end
+
+  def test_lineno_in_optimized_insn
+    actual, _, _ = EnvUtil.invoke_ruby [], <<-EOF.gsub(/^.*?: */, ""), true
+      1: class String
+      2:   def -@
+      3:     puts caller_locations(1, 1)[0].lineno
+      4:   end
+      5: end
+      6:
+      7: -""
+    EOF
+    assert_equal "7\n", actual, '[Bug #14809]'
+  end
 end
Index: insns.def
===================================================================
--- insns.def	(revision 63762)
+++ insns.def	(revision 63763)
@@ -43,8 +43,6 @@ https://github.com/ruby/ruby/blob/trunk/insns.def#L43
        * sp_inc: Used to dynamically calculate sp increase in
          `insn_stack_increase`.
 
-       * handles_frame: If it is true, VM moves pc before insn body.
-
    - Attributes can access operands, but not stack (push/pop) variables.
 
    - An instruction's body is a pure C block, copied verbatimly into
@@ -366,6 +364,7 @@ concatstrings https://github.com/ruby/ruby/blob/trunk/insns.def#L364
 // attr rb_snum_t sp_inc = 1 - num;
 {
     val = rb_str_concat_literals(num, STACK_ADDR_FROM_TOP(num));
+    POPN(num);
 }
 
 /* push the result of to_s. */
@@ -401,6 +400,7 @@ toregexp https://github.com/ruby/ruby/blob/trunk/insns.def#L400
     const VALUE ary = rb_ary_tmp_new_from_values(0, cnt, STACK_ADDR_FROM_TOP(cnt));
     val = rb_reg_new_ary(ary, (int)opt);
     rb_ary_clear(ary);
+    POPN(cnt);
 }
 
 /* intern str to Symbol and push it. */
@@ -422,6 +422,7 @@ newarray https://github.com/ruby/ruby/blob/trunk/insns.def#L422
 // attr rb_snum_t sp_inc = 1 - num;
 {
     val = rb_ary_new4(num, STACK_ADDR_FROM_TOP(num));
+    POPN(num);
 }
 
 /* dup array */
@@ -450,7 +451,7 @@ expandarray https://github.com/ruby/ruby/blob/trunk/insns.def#L451
 (...)
 // attr rb_snum_t sp_inc = num - 1 + (flag & 1 ? 1 : 0);
 {
-    vm_expandarray(GET_SP(), ary, num, (int)flag);
+    vm_expandarray(GET_CFP(), ary, num, (int)flag);
 }
 
 /* concat two arrays */
@@ -487,6 +488,7 @@ newhash https://github.com/ruby/ruby/blob/trunk/insns.def#L488
 
     if (num) {
         rb_hash_bulk_insert(num, STACK_ADDR_FROM_TOP(num), val);
+        POPN(num);
     }
 }
 
@@ -536,6 +538,7 @@ dupn https://github.com/ruby/ruby/blob/trunk/insns.def#L538
     void *dst = GET_SP();
     void *src = STACK_ADDR_FROM_TOP(n);
 
+    INC_SP(n); /* alloca */
     MEMCPY(dst, src, VALUE, n);
 }
 
@@ -598,7 +601,7 @@ setn https://github.com/ruby/ruby/blob/trunk/insns.def#L601
 (VALUE val)
 // attr rb_snum_t sp_inc = 0;
 {
-    TOPN(n) = val;
+    TOPN(n - 1) = val;
 }
 
 /* empty current stack */
@@ -609,7 +612,7 @@ adjuststack https://github.com/ruby/ruby/blob/trunk/insns.def#L612
 (...)
 // attr rb_snum_t sp_inc = -(rb_snum_t)n;
 {
-    /* none */
+    POPN(n);
 }
 
 /**********************************************************/
@@ -687,7 +690,6 @@ defineclass https://github.com/ruby/ruby/blob/trunk/insns.def#L690
 (ID id, ISEQ class_iseq, rb_num_t flags)
 (VALUE cbase, VALUE super)
 (VALUE val)
-// attr bool handles_frame = true;
 {
     VALUE klass = vm_find_or_create_class_by_id(id, flags, cbase, super);
 
@@ -714,7 +716,6 @@ send https://github.com/ruby/ruby/blob/trunk/insns.def#L716
 (CALL_INFO ci, CALL_CACHE cc, ISEQ blockiseq)
 (...)
 (VALUE val)
-// attr bool handles_frame = true;
 // attr rb_snum_t sp_inc = - (int)(ci->orig_argc + ((ci->flag & VM_CALL_ARGS_BLOCKARG) ? 1 : 0));
 {
     struct rb_calling_info calling;
@@ -750,6 +751,7 @@ opt_newarray_max https://github.com/ruby/ruby/blob/trunk/insns.def#L751
 // attr rb_snum_t sp_inc = 1 - num;
 {
     val = vm_opt_newarray_max(num, STACK_ADDR_FROM_TOP(num));
+    POPN(num);
 }
 
 DEFINE_INSN
@@ -760,6 +762,7 @@ opt_newarray_min https://github.com/ruby/ruby/blob/trunk/insns.def#L762
 // attr rb_snum_t sp_inc = 1 - num;
 {
     val = vm_opt_newarray_min(num, STACK_ADDR_FROM_TOP(num));
+    POPN(num);
 }
 
 /* Invoke method without block */
@@ -768,7 +771,6 @@ opt_send_without_block https://github.com/ruby/ruby/blob/trunk/insns.def#L771
 (CALL_INFO ci, CALL_CACHE cc)
 (...)
 (VALUE val)
-// attr bool handles_frame = true;
 // attr rb_snum_t sp_inc = -ci->orig_argc;
 {
     struct rb_calling_info calling;
@@ -783,7 +785,6 @@ invokesuper https://github.com/ruby/ruby/blob/trunk/insns.def#L785
 (CALL_INFO ci, CALL_CACHE cc, ISEQ blockiseq)
 (...)
 (VALUE val)
-// attr bool handles_frame = true;
 // attr rb_snum_t sp_inc = - (int)(ci->orig_argc + ((ci->flag & VM_CALL_ARGS_BLOCKARG) ? 1 : 0));
 {
     struct rb_calling_info calling;
@@ -801,7 +802,6 @@ invokeblock https://github.com/ruby/ruby/blob/trunk/insns.def#L802
 (CALL_INFO ci)
 (...)
 (VALUE val)
-// attr bool handles_frame = true;
 // attr rb_snum_t sp_inc = 1 - ci->orig_argc;
 {
     struct rb_calling_info calling;
@@ -828,7 +828,6 @@ leave https://github.com/ruby/ruby/blob/trunk/insns.def#L828
 ()
 (VALUE val)
 (VALUE val)
-// attr bool handles_frame = true;
 {
     if (OPT_CHECKED_RUN) {
 	const VALUE *const bp = vm_base_ptr(reg_cfp);
@@ -990,6 +989,11 @@ opt_plus https://github.com/ruby/ruby/blob/trunk/insns.def#L989
     val = vm_opt_plus(recv, obj);
 
     if (val == Qundef) {
+#ifndef MJIT_HEADER
+        PUSH(recv);
+        PUSH(obj);
+        ADD_PC(-WIDTH_OF_opt_send_without_block);
+#endif
 	DISPATCH_ORIGINAL_INSN(opt_send_without_block);
     }
 }
@@ -1004,6 +1008,11 @@ opt_minus https://github.com/ruby/ruby/blob/trunk/insns.def#L1008
     val = vm_opt_minus(recv, obj);
 
     if (val == Qundef) {
+#ifndef MJIT_HEADER
+        PUSH(recv);
+        PUSH(obj);
+        ADD_PC(-WIDTH_OF_opt_send_without_block);
+#endif
 	DISPATCH_ORIGINAL_INSN(opt_send_without_block);
     }
 }
@@ -1018,6 +1027,11 @@ opt_mult https://github.com/ruby/ruby/blob/trunk/insns.def#L1027
     val = vm_opt_mult(recv, obj);
 
     if (val == Qundef) {
+#ifndef MJIT_HEADER
+        PUSH(recv);
+        PUSH(obj);
+        ADD_PC(-WIDTH_OF_opt_send_without_block);
+#endif
 	DISPATCH_ORIGINAL_INSN(opt_send_without_block);
     }
 }
@@ -1032,6 +1046,11 @@ opt_div https://github.com/ruby/ruby/blob/trunk/insns.def#L1046
     val = vm_opt_div(recv, obj);
 
     if (val == Qundef) {
+#ifndef MJIT_HEADER
+        PUSH(recv);
+        PUSH(obj);
+        ADD_PC(-WIDTH_OF_opt_send_without_block);
+#endif
 	DISPATCH_ORIGINAL_INSN(opt_send_without_block);
     }
 }
@@ -1046,6 +1065,11 @@ opt_mod https://github.com/ruby/ruby/blob/trunk/insns.def#L1065
     val = vm_opt_mod(recv, obj);
 
     if (val == Qundef) {
+#ifndef MJIT_HEADER
+        PUSH(recv);
+        PUSH(obj);
+        ADD_PC(-WIDTH_OF_opt_send_without_block);
+#endif
 	DISPATCH_ORIGINAL_INSN(opt_send_without_block);
     }
 }
@@ -1060,6 +1084,11 @@ opt_eq https://github.com/ruby/ruby/blob/trunk/insns.def#L1084
     val = opt_eq_func(recv, obj, ci, cc);
 
     if (val == Qundef) {
+#ifndef MJIT_HEADER
+        PUSH(recv);
+        PUSH(obj);
+        ADD_PC(-WIDTH_OF_opt_send_without_block);
+#endif
 	DISPATCH_ORIGINAL_INSN(opt_send_without_block);
     }
 }
@@ -1075,7 +1104,9 @@ opt_neq https://github.com/ruby/ruby/blob/trunk/insns.def#L1104
 
     if (val == Qundef) {
 #ifndef MJIT_HEADER
-	ADD_PC(2); /* !!! */
+        PUSH(recv);
+        PUSH(obj);
+        ADD_PC(-WIDTH_OF_opt_send_without_block);
 #endif
 	DISPATCH_ORIGINAL_INSN(opt_send_without_block);
     }
@@ -1091,6 +1122,11 @@ opt_lt https://github.com/ruby/ruby/blob/trunk/insns.def#L1122
     val = vm_opt_lt(recv, obj);
 
     if (val == Qundef) {
+#ifndef MJIT_HEADER
+        PUSH(recv);
+        PUSH(obj);
+        ADD_PC(-WIDTH_OF_opt_send_without_block);
+#endif
 	DISPATCH_ORIGINAL_INSN(opt_send_without_block);
     }
 }
@@ -1105,6 +1141,11 @@ opt_le https://github.com/ruby/ruby/blob/trunk/insns.def#L1141
     val = vm_opt_le(recv, obj);
 
     if (val == Qundef) {
+#ifndef MJIT_HEADER
+        PUSH(recv);
+        PUSH(obj);
+        ADD_PC(-WIDTH_OF_opt_send_without_block);
+#endif
 	DISPATCH_ORIGINAL_INSN(opt_send_without_block);
     }
 }
@@ -1119,6 +1160,11 @@ opt_gt https://github.com/ruby/ruby/blob/trunk/insns.def#L1160
     val = vm_opt_gt(recv, obj);
 
     if (val == Qundef) {
+#ifndef MJIT_HEADER
+        PUSH(recv);
+        PUSH(obj);
+        ADD_PC(-WIDTH_OF_opt_send_without_block);
+#endif
 	DISPATCH_ORIGINAL_INSN(opt_send_without_block);
     }
 }
@@ -1133,6 +1179,11 @@ opt_ge https://github.com/ruby/ruby/blob/trunk/insns.def#L1179
     val = vm_opt_ge(recv, obj);
 
     if (val == Qundef) {
+#ifndef MJIT_HEADER
+        PUSH(recv);
+        PUSH(obj);
+        ADD_PC(-WIDTH_OF_opt_send_without_block);
+#endif
 	DISPATCH_ORIGINAL_INSN(opt_send_without_block);
     }
 }
@@ -1147,6 +1198,11 @@ opt_ltlt https://github.com/ruby/ruby/blob/trunk/insns.def#L1198
     val = vm_opt_ltlt(recv, obj);
 
     if (val == Qundef) {
+#ifndef MJIT_HEADER
+        PUSH(recv);
+        PUSH(obj);
+        ADD_PC(-WIDTH_OF_opt_send_without_block);
+#endif
 	DISPATCH_ORIGINAL_INSN(opt_send_without_block);
     }
 }
@@ -1161,6 +1217,11 @@ opt_aref https://github.com/ruby/ruby/blob/trunk/insns.def#L1217
     val = vm_opt_aref(recv, obj);
 
     if (val == Qundef) {
+#ifndef MJIT_HEADER
+        PUSH(recv);
+        PUSH(obj);
+        ADD_PC(-WIDTH_OF_opt_send_without_block);
+#endif
 	DISPATCH_ORIGINAL_INSN(opt_send_without_block);
     }
 }
@@ -1175,6 +1236,12 @@ opt_aset https://github.com/ruby/ruby/blob/trunk/insns.def#L1236
     val = vm_opt_aset(recv, obj, set);
 
     if (val == Qundef) {
+#ifndef MJIT_HEADER
+        PUSH(recv);
+        PUSH(obj);
+        PUSH(set);
+        ADD_PC(-WIDTH_OF_opt_send_without_block);
+#endif
 	DISPATCH_ORIGINAL_INSN(opt_send_without_block);
     }
 }
@@ -1193,9 +1260,10 @@ opt_aset_with https://github.com/ruby/ruby/blob/trunk/insns.def#L1260
     }
     else {
 #ifndef MJIT_HEADER
-	TOPN(0) = rb_str_resurrect(key);
-	PUSH(val);
-	ADD_PC(1); /* !!! */
+        PUSH(recv);
+        PUSH(rb_str_resurrect(key));
+        PUSH(val);
+        ADD_PC(-WIDTH_OF_opt_send_without_block);
 #endif
 	DISPATCH_ORIGINAL_INSN(opt_send_without_block);
     }
@@ -1212,8 +1280,9 @@ opt_aref_with https://github.com/ruby/ruby/blob/trunk/insns.def#L1280
 
     if (val == Qundef) {
 #ifndef MJIT_HEADER
-	PUSH(rb_str_resurrect(key));
-	ADD_PC(1); /* !!! */
+        PUSH(recv);
+        PUSH(rb_str_resurrect(key));
+        ADD_PC(-WIDTH_OF_opt_send_without_block);
 #endif
 	DISPATCH_ORIGINAL_INSN(opt_send_w (... truncated)

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

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