comparison src/share/vm/opto/multnode.cpp @ 10278:6f3fd5150b67

6934604: enable parts of EliminateAutoBox by default Summary: Resurrected autobox elimination code and enabled part of it by default. Reviewed-by: roland, twisti
author kvn
date Wed, 08 May 2013 15:08:01 -0700
parents da91efe96a93
children c9ccd7b85f20
comparison
equal deleted inserted replaced
10277:aabf54ccedb1 10278:6f3fd5150b67
21 * questions. 21 * questions.
22 * 22 *
23 */ 23 */
24 24
25 #include "precompiled.hpp" 25 #include "precompiled.hpp"
26 #include "opto/callnode.hpp"
26 #include "opto/matcher.hpp" 27 #include "opto/matcher.hpp"
27 #include "opto/multnode.hpp" 28 #include "opto/multnode.hpp"
28 #include "opto/opcodes.hpp" 29 #include "opto/opcodes.hpp"
29 #include "opto/phaseX.hpp" 30 #include "opto/phaseX.hpp"
30 #include "opto/regmask.hpp" 31 #include "opto/regmask.hpp"
71 bool ProjNode::is_CFG() const { 72 bool ProjNode::is_CFG() const {
72 Node *def = in(0); 73 Node *def = in(0);
73 return (_con == TypeFunc::Control && def->is_CFG()); 74 return (_con == TypeFunc::Control && def->is_CFG());
74 } 75 }
75 76
77 const Type* ProjNode::proj_type(const Type* t) const {
78 if (t == Type::TOP) {
79 return Type::TOP;
80 }
81 if (t == Type::BOTTOM) {
82 return Type::BOTTOM;
83 }
84 t = t->is_tuple()->field_at(_con);
85 Node* n = in(0);
86 if ((_con == TypeFunc::Parms) &&
87 n->is_CallStaticJava() && n->as_CallStaticJava()->is_boxing_method()) {
88 // The result of autoboxing is always non-null on normal path.
89 t = t->join(TypePtr::NOTNULL);
90 }
91 return t;
92 }
93
76 const Type *ProjNode::bottom_type() const { 94 const Type *ProjNode::bottom_type() const {
77 if (in(0) == NULL) return Type::TOP; 95 if (in(0) == NULL) return Type::TOP;
78 const Type *tb = in(0)->bottom_type(); 96 return proj_type(in(0)->bottom_type());
79 if( tb == Type::TOP ) return Type::TOP;
80 if( tb == Type::BOTTOM ) return Type::BOTTOM;
81 const TypeTuple *t = tb->is_tuple();
82 return t->field_at(_con);
83 } 97 }
84 98
85 const TypePtr *ProjNode::adr_type() const { 99 const TypePtr *ProjNode::adr_type() const {
86 if (bottom_type() == Type::MEMORY) { 100 if (bottom_type() == Type::MEMORY) {
87 // in(0) might be a narrow MemBar; otherwise we will report TypePtr::BOTTOM 101 // in(0) might be a narrow MemBar; otherwise we will report TypePtr::BOTTOM
113 assert(_con < t->is_tuple()->cnt(), "ProjNode::_con must be in range"); 127 assert(_con < t->is_tuple()->cnt(), "ProjNode::_con must be in range");
114 } 128 }
115 129
116 //------------------------------Value------------------------------------------ 130 //------------------------------Value------------------------------------------
117 const Type *ProjNode::Value( PhaseTransform *phase ) const { 131 const Type *ProjNode::Value( PhaseTransform *phase ) const {
118 if( !in(0) ) return Type::TOP; 132 if (in(0) == NULL) return Type::TOP;
119 const Type *t = phase->type(in(0)); 133 return proj_type(phase->type(in(0)));
120 if( t == Type::TOP ) return t;
121 if( t == Type::BOTTOM ) return t;
122 return t->is_tuple()->field_at(_con);
123 } 134 }
124 135
125 //------------------------------out_RegMask------------------------------------ 136 //------------------------------out_RegMask------------------------------------
126 // Pass the buck uphill 137 // Pass the buck uphill
127 const RegMask &ProjNode::out_RegMask() const { 138 const RegMask &ProjNode::out_RegMask() const {