提交 b72fe8e1 编写于 作者: K kvn

6667580: Optimize CmpP for allocations

Summary: CmpP could be optimized out if it compares new allocated objects.
Reviewed-by: jrose, never, rasbold
上级 ead49ab5
......@@ -990,6 +990,7 @@ stubRoutines.cpp runtime.hpp
subnode.cpp addnode.hpp
subnode.cpp allocation.inline.hpp
subnode.cpp callnode.hpp
subnode.cpp cfgnode.hpp
subnode.cpp compileLog.hpp
subnode.cpp connode.hpp
......
......@@ -91,7 +91,9 @@ public:
class ParmNode : public ProjNode {
static const char * const names[TypeFunc::Parms+1];
public:
ParmNode( StartNode *src, uint con ) : ProjNode(src,con) {}
ParmNode( StartNode *src, uint con ) : ProjNode(src,con) {
init_class_id(Class_Parm);
}
virtual int Opcode() const;
virtual bool is_CFG() const { return (_con == TypeFunc::Control); }
virtual uint ideal_reg() const;
......
......@@ -60,13 +60,13 @@ protected:
debug_only(_adr_type=at; adr_type();)
}
public:
// Helpers for the optimizer. Documented in memnode.cpp.
static bool detect_ptr_independence(Node* p1, AllocateNode* a1,
Node* p2, AllocateNode* a2,
PhaseTransform* phase);
static bool adr_phi_is_loop_invariant(Node* adr_phi, Node* cast);
public:
// This one should probably be a phase-specific function:
static bool detect_dominating_control(Node* dom, Node* sub);
......
......@@ -91,6 +91,7 @@ class Node_List;
class Node_Stack;
class NullCheckNode;
class OopMap;
class ParmNode;
class PCTableNode;
class PhaseCCP;
class PhaseGVN;
......@@ -557,6 +558,7 @@ public:
DEFINE_CLASS_ID(JumpProj, Proj, 1)
DEFINE_CLASS_ID(IfTrue, Proj, 2)
DEFINE_CLASS_ID(IfFalse, Proj, 3)
DEFINE_CLASS_ID(Parm, Proj, 4)
DEFINE_CLASS_ID(Region, Node, 3)
DEFINE_CLASS_ID(Loop, Region, 0)
......@@ -712,6 +714,7 @@ public:
DEFINE_CLASS_QUERY(Mul)
DEFINE_CLASS_QUERY(Multi)
DEFINE_CLASS_QUERY(MultiBranch)
DEFINE_CLASS_QUERY(Parm)
DEFINE_CLASS_QUERY(PCTable)
DEFINE_CLASS_QUERY(Phi)
DEFINE_CLASS_QUERY(Proj)
......
......@@ -614,6 +614,13 @@ const Type *CmpPNode::sub( const Type *t1, const Type *t2 ) const {
const TypeOopPtr* p0 = r0->isa_oopptr();
const TypeOopPtr* p1 = r1->isa_oopptr();
if (p0 && p1) {
Node* in1 = in(1)->uncast();
Node* in2 = in(2)->uncast();
AllocateNode* alloc1 = AllocateNode::Ideal_allocation(in1, NULL);
AllocateNode* alloc2 = AllocateNode::Ideal_allocation(in2, NULL);
if (MemNode::detect_ptr_independence(in1, alloc1, in2, alloc2, NULL)) {
return TypeInt::CC_GT; // different pointers
}
ciKlass* klass0 = p0->klass();
bool xklass0 = p0->klass_is_exact();
ciKlass* klass1 = p1->klass();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册