< prev index next >

src/share/vm/opto/parse3.cpp

Print this page
rev 12911 : test code
rev 12912 : 8179070: nashorn+octane's box2d causes c2 to crash with "Bad graph detected in compute_lca_of_uses"
Summary: ciTypeFlow speculates field is null but parsing uses non null constant because of concurrent class initialization
Reviewed-by:
rev 12913 : Backed out changeset c947429d5abc
rev 12914 : debug


 129     if (is_get) {
 130       (void) pop();  // pop receiver before getting
 131       do_get_xxx(obj, field, is_field);
 132     } else {
 133       do_put_xxx(obj, field, is_field);
 134       (void) pop();  // pop receiver after putting
 135     }
 136   } else {
 137     const TypeInstPtr* tip = TypeInstPtr::make(field_holder->java_mirror());
 138     obj = _gvn.makecon(tip);
 139     if (is_get) {
 140       do_get_xxx(obj, field, is_field);
 141     } else {
 142       do_put_xxx(obj, field, is_field);
 143     }
 144   }
 145 }
 146 
 147 
 148 void Parse::do_get_xxx(Node* obj, ciField* field, bool is_field) {


 149   // Does this field have a constant value?  If so, just push the value.
 150   if (field->is_constant()) {






 151     // final or stable field
 152     Node* con = make_constant_from_field(field, obj);
 153     if (con != NULL) {
 154       push_node(field->layout_type(), con);
 155       return;
 156     }
 157   }
 158 
 159   ciType* field_klass = field->type();
 160   bool is_vol = field->is_volatile();
 161 
 162   // Compute address and memory type.
 163   int offset = field->offset_in_bytes();
 164   const TypePtr* adr_type = C->alias_type(field)->adr_type();
 165   Node *adr = basic_plus_adr(obj, obj, offset);
 166   BasicType bt = field->layout_type();
 167 
 168   // Build the resultant type of the load
 169   const Type *type;
 170 
 171   bool must_assert_null = false;
 172 
 173   if( bt == T_OBJECT ) {
 174     if (!field->type()->is_loaded()) {
 175       type = TypeInstPtr::BOTTOM;
 176       must_assert_null = true;
 177     } else if (field->is_static_constant()) {
 178       // This can happen if the constant oop is non-perm.
 179       ciObject* con = field->constant_value().as_object();
 180       // Do not "join" in the previous type; it doesn't add value,
 181       // and may yield a vacuous result if the field is of interface type.
 182       if (con->is_null_object()) {
 183         type = TypePtr::NULL_PTR;
 184       } else {
 185         type = TypeOopPtr::make_from_constant(con)->isa_oopptr();
 186       }




 129     if (is_get) {
 130       (void) pop();  // pop receiver before getting
 131       do_get_xxx(obj, field, is_field);
 132     } else {
 133       do_put_xxx(obj, field, is_field);
 134       (void) pop();  // pop receiver after putting
 135     }
 136   } else {
 137     const TypeInstPtr* tip = TypeInstPtr::make(field_holder->java_mirror());
 138     obj = _gvn.makecon(tip);
 139     if (is_get) {
 140       do_get_xxx(obj, field, is_field);
 141     } else {
 142       do_put_xxx(obj, field, is_field);
 143     }
 144   }
 145 }
 146 
 147 
 148 void Parse::do_get_xxx(Node* obj, ciField* field, bool is_field) {
 149   BasicType bt = field->layout_type();
 150 
 151   // Does this field have a constant value?  If so, just push the value.
 152   if (field->is_constant() &&
 153       // Keep consistent with types found by ciTypeFlow: for an
 154       // unloaded field type, ciTypeFlow::StateVector::do_getstatic()
 155       // speculates the field is null. The code in the rest of this
 156       // method does the same. We must not bypass it and use a non
 157       // null constant here.
 158       (bt != T_OBJECT || field->type()->is_loaded())) {
 159     // final or stable field
 160     Node* con = make_constant_from_field(field, obj);
 161     if (con != NULL) {
 162       push_node(field->layout_type(), con);
 163       return;
 164     }
 165   }
 166 
 167   ciType* field_klass = field->type();
 168   bool is_vol = field->is_volatile();
 169 
 170   // Compute address and memory type.
 171   int offset = field->offset_in_bytes();
 172   const TypePtr* adr_type = C->alias_type(field)->adr_type();
 173   Node *adr = basic_plus_adr(obj, obj, offset);

 174 
 175   // Build the resultant type of the load
 176   const Type *type;
 177 
 178   bool must_assert_null = false;
 179 
 180   if( bt == T_OBJECT ) {
 181     if (!field->type()->is_loaded()) {
 182       type = TypeInstPtr::BOTTOM;
 183       must_assert_null = true;
 184     } else if (field->is_static_constant()) {
 185       // This can happen if the constant oop is non-perm.
 186       ciObject* con = field->constant_value().as_object();
 187       // Do not "join" in the previous type; it doesn't add value,
 188       // and may yield a vacuous result if the field is of interface type.
 189       if (con->is_null_object()) {
 190         type = TypePtr::NULL_PTR;
 191       } else {
 192         type = TypeOopPtr::make_from_constant(con)->isa_oopptr();
 193       }


< prev index next >