提交 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
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, // Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
// CA 95054 USA or visit www.sun.com if you need additional information or // CA 95054 USA or visit www.sun.com if you need additional information or
// have any questions. // have any questions.
// //
// //
ad_<arch_model>.cpp adGlobals_<arch_model>.hpp ad_<arch_model>.cpp adGlobals_<arch_model>.hpp
...@@ -990,6 +990,7 @@ stubRoutines.cpp runtime.hpp ...@@ -990,6 +990,7 @@ stubRoutines.cpp runtime.hpp
subnode.cpp addnode.hpp subnode.cpp addnode.hpp
subnode.cpp allocation.inline.hpp subnode.cpp allocation.inline.hpp
subnode.cpp callnode.hpp
subnode.cpp cfgnode.hpp subnode.cpp cfgnode.hpp
subnode.cpp compileLog.hpp subnode.cpp compileLog.hpp
subnode.cpp connode.hpp subnode.cpp connode.hpp
...@@ -1086,7 +1087,7 @@ idealGraphPrinter.hpp growableArray.hpp ...@@ -1086,7 +1087,7 @@ idealGraphPrinter.hpp growableArray.hpp
idealGraphPrinter.hpp ostream.hpp idealGraphPrinter.hpp ostream.hpp
idealGraphPrinter.cpp idealGraphPrinter.hpp idealGraphPrinter.cpp idealGraphPrinter.hpp
idealGraphPrinter.cpp chaitin.hpp idealGraphPrinter.cpp chaitin.hpp
idealGraphPrinter.cpp machnode.hpp idealGraphPrinter.cpp machnode.hpp
idealGraphPrinter.cpp parse.hpp idealGraphPrinter.cpp parse.hpp
idealGraphPrinter.cpp threadCritical.hpp idealGraphPrinter.cpp threadCritical.hpp
...@@ -1098,4 +1099,4 @@ parse2.cpp idealGraphPrinter.hpp ...@@ -1098,4 +1099,4 @@ parse2.cpp idealGraphPrinter.hpp
parse1.cpp idealGraphPrinter.hpp parse1.cpp idealGraphPrinter.hpp
matcher.cpp idealGraphPrinter.hpp matcher.cpp idealGraphPrinter.hpp
loopnode.cpp idealGraphPrinter.hpp loopnode.cpp idealGraphPrinter.hpp
chaitin.cpp idealGraphPrinter.hpp chaitin.cpp idealGraphPrinter.hpp
...@@ -38,7 +38,7 @@ class CallRuntimeNode; ...@@ -38,7 +38,7 @@ class CallRuntimeNode;
class CallLeafNode; class CallLeafNode;
class CallLeafNoFPNode; class CallLeafNoFPNode;
class AllocateNode; class AllocateNode;
class AllocateArrayNode; class AllocateArrayNode;
class LockNode; class LockNode;
class UnlockNode; class UnlockNode;
class JVMState; class JVMState;
...@@ -91,7 +91,9 @@ public: ...@@ -91,7 +91,9 @@ public:
class ParmNode : public ProjNode { class ParmNode : public ProjNode {
static const char * const names[TypeFunc::Parms+1]; static const char * const names[TypeFunc::Parms+1];
public: 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 int Opcode() const;
virtual bool is_CFG() const { return (_con == TypeFunc::Control); } virtual bool is_CFG() const { return (_con == TypeFunc::Control); }
virtual uint ideal_reg() const; virtual uint ideal_reg() const;
......
...@@ -60,13 +60,13 @@ protected: ...@@ -60,13 +60,13 @@ protected:
debug_only(_adr_type=at; adr_type();) debug_only(_adr_type=at; adr_type();)
} }
public:
// Helpers for the optimizer. Documented in memnode.cpp. // Helpers for the optimizer. Documented in memnode.cpp.
static bool detect_ptr_independence(Node* p1, AllocateNode* a1, static bool detect_ptr_independence(Node* p1, AllocateNode* a1,
Node* p2, AllocateNode* a2, Node* p2, AllocateNode* a2,
PhaseTransform* phase); PhaseTransform* phase);
static bool adr_phi_is_loop_invariant(Node* adr_phi, Node* cast); static bool adr_phi_is_loop_invariant(Node* adr_phi, Node* cast);
public:
// This one should probably be a phase-specific function: // This one should probably be a phase-specific function:
static bool detect_dominating_control(Node* dom, Node* sub); static bool detect_dominating_control(Node* dom, Node* sub);
......
...@@ -91,6 +91,7 @@ class Node_List; ...@@ -91,6 +91,7 @@ class Node_List;
class Node_Stack; class Node_Stack;
class NullCheckNode; class NullCheckNode;
class OopMap; class OopMap;
class ParmNode;
class PCTableNode; class PCTableNode;
class PhaseCCP; class PhaseCCP;
class PhaseGVN; class PhaseGVN;
...@@ -557,6 +558,7 @@ public: ...@@ -557,6 +558,7 @@ public:
DEFINE_CLASS_ID(JumpProj, Proj, 1) DEFINE_CLASS_ID(JumpProj, Proj, 1)
DEFINE_CLASS_ID(IfTrue, Proj, 2) DEFINE_CLASS_ID(IfTrue, Proj, 2)
DEFINE_CLASS_ID(IfFalse, Proj, 3) DEFINE_CLASS_ID(IfFalse, Proj, 3)
DEFINE_CLASS_ID(Parm, Proj, 4)
DEFINE_CLASS_ID(Region, Node, 3) DEFINE_CLASS_ID(Region, Node, 3)
DEFINE_CLASS_ID(Loop, Region, 0) DEFINE_CLASS_ID(Loop, Region, 0)
...@@ -712,6 +714,7 @@ public: ...@@ -712,6 +714,7 @@ public:
DEFINE_CLASS_QUERY(Mul) DEFINE_CLASS_QUERY(Mul)
DEFINE_CLASS_QUERY(Multi) DEFINE_CLASS_QUERY(Multi)
DEFINE_CLASS_QUERY(MultiBranch) DEFINE_CLASS_QUERY(MultiBranch)
DEFINE_CLASS_QUERY(Parm)
DEFINE_CLASS_QUERY(PCTable) DEFINE_CLASS_QUERY(PCTable)
DEFINE_CLASS_QUERY(Phi) DEFINE_CLASS_QUERY(Phi)
DEFINE_CLASS_QUERY(Proj) DEFINE_CLASS_QUERY(Proj)
......
...@@ -614,6 +614,13 @@ const Type *CmpPNode::sub( const Type *t1, const Type *t2 ) const { ...@@ -614,6 +614,13 @@ const Type *CmpPNode::sub( const Type *t1, const Type *t2 ) const {
const TypeOopPtr* p0 = r0->isa_oopptr(); const TypeOopPtr* p0 = r0->isa_oopptr();
const TypeOopPtr* p1 = r1->isa_oopptr(); const TypeOopPtr* p1 = r1->isa_oopptr();
if (p0 && p1) { 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(); ciKlass* klass0 = p0->klass();
bool xklass0 = p0->klass_is_exact(); bool xklass0 = p0->klass_is_exact();
ciKlass* klass1 = p1->klass(); ciKlass* klass1 = p1->klass();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册