Skip to content

Commit e08f418

Browse files
committed
revert r64838 and r64839
because some build failures persisted git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent ac17835 commit e08f418

File tree

9 files changed

+18
-81
lines changed

9 files changed

+18
-81
lines changed

compile.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3245,8 +3245,6 @@ iseq_specialized_instruction(rb_iseq_t *iseq, INSN *iobj)
32453245
case idGE: SP_INSN(ge); return COMPILE_OK;
32463246
case idLTLT: SP_INSN(ltlt); return COMPILE_OK;
32473247
case idAREF: SP_INSN(aref); return COMPILE_OK;
3248-
case idAnd: SP_INSN(and); return COMPILE_OK;
3249-
case idOr: SP_INSN(or); return COMPILE_OK;
32503248
}
32513249
break;
32523250
case 2:
@@ -6443,11 +6441,17 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
64436441
INIT_ANCHOR(args);
64446442
#if SUPPORT_JOKE
64456443
if (nd_type(node) == NODE_VCALL) {
6444+
ID id_bitblt;
64466445
ID id_answer;
64476446

6447+
CONST_ID(id_bitblt, "bitblt");
64486448
CONST_ID(id_answer, "the_answer_to_life_the_universe_and_everything");
64496449

6450-
if (mid == id_answer) {
6450+
if (mid == id_bitblt) {
6451+
ADD_INSN(ret, line, bitblt);
6452+
break;
6453+
}
6454+
else if (mid == id_answer) {
64516455
ADD_INSN(ret, line, answer);
64526456
break;
64536457
}

defs/id.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ token_ops = %[\
9797
Eqq === EQQ
9898
Neq != NEQ
9999
Not !
100-
And &
101-
Or |
102100
Backquote `
103101
EqTilde =~ MATCH
104102
NeqTilde !~ NMATCH

insns.def

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,34 +1216,6 @@ opt_ltlt
12161216
}
12171217
}
12181218

1219-
/* optimized X&Y. */
1220-
DEFINE_INSN
1221-
opt_and
1222-
(CALL_INFO ci, CALL_CACHE cc)
1223-
(VALUE recv, VALUE obj)
1224-
(VALUE val)
1225-
{
1226-
val = vm_opt_and(recv, obj);
1227-
1228-
if (val == Qundef) {
1229-
CALL_SIMPLE_METHOD();
1230-
}
1231-
}
1232-
1233-
/* optimized X|Y. */
1234-
DEFINE_INSN
1235-
opt_or
1236-
(CALL_INFO ci, CALL_CACHE cc)
1237-
(VALUE recv, VALUE obj)
1238-
(VALUE val)
1239-
{
1240-
val = vm_opt_or(recv, obj);
1241-
1242-
if (val == Qundef) {
1243-
CALL_SIMPLE_METHOD();
1244-
}
1245-
}
1246-
12471219
/* [] */
12481220
DEFINE_INSN
12491221
opt_aref
@@ -1438,6 +1410,16 @@ opt_call_c_function
14381410
NEXT_INSN();
14391411
}
14401412

1413+
/* BLT */
1414+
DEFINE_INSN
1415+
bitblt
1416+
()
1417+
()
1418+
(VALUE ret)
1419+
{
1420+
ret = rb_str_new2("a bit of bacon, lettuce and tomato");
1421+
}
1422+
14411423
/* The Answer to Life, the Universe, and Everything */
14421424
DEFINE_INSN
14431425
answer

test/ruby/test_jit.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class TestJIT < Test::Unit::TestCase
1919
:opt_call_c_function,
2020

2121
# joke
22+
:bitblt,
2223
:answer,
2324

2425
# TODO: write tests for them
@@ -477,14 +478,6 @@ def test_compile_insn_opt_ltlt
477478
assert_compile_once('[1] << 2', result_inspect: '[1, 2]', insns: %i[opt_ltlt])
478479
end
479480

480-
def test_compile_insn_opt_and
481-
assert_compile_once('1 & 3', result_inspect: '1', insns: %i[opt_and])
482-
end
483-
484-
def test_compile_insn_opt_or
485-
assert_compile_once('1 | 3', result_inspect: '3', insns: %i[opt_or])
486-
end
487-
488481
def test_compile_insn_opt_aref
489482
skip_on_mswin
490483
# optimized call (optimized JIT) -> send call

test/ruby/test_optimization.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,6 @@ def test_string_ltlt
187187
assert_redefine_method('String', '<<', 'assert_equal "b", "a" << "b"')
188188
end
189189

190-
def test_fixnum_and
191-
assert_equal 1, 1&3
192-
assert_redefine_method('Integer', '&', 'assert_equal 3, 1&3')
193-
end
194-
195-
def test_fixnum_or
196-
assert_equal 3, 1|3
197-
assert_redefine_method('Integer', '|', 'assert_equal 1, 3|1')
198-
end
199-
200190
def test_array_plus
201191
assert_equal [1,2], [1]+[2]
202192
assert_redefine_method('Array', '+', 'assert_equal [2], [1]+[2]')

tool/transform_mjit_header.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ module MJITHeader
5252
'vm_opt_gt',
5353
'vm_opt_ge',
5454
'vm_opt_ltlt',
55-
'vm_opt_and',
56-
'vm_opt_or',
5755
'vm_opt_aref',
5856
'vm_opt_aset',
5957
'vm_opt_aref_with',

vm.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,8 +1610,6 @@ vm_init_redefined_flag(void)
16101610
OP(Max, MAX), (C(Array));
16111611
OP(Min, MIN), (C(Array));
16121612
OP(Call, CALL), (C(Proc));
1613-
OP(And, AND), (C(Integer));
1614-
OP(Or, OR), (C(Integer));
16151613
#undef C
16161614
#undef OP
16171615
}

vm_core.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,6 @@ enum ruby_basic_operators {
531531
BOP_MAX,
532532
BOP_MIN,
533533
BOP_CALL,
534-
BOP_AND,
535-
BOP_OR,
536534

537535
BOP_LAST_
538536
};

vm_insnhelper.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3652,30 +3652,6 @@ vm_opt_ltlt(VALUE recv, VALUE obj)
36523652
}
36533653
}
36543654

3655-
static VALUE
3656-
vm_opt_and(VALUE recv, VALUE obj)
3657-
{
3658-
if (FIXNUM_2_P(recv, obj) &&
3659-
BASIC_OP_UNREDEFINED_P(BOP_AND, INTEGER_REDEFINED_OP_FLAG)) {
3660-
return LONG2NUM(FIX2LONG(recv) & FIX2LONG(obj));
3661-
}
3662-
else {
3663-
return Qundef;
3664-
}
3665-
}
3666-
3667-
static VALUE
3668-
vm_opt_or(VALUE recv, VALUE obj)
3669-
{
3670-
if (FIXNUM_2_P(recv, obj) &&
3671-
BASIC_OP_UNREDEFINED_P(BOP_OR, INTEGER_REDEFINED_OP_FLAG)) {
3672-
return LONG2NUM(FIX2LONG(recv) | FIX2LONG(obj));
3673-
}
3674-
else {
3675-
return Qundef;
3676-
}
3677-
}
3678-
36793655
static VALUE
36803656
vm_opt_aref(VALUE recv, VALUE obj)
36813657
{

0 commit comments

Comments
 (0)