hotspot/src/share/vm/opto/parse3.cpp
changeset 4567 7fc02fbe5c7a
parent 4470 1e6edcab3109
child 4893 fedc27b54caa
equal deleted inserted replaced
4566:b363f6ef4068 4567:7fc02fbe5c7a
   123 }
   123 }
   124 
   124 
   125 
   125 
   126 void Parse::do_get_xxx(const TypePtr* obj_type, Node* obj, ciField* field, bool is_field) {
   126 void Parse::do_get_xxx(const TypePtr* obj_type, Node* obj, ciField* field, bool is_field) {
   127   // Does this field have a constant value?  If so, just push the value.
   127   // Does this field have a constant value?  If so, just push the value.
   128   if (field->is_constant() && push_constant(field->constant_value()))  return;
   128   if (field->is_constant()) {
       
   129     if (field->is_static()) {
       
   130       // final static field
       
   131       if (push_constant(field->constant_value()))
       
   132         return;
       
   133     }
       
   134     else {
       
   135       // final non-static field of a trusted class ({java,sun}.dyn
       
   136       // classes).
       
   137       if (obj->is_Con()) {
       
   138         const TypeOopPtr* oop_ptr = obj->bottom_type()->isa_oopptr();
       
   139         ciObject* constant_oop = oop_ptr->const_oop();
       
   140         ciConstant constant = field->constant_value_of(constant_oop);
       
   141 
       
   142         if (push_constant(constant, true))
       
   143           return;
       
   144       }
       
   145     }
       
   146   }
   129 
   147 
   130   ciType* field_klass = field->type();
   148   ciType* field_klass = field->type();
   131   bool is_vol = field->is_volatile();
   149   bool is_vol = field->is_volatile();
   132 
   150 
   133   // Compute address and memory type.
   151   // Compute address and memory type.
   143 
   161 
   144   if( bt == T_OBJECT ) {
   162   if( bt == T_OBJECT ) {
   145     if (!field->type()->is_loaded()) {
   163     if (!field->type()->is_loaded()) {
   146       type = TypeInstPtr::BOTTOM;
   164       type = TypeInstPtr::BOTTOM;
   147       must_assert_null = true;
   165       must_assert_null = true;
   148     } else if (field->is_constant()) {
   166     } else if (field->is_constant() && field->is_static()) {
   149       // This can happen if the constant oop is non-perm.
   167       // This can happen if the constant oop is non-perm.
   150       ciObject* con = field->constant_value().as_object();
   168       ciObject* con = field->constant_value().as_object();
   151       // Do not "join" in the previous type; it doesn't add value,
   169       // Do not "join" in the previous type; it doesn't add value,
   152       // and may yield a vacuous result if the field is of interface type.
   170       // and may yield a vacuous result if the field is of interface type.
   153       type = TypeOopPtr::make_from_constant(con)->isa_oopptr();
   171       type = TypeOopPtr::make_from_constant(con)->isa_oopptr();