src/share/vm/opto/memnode.cpp

changeset 3391
069ab3f976d3
parent 3320
f745b2be3737
child 3392
1dc233a8c7fe
     1.1 --- a/src/share/vm/opto/memnode.cpp	Tue Dec 20 00:55:02 2011 -0800
     1.2 +++ b/src/share/vm/opto/memnode.cpp	Wed Dec 07 11:35:03 2011 +0100
     1.3 @@ -1473,19 +1473,19 @@
     1.4  const Type*
     1.5  LoadNode::load_array_final_field(const TypeKlassPtr *tkls,
     1.6                                   ciKlass* klass) const {
     1.7 -  if (tkls->offset() == Klass::modifier_flags_offset_in_bytes() + (int)sizeof(oopDesc)) {
     1.8 +  if (tkls->offset() == in_bytes(Klass::modifier_flags_offset())) {
     1.9      // The field is Klass::_modifier_flags.  Return its (constant) value.
    1.10      // (Folds up the 2nd indirection in aClassConstant.getModifiers().)
    1.11      assert(this->Opcode() == Op_LoadI, "must load an int from _modifier_flags");
    1.12      return TypeInt::make(klass->modifier_flags());
    1.13    }
    1.14 -  if (tkls->offset() == Klass::access_flags_offset_in_bytes() + (int)sizeof(oopDesc)) {
    1.15 +  if (tkls->offset() == in_bytes(Klass::access_flags_offset())) {
    1.16      // The field is Klass::_access_flags.  Return its (constant) value.
    1.17      // (Folds up the 2nd indirection in Reflection.getClassAccessFlags(aClassConstant).)
    1.18      assert(this->Opcode() == Op_LoadI, "must load an int from _access_flags");
    1.19      return TypeInt::make(klass->access_flags());
    1.20    }
    1.21 -  if (tkls->offset() == Klass::layout_helper_offset_in_bytes() + (int)sizeof(oopDesc)) {
    1.22 +  if (tkls->offset() == in_bytes(Klass::layout_helper_offset())) {
    1.23      // The field is Klass::_layout_helper.  Return its constant value if known.
    1.24      assert(this->Opcode() == Op_LoadI, "must load an int from _layout_helper");
    1.25      return TypeInt::make(klass->layout_helper());
    1.26 @@ -1636,14 +1636,14 @@
    1.27        // We are loading a field from a Klass metaobject whose identity
    1.28        // is known at compile time (the type is "exact" or "precise").
    1.29        // Check for fields we know are maintained as constants by the VM.
    1.30 -      if (tkls->offset() == Klass::super_check_offset_offset_in_bytes() + (int)sizeof(oopDesc)) {
    1.31 +      if (tkls->offset() == in_bytes(Klass::super_check_offset_offset())) {
    1.32          // The field is Klass::_super_check_offset.  Return its (constant) value.
    1.33          // (Folds up type checking code.)
    1.34          assert(Opcode() == Op_LoadI, "must load an int from _super_check_offset");
    1.35          return TypeInt::make(klass->super_check_offset());
    1.36        }
    1.37        // Compute index into primary_supers array
    1.38 -      juint depth = (tkls->offset() - (Klass::primary_supers_offset_in_bytes() + (int)sizeof(oopDesc))) / sizeof(klassOop);
    1.39 +      juint depth = (tkls->offset() - in_bytes(Klass::primary_supers_offset())) / sizeof(klassOop);
    1.40        // Check for overflowing; use unsigned compare to handle the negative case.
    1.41        if( depth < ciKlass::primary_super_limit() ) {
    1.42          // The field is an element of Klass::_primary_supers.  Return its (constant) value.
    1.43 @@ -1654,14 +1654,14 @@
    1.44        }
    1.45        const Type* aift = load_array_final_field(tkls, klass);
    1.46        if (aift != NULL)  return aift;
    1.47 -      if (tkls->offset() == in_bytes(arrayKlass::component_mirror_offset()) + (int)sizeof(oopDesc)
    1.48 +      if (tkls->offset() == in_bytes(arrayKlass::component_mirror_offset())
    1.49            && klass->is_array_klass()) {
    1.50          // The field is arrayKlass::_component_mirror.  Return its (constant) value.
    1.51          // (Folds up aClassConstant.getComponentType, common in Arrays.copyOf.)
    1.52          assert(Opcode() == Op_LoadP, "must load an oop from _component_mirror");
    1.53          return TypeInstPtr::make(klass->as_array_klass()->component_mirror());
    1.54        }
    1.55 -      if (tkls->offset() == Klass::java_mirror_offset_in_bytes() + (int)sizeof(oopDesc)) {
    1.56 +      if (tkls->offset() == in_bytes(Klass::java_mirror_offset())) {
    1.57          // The field is Klass::_java_mirror.  Return its (constant) value.
    1.58          // (Folds up the 2nd indirection in anObjConstant.getClass().)
    1.59          assert(Opcode() == Op_LoadP, "must load an oop from _java_mirror");
    1.60 @@ -1679,7 +1679,7 @@
    1.61        if( inner->is_instance_klass() &&
    1.62            !inner->as_instance_klass()->flags().is_interface() ) {
    1.63          // Compute index into primary_supers array
    1.64 -        juint depth = (tkls->offset() - (Klass::primary_supers_offset_in_bytes() + (int)sizeof(oopDesc))) / sizeof(klassOop);
    1.65 +        juint depth = (tkls->offset() - in_bytes(Klass::primary_supers_offset())) / sizeof(klassOop);
    1.66          // Check for overflowing; use unsigned compare to handle the negative case.
    1.67          if( depth < ciKlass::primary_super_limit() &&
    1.68              depth <= klass->super_depth() ) { // allow self-depth checks to handle self-check case
    1.69 @@ -1695,7 +1695,7 @@
    1.70      // If the type is enough to determine that the thing is not an array,
    1.71      // we can give the layout_helper a positive interval type.
    1.72      // This will help short-circuit some reflective code.
    1.73 -    if (tkls->offset() == Klass::layout_helper_offset_in_bytes() + (int)sizeof(oopDesc)
    1.74 +    if (tkls->offset() == in_bytes(Klass::layout_helper_offset())
    1.75          && !klass->is_array_klass() // not directly typed as an array
    1.76          && !klass->is_interface()  // specifically not Serializable & Cloneable
    1.77          && !klass->is_java_lang_Object()   // not the supertype of all T[]
    1.78 @@ -1938,7 +1938,7 @@
    1.79      if( !klass->is_loaded() )
    1.80        return _type;             // Bail out if not loaded
    1.81      if( klass->is_obj_array_klass() &&
    1.82 -        (uint)tkls->offset() == objArrayKlass::element_klass_offset_in_bytes() + sizeof(oopDesc)) {
    1.83 +        tkls->offset() == in_bytes(objArrayKlass::element_klass_offset())) {
    1.84        ciKlass* elem = klass->as_obj_array_klass()->element_klass();
    1.85        // // Always returning precise element type is incorrect,
    1.86        // // e.g., element type could be object and array may contain strings
    1.87 @@ -1949,7 +1949,7 @@
    1.88        return TypeKlassPtr::make(tkls->ptr(), elem, 0/*offset*/);
    1.89      }
    1.90      if( klass->is_instance_klass() && tkls->klass_is_exact() &&
    1.91 -        (uint)tkls->offset() == Klass::super_offset_in_bytes() + sizeof(oopDesc)) {
    1.92 +        tkls->offset() == in_bytes(Klass::super_offset())) {
    1.93        ciKlass* sup = klass->as_instance_klass()->super();
    1.94        // The field is Klass::_super.  Return its (constant) value.
    1.95        // (Folds up the 2nd indirection in aClassConstant.getSuperClass().)
    1.96 @@ -2013,11 +2013,11 @@
    1.97                tkls->klass()->is_array_klass())
    1.98            && adr2->is_AddP()
    1.99            ) {
   1.100 -        int mirror_field = Klass::java_mirror_offset_in_bytes();
   1.101 +        int mirror_field = in_bytes(Klass::java_mirror_offset());
   1.102          if (offset == java_lang_Class::array_klass_offset_in_bytes()) {
   1.103            mirror_field = in_bytes(arrayKlass::component_mirror_offset());
   1.104          }
   1.105 -        if (tkls->offset() == mirror_field + (int)sizeof(oopDesc)) {
   1.106 +        if (tkls->offset() == mirror_field) {
   1.107            return adr2->in(AddPNode::Base);
   1.108          }
   1.109        }

mercurial