8266189: Remove C1 "IfInstanceOf" instruction

Reviewed-by: thartmann
This commit is contained in:
Yi Yang 2021-05-12 08:36:37 +00:00 committed by Tobias Hartmann
parent b46086d777
commit 548899d40e
10 changed files with 0 additions and 93 deletions

View file

@ -468,8 +468,6 @@ void Canonicalizer::do_CompareOp (CompareOp* x) {
}
void Canonicalizer::do_IfInstanceOf(IfInstanceOf* x) {}
void Canonicalizer::do_IfOp(IfOp* x) {
// Caution: do not use do_Op2(x) here for now since
// we map the condition to the op for now!
@ -796,23 +794,6 @@ void Canonicalizer::do_If(If* x) {
set_canonical(canon);
}
}
} else if (l->as_InstanceOf() != NULL) {
// NOTE: Code permanently disabled for now since it leaves the old InstanceOf
// instruction in the graph (it is pinned). Need to fix this at some point.
// It should also be left in the graph when generating a profiled method version or Goto
// has to know that it was an InstanceOf.
return;
// pattern: If ((obj instanceof klass) cond rc) => simplify to: IfInstanceOf or: Goto
InstanceOf* inst = l->as_InstanceOf();
BlockBegin* is_inst_sux = x->sux_for(is_true(1, x->cond(), rc)); // successor for instanceof == 1
BlockBegin* no_inst_sux = x->sux_for(is_true(0, x->cond(), rc)); // successor for instanceof == 0
if (is_inst_sux == no_inst_sux && inst->is_loaded()) {
// both successors identical and klass is loaded => simplify to: Goto
set_canonical(new Goto(is_inst_sux, x->state_before(), x->is_safepoint()));
} else {
// successors differ => simplify to: IfInstanceOf
set_canonical(new IfInstanceOf(inst->klass(), inst->obj(), true, inst->state_before()->bci(), is_inst_sux, no_inst_sux));
}
}
} else if (rt == objectNull &&
(l->as_NewInstance() || l->as_NewArray() ||

View file

@ -75,7 +75,6 @@ class Canonicalizer: InstructionVisitor {
virtual void do_LogicOp (LogicOp* x);
virtual void do_CompareOp (CompareOp* x);
virtual void do_IfOp (IfOp* x);
virtual void do_IfInstanceOf (IfInstanceOf* x);
virtual void do_Convert (Convert* x);
virtual void do_NullCheck (NullCheck* x);
virtual void do_TypeCast (TypeCast* x);

View file

@ -87,7 +87,6 @@ class BlockBegin;
class BlockEnd;
class Goto;
class If;
class IfInstanceOf;
class Switch;
class TableSwitch;
class LookupSwitch;
@ -188,7 +187,6 @@ class InstructionVisitor: public StackObj {
virtual void do_BlockBegin (BlockBegin* x) = 0;
virtual void do_Goto (Goto* x) = 0;
virtual void do_If (If* x) = 0;
virtual void do_IfInstanceOf (IfInstanceOf* x) = 0;
virtual void do_TableSwitch (TableSwitch* x) = 0;
virtual void do_LookupSwitch (LookupSwitch* x) = 0;
virtual void do_Return (Return* x) = 0;
@ -566,7 +564,6 @@ class Instruction: public CompilationResourceObj {
virtual BlockEnd* as_BlockEnd() { return NULL; }
virtual Goto* as_Goto() { return NULL; }
virtual If* as_If() { return NULL; }
virtual IfInstanceOf* as_IfInstanceOf() { return NULL; }
virtual TableSwitch* as_TableSwitch() { return NULL; }
virtual LookupSwitch* as_LookupSwitch() { return NULL; }
virtual Return* as_Return() { return NULL; }
@ -2034,60 +2031,6 @@ LEAF(If, BlockEnd)
};
LEAF(IfInstanceOf, BlockEnd)
private:
ciKlass* _klass;
Value _obj;
bool _test_is_instance; // jump if instance
int _instanceof_bci;
public:
IfInstanceOf(ciKlass* klass, Value obj, bool test_is_instance, int instanceof_bci, BlockBegin* tsux, BlockBegin* fsux)
: BlockEnd(illegalType, NULL, false) // temporary set to false
, _klass(klass)
, _obj(obj)
, _test_is_instance(test_is_instance)
, _instanceof_bci(instanceof_bci)
{
ASSERT_VALUES
assert(instanceof_bci >= 0, "illegal bci");
BlockList* s = new BlockList(2);
s->append(tsux);
s->append(fsux);
set_sux(s);
}
// accessors
//
// Note 1: If test_is_instance() is true, IfInstanceOf tests if obj *is* an
// instance of klass; otherwise it tests if it is *not* and instance
// of klass.
//
// Note 2: IfInstanceOf instructions are created by combining an InstanceOf
// and an If instruction. The IfInstanceOf bci() corresponds to the
// bci that the If would have had; the (this->) instanceof_bci() is
// the bci of the original InstanceOf instruction.
ciKlass* klass() const { return _klass; }
Value obj() const { return _obj; }
int instanceof_bci() const { return _instanceof_bci; }
bool test_is_instance() const { return _test_is_instance; }
BlockBegin* sux_for(bool is_true) const { return sux_at(is_true ? 0 : 1); }
BlockBegin* tsux() const { return sux_for(true); }
BlockBegin* fsux() const { return sux_for(false); }
// manipulation
void swap_sux() {
assert(number_of_sux() == 2, "wrong number of successors");
BlockList* s = sux();
BlockBegin* t = s->at(0); s->at_put(0, s->at(1)); s->at_put(1, t);
_test_is_instance = !_test_is_instance;
}
// generic
virtual void input_values_do(ValueVisitor* f) { BlockEnd::input_values_do(f); f->visit(&_obj); }
};
BASE(Switch, BlockEnd)
private:
Value _tag;

View file

@ -740,11 +740,6 @@ void InstructionPrinter::do_If(If* x) {
}
void InstructionPrinter::do_IfInstanceOf(IfInstanceOf* x) {
output()->print("<IfInstanceOf>");
}
void InstructionPrinter::do_TableSwitch(TableSwitch* x) {
output()->print("tableswitch ");
if (x->is_safepoint()) output()->print("(safepoint) ");

View file

@ -115,7 +115,6 @@ class InstructionPrinter: public InstructionVisitor {
virtual void do_BlockBegin (BlockBegin* x);
virtual void do_Goto (Goto* x);
virtual void do_If (If* x);
virtual void do_IfInstanceOf (IfInstanceOf* x);
virtual void do_TableSwitch (TableSwitch* x);
virtual void do_LookupSwitch (LookupSwitch* x);
virtual void do_Return (Return* x);

View file

@ -1186,11 +1186,6 @@ void LIRGenerator::do_Local(Local* x) {
}
void LIRGenerator::do_IfInstanceOf(IfInstanceOf* x) {
Unimplemented();
}
void LIRGenerator::do_Return(Return* x) {
if (compilation()->env()->dtrace_method_probes()) {
BasicTypeList signature;

View file

@ -575,7 +575,6 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
virtual void do_BlockBegin (BlockBegin* x);
virtual void do_Goto (Goto* x);
virtual void do_If (If* x);
virtual void do_IfInstanceOf (IfInstanceOf* x);
virtual void do_TableSwitch (TableSwitch* x);
virtual void do_LookupSwitch (LookupSwitch* x);
virtual void do_Return (Return* x);

View file

@ -521,7 +521,6 @@ public:
void do_BlockBegin (BlockBegin* x);
void do_Goto (Goto* x);
void do_If (If* x);
void do_IfInstanceOf (IfInstanceOf* x);
void do_TableSwitch (TableSwitch* x);
void do_LookupSwitch (LookupSwitch* x);
void do_Return (Return* x);
@ -707,7 +706,6 @@ void NullCheckVisitor::do_Intrinsic (Intrinsic* x) { nce()->handle_In
void NullCheckVisitor::do_BlockBegin (BlockBegin* x) {}
void NullCheckVisitor::do_Goto (Goto* x) {}
void NullCheckVisitor::do_If (If* x) {}
void NullCheckVisitor::do_IfInstanceOf (IfInstanceOf* x) {}
void NullCheckVisitor::do_TableSwitch (TableSwitch* x) {}
void NullCheckVisitor::do_LookupSwitch (LookupSwitch* x) {}
void NullCheckVisitor::do_Return (Return* x) {}

View file

@ -155,7 +155,6 @@ public:
void do_BlockBegin (BlockBegin* x) { /* nothing to do */ };
void do_Goto (Goto* x) { /* nothing to do */ };
void do_If (If* x) { /* nothing to do */ };
void do_IfInstanceOf (IfInstanceOf* x) { /* nothing to do */ };
void do_TableSwitch (TableSwitch* x) { /* nothing to do */ };
void do_LookupSwitch (LookupSwitch* x) { /* nothing to do */ };
void do_Return (Return* x) { /* nothing to do */ };

View file

@ -194,7 +194,6 @@ class ValueNumberingVisitor: public InstructionVisitor {
void do_BlockBegin (BlockBegin* x) { /* nothing to do */ }
void do_Goto (Goto* x) { /* nothing to do */ }
void do_If (If* x) { /* nothing to do */ }
void do_IfInstanceOf (IfInstanceOf* x) { /* nothing to do */ }
void do_TableSwitch (TableSwitch* x) { /* nothing to do */ }
void do_LookupSwitch (LookupSwitch* x) { /* nothing to do */ }
void do_Return (Return* x) { /* nothing to do */ }