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

ruby-changes:52634

From: k0kubun <ko1@a...>
Date: Wed, 26 Sep 2018 10:11:26 +0900 (JST)
Subject: [ruby-changes:52634] k0kubun:r64846 (trunk): revert r64838 and r64839

k0kubun	2018-09-26 10:11:20 +0900 (Wed, 26 Sep 2018)

  New Revision: 64846

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

  Log:
    revert r64838 and r64839
    
    because some build failures persisted

  Modified files:
    trunk/compile.c
    trunk/defs/id.def
    trunk/insns.def
    trunk/test/ruby/test_jit.rb
    trunk/test/ruby/test_optimization.rb
    trunk/tool/transform_mjit_header.rb
    trunk/vm.c
    trunk/vm_core.h
    trunk/vm_insnhelper.c
Index: vm.c
===================================================================
--- vm.c	(revision 64845)
+++ vm.c	(revision 64846)
@@ -1610,8 +1610,6 @@ vm_init_redefined_flag(void) https://github.com/ruby/ruby/blob/trunk/vm.c#L1610
     OP(Max, MAX), (C(Array));
     OP(Min, MIN), (C(Array));
     OP(Call, CALL), (C(Proc));
-    OP(And, AND), (C(Integer));
-    OP(Or, OR), (C(Integer));
 #undef C
 #undef OP
 }
Index: tool/transform_mjit_header.rb
===================================================================
--- tool/transform_mjit_header.rb	(revision 64845)
+++ tool/transform_mjit_header.rb	(revision 64846)
@@ -52,8 +52,6 @@ module MJITHeader https://github.com/ruby/ruby/blob/trunk/tool/transform_mjit_header.rb#L52
     'vm_opt_gt',
     'vm_opt_ge',
     'vm_opt_ltlt',
-    'vm_opt_and',
-    'vm_opt_or',
     'vm_opt_aref',
     'vm_opt_aset',
     'vm_opt_aref_with',
Index: test/ruby/test_optimization.rb
===================================================================
--- test/ruby/test_optimization.rb	(revision 64845)
+++ test/ruby/test_optimization.rb	(revision 64846)
@@ -187,16 +187,6 @@ class TestRubyOptimization < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/ruby/test_optimization.rb#L187
     assert_redefine_method('String', '<<', 'assert_equal "b", "a" << "b"')
   end
 
-  def test_fixnum_and
-    assert_equal 1, 1&3
-    assert_redefine_method('Integer', '&', 'assert_equal 3, 1&3')
-  end
-
-  def test_fixnum_or
-    assert_equal 3, 1|3
-    assert_redefine_method('Integer', '|', 'assert_equal 1, 3|1')
-  end
-
   def test_array_plus
     assert_equal [1,2], [1]+[2]
     assert_redefine_method('Array', '+', 'assert_equal [2], [1]+[2]')
Index: test/ruby/test_jit.rb
===================================================================
--- test/ruby/test_jit.rb	(revision 64845)
+++ test/ruby/test_jit.rb	(revision 64846)
@@ -19,6 +19,7 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L19
     :opt_call_c_function,
 
     # joke
+    :bitblt,
     :answer,
 
     # TODO: write tests for them
@@ -477,14 +478,6 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L478
     assert_compile_once('[1] << 2', result_inspect: '[1, 2]', insns: %i[opt_ltlt])
   end
 
-  def test_compile_insn_opt_and
-    assert_compile_once('1 & 3', result_inspect: '1', insns: %i[opt_and])
-  end
-
-  def test_compile_insn_opt_or
-    assert_compile_once('1 | 3', result_inspect: '3', insns: %i[opt_or])
-  end
-
   def test_compile_insn_opt_aref
     skip_on_mswin
     # optimized call (optimized JIT) -> send call
Index: insns.def
===================================================================
--- insns.def	(revision 64845)
+++ insns.def	(revision 64846)
@@ -1216,34 +1216,6 @@ opt_ltlt https://github.com/ruby/ruby/blob/trunk/insns.def#L1216
     }
 }
 
-/* optimized X&Y. */
-DEFINE_INSN
-opt_and
-(CALL_INFO ci, CALL_CACHE cc)
-(VALUE recv, VALUE obj)
-(VALUE val)
-{
-    val = vm_opt_and(recv, obj);
-
-    if (val == Qundef) {
-        CALL_SIMPLE_METHOD();
-    }
-}
-
-/* optimized X|Y. */
-DEFINE_INSN
-opt_or
-(CALL_INFO ci, CALL_CACHE cc)
-(VALUE recv, VALUE obj)
-(VALUE val)
-{
-    val = vm_opt_or(recv, obj);
-
-    if (val == Qundef) {
-        CALL_SIMPLE_METHOD();
-    }
-}
-
 /* [] */
 DEFINE_INSN
 opt_aref
@@ -1438,6 +1410,16 @@ opt_call_c_function https://github.com/ruby/ruby/blob/trunk/insns.def#L1410
     NEXT_INSN();
 }
 
+/* BLT */
+DEFINE_INSN
+bitblt
+()
+()
+(VALUE ret)
+{
+    ret = rb_str_new2("a bit of bacon, lettuce and tomato");
+}
+
 /* The Answer to Life, the Universe, and Everything */
 DEFINE_INSN
 answer
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 64845)
+++ vm_core.h	(revision 64846)
@@ -531,8 +531,6 @@ enum ruby_basic_operators { https://github.com/ruby/ruby/blob/trunk/vm_core.h#L531
     BOP_MAX,
     BOP_MIN,
     BOP_CALL,
-    BOP_AND,
-    BOP_OR,
 
     BOP_LAST_
 };
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 64845)
+++ vm_insnhelper.c	(revision 64846)
@@ -3653,30 +3653,6 @@ vm_opt_ltlt(VALUE recv, VALUE obj) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L3653
 }
 
 static VALUE
-vm_opt_and(VALUE recv, VALUE obj)
-{
-    if (FIXNUM_2_P(recv, obj) &&
-        BASIC_OP_UNREDEFINED_P(BOP_AND, INTEGER_REDEFINED_OP_FLAG)) {
-        return LONG2NUM(FIX2LONG(recv) & FIX2LONG(obj));
-    }
-    else {
-        return Qundef;
-    }
-}
-
-static VALUE
-vm_opt_or(VALUE recv, VALUE obj)
-{
-    if (FIXNUM_2_P(recv, obj) &&
-        BASIC_OP_UNREDEFINED_P(BOP_OR, INTEGER_REDEFINED_OP_FLAG)) {
-        return LONG2NUM(FIX2LONG(recv) | FIX2LONG(obj));
-    }
-    else {
-        return Qundef;
-    }
-}
-
-static VALUE
 vm_opt_aref(VALUE recv, VALUE obj)
 {
     if (SPECIAL_CONST_P(recv)) {
Index: compile.c
===================================================================
--- compile.c	(revision 64845)
+++ compile.c	(revision 64846)
@@ -3245,8 +3245,6 @@ iseq_specialized_instruction(rb_iseq_t * https://github.com/ruby/ruby/blob/trunk/compile.c#L3245
 		  case idGE:	 SP_INSN(ge);	  return COMPILE_OK;
 		  case idLTLT:	 SP_INSN(ltlt);	  return COMPILE_OK;
 		  case idAREF:	 SP_INSN(aref);	  return COMPILE_OK;
-                  case idAnd:    SP_INSN(and);    return COMPILE_OK;
-                  case idOr:     SP_INSN(or);    return COMPILE_OK;
 		}
 		break;
 	      case 2:
@@ -6443,11 +6441,17 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK https://github.com/ruby/ruby/blob/trunk/compile.c#L6441
 	INIT_ANCHOR(args);
 #if SUPPORT_JOKE
 	if (nd_type(node) == NODE_VCALL) {
+	    ID id_bitblt;
 	    ID id_answer;
 
+	    CONST_ID(id_bitblt, "bitblt");
 	    CONST_ID(id_answer, "the_answer_to_life_the_universe_and_everything");
 
-            if (mid == id_answer) {
+	    if (mid == id_bitblt) {
+		ADD_INSN(ret, line, bitblt);
+		break;
+	    }
+	    else if (mid == id_answer) {
 		ADD_INSN(ret, line, answer);
 		break;
 	    }
Index: defs/id.def
===================================================================
--- defs/id.def	(revision 64845)
+++ defs/id.def	(revision 64846)
@@ -97,8 +97,6 @@ token_ops = %[\ https://github.com/ruby/ruby/blob/trunk/defs/id.def#L97
   Eqq           ===     EQQ
   Neq           !=      NEQ
   Not           !
-  And           &
-  Or            |
   Backquote     `
   EqTilde       =~      MATCH
   NeqTilde      !~      NMATCH

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

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