summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compile.c10
-rw-r--r--defs/id.def2
-rw-r--r--insns.def38
-rw-r--r--test/ruby/test_jit.rb9
-rw-r--r--test/ruby/test_optimization.rb10
-rw-r--r--tool/transform_mjit_header.rb2
-rw-r--r--vm.c2
-rw-r--r--vm_core.h2
-rw-r--r--vm_insnhelper.c24
9 files changed, 18 insertions, 81 deletions
diff --git a/compile.c b/compile.c
index bb469659c8..83d992a2e9 100644
--- a/compile.c
+++ b/compile.c
@@ -3245,8 +3245,6 @@ iseq_specialized_instruction(rb_iseq_t *iseq, INSN *iobj)
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_ANCHOR *const ret, const NODE *node, in
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;
}
diff --git a/defs/id.def b/defs/id.def
index fe61d254c9..e1a66f5030 100644
--- a/defs/id.def
+++ b/defs/id.def
@@ -97,8 +97,6 @@ token_ops = %[\
Eqq === EQQ
Neq != NEQ
Not !
- And &
- Or |
Backquote `
EqTilde =~ MATCH
NeqTilde !~ NMATCH
diff --git a/insns.def b/insns.def
index eb8c20bbba..742cd87960 100644
--- a/insns.def
+++ b/insns.def
@@ -1216,34 +1216,6 @@ opt_ltlt
}
}
-/* 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
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
diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb
index 722801226e..50f318c2a7 100644
--- a/test/ruby/test_jit.rb
+++ b/test/ruby/test_jit.rb
@@ -19,6 +19,7 @@ class TestJIT < Test::Unit::TestCase
:opt_call_c_function,
# joke
+ :bitblt,
:answer,
# TODO: write tests for them
@@ -477,14 +478,6 @@ class TestJIT < Test::Unit::TestCase
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
diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb
index c425254661..d4a1fdbcea 100644
--- a/test/ruby/test_optimization.rb
+++ b/test/ruby/test_optimization.rb
@@ -187,16 +187,6 @@ class TestRubyOptimization < Test::Unit::TestCase
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]')
diff --git a/tool/transform_mjit_header.rb b/tool/transform_mjit_header.rb
index 1000172352..936a0e1945 100644
--- a/tool/transform_mjit_header.rb
+++ b/tool/transform_mjit_header.rb
@@ -52,8 +52,6 @@ module MJITHeader
'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',
diff --git a/vm.c b/vm.c
index eb47a83d5f..da9afe2fc7 100644
--- a/vm.c
+++ b/vm.c
@@ -1610,8 +1610,6 @@ vm_init_redefined_flag(void)
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
}
diff --git a/vm_core.h b/vm_core.h
index 1ab49b05de..bb6409719b 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -531,8 +531,6 @@ enum ruby_basic_operators {
BOP_MAX,
BOP_MIN,
BOP_CALL,
- BOP_AND,
- BOP_OR,
BOP_LAST_
};
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 29e6545398..29b935803b 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -3653,30 +3653,6 @@ vm_opt_ltlt(VALUE recv, VALUE obj)
}
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)) {