Print this page
rev 1026 : imported patch indy.compiler.inline.patch

Split Close
Expand all
Collapse all
          --- old/src/share/vm/opto/parse3.cpp
          +++ new/src/share/vm/opto/parse3.cpp
↓ open down ↓ 117 lines elided ↑ open up ↑
 118  118        do_get_xxx(tkp, obj, field, is_field);
 119  119      } else {
 120  120        do_put_xxx(tkp, obj, field, is_field);
 121  121      }
 122  122    }
 123  123  }
 124  124  
 125  125  
 126  126  void Parse::do_get_xxx(const TypePtr* obj_type, Node* obj, ciField* field, bool is_field) {
 127  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  148    ciType* field_klass = field->type();
 131  149    bool is_vol = field->is_volatile();
 132  150  
 133  151    // Compute address and memory type.
 134  152    int offset = field->offset_in_bytes();
 135  153    const TypePtr* adr_type = C->alias_type(field)->adr_type();
 136  154    Node *adr = basic_plus_adr(obj, obj, offset);
 137  155    BasicType bt = field->layout_type();
 138  156  
 139  157    // Build the resultant type of the load
 140  158    const Type *type;
 141  159  
 142  160    bool must_assert_null = false;
 143  161  
 144  162    if( bt == T_OBJECT ) {
 145  163      if (!field->type()->is_loaded()) {
 146  164        type = TypeInstPtr::BOTTOM;
 147  165        must_assert_null = true;
 148      -    } else if (field->is_constant()) {
      166 +    } else if (field->is_constant() && field->is_static()) {
 149  167        // This can happen if the constant oop is non-perm.
 150  168        ciObject* con = field->constant_value().as_object();
 151  169        // Do not "join" in the previous type; it doesn't add value,
 152  170        // and may yield a vacuous result if the field is of interface type.
 153  171        type = TypeOopPtr::make_from_constant(con)->isa_oopptr();
 154  172        assert(type != NULL, "field singleton type must be consistent");
 155  173      } else {
 156  174        type = TypeOopPtr::make_from_klass(field_klass->as_klass());
 157  175      }
 158  176    } else {
↓ open down ↓ 308 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX