Skip to content

Commit 548899d

Browse files
y1yang0TobiHartmann
authored andcommitted
8266189: Remove C1 "IfInstanceOf" instruction
Reviewed-by: thartmann
1 parent b46086d commit 548899d

10 files changed

+0
-93
lines changed

src/hotspot/share/c1/c1_Canonicalizer.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,6 @@ void Canonicalizer::do_CompareOp (CompareOp* x) {
468468
}
469469

470470

471-
void Canonicalizer::do_IfInstanceOf(IfInstanceOf* x) {}
472-
473471
void Canonicalizer::do_IfOp(IfOp* x) {
474472
// Caution: do not use do_Op2(x) here for now since
475473
// we map the condition to the op for now!
@@ -796,23 +794,6 @@ void Canonicalizer::do_If(If* x) {
796794
set_canonical(canon);
797795
}
798796
}
799-
} else if (l->as_InstanceOf() != NULL) {
800-
// NOTE: Code permanently disabled for now since it leaves the old InstanceOf
801-
// instruction in the graph (it is pinned). Need to fix this at some point.
802-
// It should also be left in the graph when generating a profiled method version or Goto
803-
// has to know that it was an InstanceOf.
804-
return;
805-
// pattern: If ((obj instanceof klass) cond rc) => simplify to: IfInstanceOf or: Goto
806-
InstanceOf* inst = l->as_InstanceOf();
807-
BlockBegin* is_inst_sux = x->sux_for(is_true(1, x->cond(), rc)); // successor for instanceof == 1
808-
BlockBegin* no_inst_sux = x->sux_for(is_true(0, x->cond(), rc)); // successor for instanceof == 0
809-
if (is_inst_sux == no_inst_sux && inst->is_loaded()) {
810-
// both successors identical and klass is loaded => simplify to: Goto
811-
set_canonical(new Goto(is_inst_sux, x->state_before(), x->is_safepoint()));
812-
} else {
813-
// successors differ => simplify to: IfInstanceOf
814-
set_canonical(new IfInstanceOf(inst->klass(), inst->obj(), true, inst->state_before()->bci(), is_inst_sux, no_inst_sux));
815-
}
816797
}
817798
} else if (rt == objectNull &&
818799
(l->as_NewInstance() || l->as_NewArray() ||

src/hotspot/share/c1/c1_Canonicalizer.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ class Canonicalizer: InstructionVisitor {
7575
virtual void do_LogicOp (LogicOp* x);
7676
virtual void do_CompareOp (CompareOp* x);
7777
virtual void do_IfOp (IfOp* x);
78-
virtual void do_IfInstanceOf (IfInstanceOf* x);
7978
virtual void do_Convert (Convert* x);
8079
virtual void do_NullCheck (NullCheck* x);
8180
virtual void do_TypeCast (TypeCast* x);

src/hotspot/share/c1/c1_Instruction.hpp

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ class BlockBegin;
8787
class BlockEnd;
8888
class Goto;
8989
class If;
90-
class IfInstanceOf;
9190
class Switch;
9291
class TableSwitch;
9392
class LookupSwitch;
@@ -188,7 +187,6 @@ class InstructionVisitor: public StackObj {
188187
virtual void do_BlockBegin (BlockBegin* x) = 0;
189188
virtual void do_Goto (Goto* x) = 0;
190189
virtual void do_If (If* x) = 0;
191-
virtual void do_IfInstanceOf (IfInstanceOf* x) = 0;
192190
virtual void do_TableSwitch (TableSwitch* x) = 0;
193191
virtual void do_LookupSwitch (LookupSwitch* x) = 0;
194192
virtual void do_Return (Return* x) = 0;
@@ -566,7 +564,6 @@ class Instruction: public CompilationResourceObj {
566564
virtual BlockEnd* as_BlockEnd() { return NULL; }
567565
virtual Goto* as_Goto() { return NULL; }
568566
virtual If* as_If() { return NULL; }
569-
virtual IfInstanceOf* as_IfInstanceOf() { return NULL; }
570567
virtual TableSwitch* as_TableSwitch() { return NULL; }
571568
virtual LookupSwitch* as_LookupSwitch() { return NULL; }
572569
virtual Return* as_Return() { return NULL; }
@@ -2034,60 +2031,6 @@ LEAF(If, BlockEnd)
20342031
};
20352032

20362033

2037-
LEAF(IfInstanceOf, BlockEnd)
2038-
private:
2039-
ciKlass* _klass;
2040-
Value _obj;
2041-
bool _test_is_instance; // jump if instance
2042-
int _instanceof_bci;
2043-
2044-
public:
2045-
IfInstanceOf(ciKlass* klass, Value obj, bool test_is_instance, int instanceof_bci, BlockBegin* tsux, BlockBegin* fsux)
2046-
: BlockEnd(illegalType, NULL, false) // temporary set to false
2047-
, _klass(klass)
2048-
, _obj(obj)
2049-
, _test_is_instance(test_is_instance)
2050-
, _instanceof_bci(instanceof_bci)
2051-
{
2052-
ASSERT_VALUES
2053-
assert(instanceof_bci >= 0, "illegal bci");
2054-
BlockList* s = new BlockList(2);
2055-
s->append(tsux);
2056-
s->append(fsux);
2057-
set_sux(s);
2058-
}
2059-
2060-
// accessors
2061-
//
2062-
// Note 1: If test_is_instance() is true, IfInstanceOf tests if obj *is* an
2063-
// instance of klass; otherwise it tests if it is *not* and instance
2064-
// of klass.
2065-
//
2066-
// Note 2: IfInstanceOf instructions are created by combining an InstanceOf
2067-
// and an If instruction. The IfInstanceOf bci() corresponds to the
2068-
// bci that the If would have had; the (this->) instanceof_bci() is
2069-
// the bci of the original InstanceOf instruction.
2070-
ciKlass* klass() const { return _klass; }
2071-
Value obj() const { return _obj; }
2072-
int instanceof_bci() const { return _instanceof_bci; }
2073-
bool test_is_instance() const { return _test_is_instance; }
2074-
BlockBegin* sux_for(bool is_true) const { return sux_at(is_true ? 0 : 1); }
2075-
BlockBegin* tsux() const { return sux_for(true); }
2076-
BlockBegin* fsux() const { return sux_for(false); }
2077-
2078-
// manipulation
2079-
void swap_sux() {
2080-
assert(number_of_sux() == 2, "wrong number of successors");
2081-
BlockList* s = sux();
2082-
BlockBegin* t = s->at(0); s->at_put(0, s->at(1)); s->at_put(1, t);
2083-
_test_is_instance = !_test_is_instance;
2084-
}
2085-
2086-
// generic
2087-
virtual void input_values_do(ValueVisitor* f) { BlockEnd::input_values_do(f); f->visit(&_obj); }
2088-
};
2089-
2090-
20912034
BASE(Switch, BlockEnd)
20922035
private:
20932036
Value _tag;

src/hotspot/share/c1/c1_InstructionPrinter.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -740,11 +740,6 @@ void InstructionPrinter::do_If(If* x) {
740740
}
741741

742742

743-
void InstructionPrinter::do_IfInstanceOf(IfInstanceOf* x) {
744-
output()->print("<IfInstanceOf>");
745-
}
746-
747-
748743
void InstructionPrinter::do_TableSwitch(TableSwitch* x) {
749744
output()->print("tableswitch ");
750745
if (x->is_safepoint()) output()->print("(safepoint) ");

src/hotspot/share/c1/c1_InstructionPrinter.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ class InstructionPrinter: public InstructionVisitor {
115115
virtual void do_BlockBegin (BlockBegin* x);
116116
virtual void do_Goto (Goto* x);
117117
virtual void do_If (If* x);
118-
virtual void do_IfInstanceOf (IfInstanceOf* x);
119118
virtual void do_TableSwitch (TableSwitch* x);
120119
virtual void do_LookupSwitch (LookupSwitch* x);
121120
virtual void do_Return (Return* x);

src/hotspot/share/c1/c1_LIRGenerator.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,11 +1186,6 @@ void LIRGenerator::do_Local(Local* x) {
11861186
}
11871187

11881188

1189-
void LIRGenerator::do_IfInstanceOf(IfInstanceOf* x) {
1190-
Unimplemented();
1191-
}
1192-
1193-
11941189
void LIRGenerator::do_Return(Return* x) {
11951190
if (compilation()->env()->dtrace_method_probes()) {
11961191
BasicTypeList signature;

src/hotspot/share/c1/c1_LIRGenerator.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,6 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
575575
virtual void do_BlockBegin (BlockBegin* x);
576576
virtual void do_Goto (Goto* x);
577577
virtual void do_If (If* x);
578-
virtual void do_IfInstanceOf (IfInstanceOf* x);
579578
virtual void do_TableSwitch (TableSwitch* x);
580579
virtual void do_LookupSwitch (LookupSwitch* x);
581580
virtual void do_Return (Return* x);

src/hotspot/share/c1/c1_Optimizer.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,6 @@ class NullCheckVisitor: public InstructionVisitor {
521521
void do_BlockBegin (BlockBegin* x);
522522
void do_Goto (Goto* x);
523523
void do_If (If* x);
524-
void do_IfInstanceOf (IfInstanceOf* x);
525524
void do_TableSwitch (TableSwitch* x);
526525
void do_LookupSwitch (LookupSwitch* x);
527526
void do_Return (Return* x);
@@ -707,7 +706,6 @@ void NullCheckVisitor::do_Intrinsic (Intrinsic* x) { nce()->handle_In
707706
void NullCheckVisitor::do_BlockBegin (BlockBegin* x) {}
708707
void NullCheckVisitor::do_Goto (Goto* x) {}
709708
void NullCheckVisitor::do_If (If* x) {}
710-
void NullCheckVisitor::do_IfInstanceOf (IfInstanceOf* x) {}
711709
void NullCheckVisitor::do_TableSwitch (TableSwitch* x) {}
712710
void NullCheckVisitor::do_LookupSwitch (LookupSwitch* x) {}
713711
void NullCheckVisitor::do_Return (Return* x) {}

src/hotspot/share/c1/c1_RangeCheckElimination.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ class RangeCheckEliminator {
155155
void do_BlockBegin (BlockBegin* x) { /* nothing to do */ };
156156
void do_Goto (Goto* x) { /* nothing to do */ };
157157
void do_If (If* x) { /* nothing to do */ };
158-
void do_IfInstanceOf (IfInstanceOf* x) { /* nothing to do */ };
159158
void do_TableSwitch (TableSwitch* x) { /* nothing to do */ };
160159
void do_LookupSwitch (LookupSwitch* x) { /* nothing to do */ };
161160
void do_Return (Return* x) { /* nothing to do */ };

src/hotspot/share/c1/c1_ValueMap.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ class ValueNumberingVisitor: public InstructionVisitor {
194194
void do_BlockBegin (BlockBegin* x) { /* nothing to do */ }
195195
void do_Goto (Goto* x) { /* nothing to do */ }
196196
void do_If (If* x) { /* nothing to do */ }
197-
void do_IfInstanceOf (IfInstanceOf* x) { /* nothing to do */ }
198197
void do_TableSwitch (TableSwitch* x) { /* nothing to do */ }
199198
void do_LookupSwitch (LookupSwitch* x) { /* nothing to do */ }
200199
void do_Return (Return* x) { /* nothing to do */ }

0 commit comments

Comments
 (0)