< prev index next >

src/hotspot/share/runtime/jfieldIDWorkaround.hpp

Print this page
*** 44,29 ***
    //
    // If the offset does not fit in 7 bits, or if the fieldID is
    // not checked, then the checked bit is zero and the rest of
    // the word (30 bits) contains only the offset.
    //
   private:
    enum {
      checked_bits           = 1,
      instance_bits          = 1,
!     address_bits           = BitsPerWord - checked_bits - instance_bits,
  
      large_offset_bits      = address_bits,  // unioned with address
      small_offset_bits      = 7,
      klass_bits             = address_bits - small_offset_bits,
  
      checked_shift          = 0,
      instance_shift         = checked_shift  + checked_bits,
!     address_shift          = instance_shift + instance_bits,
  
      offset_shift           = address_shift,  // unioned with address
      klass_shift            = offset_shift + small_offset_bits,
  
      checked_mask_in_place  = right_n_bits(checked_bits)  << checked_shift,
      instance_mask_in_place = right_n_bits(instance_bits) << instance_shift,
  #ifndef _WIN64
      large_offset_mask      = right_n_bits(large_offset_bits),
      small_offset_mask      = right_n_bits(small_offset_bits),
      klass_mask             = right_n_bits(klass_bits)
  #endif
--- 44,35 ---
    //
    // If the offset does not fit in 7 bits, or if the fieldID is
    // not checked, then the checked bit is zero and the rest of
    // the word (30 bits) contains only the offset.
    //
+ 
+   friend class JNI_FastGetField;
+ 
   private:
    enum {
      checked_bits           = 1,
      instance_bits          = 1,
!     inlined_bits           = 1,
+     address_bits           = BitsPerWord - checked_bits - instance_bits - inlined_bits,
  
      large_offset_bits      = address_bits,  // unioned with address
      small_offset_bits      = 7,
      klass_bits             = address_bits - small_offset_bits,
  
      checked_shift          = 0,
      instance_shift         = checked_shift  + checked_bits,
!     inlined_shift          = instance_shift + instance_bits,
+     address_shift          = inlined_shift + inlined_bits,
  
      offset_shift           = address_shift,  // unioned with address
      klass_shift            = offset_shift + small_offset_bits,
  
      checked_mask_in_place  = right_n_bits(checked_bits)  << checked_shift,
      instance_mask_in_place = right_n_bits(instance_bits) << instance_shift,
+     inlined_mask_in_place  = right_n_bits(inlined_bits) << inlined_shift,
  #ifndef _WIN64
      large_offset_mask      = right_n_bits(large_offset_bits),
      small_offset_mask      = right_n_bits(small_offset_bits),
      klass_mask             = right_n_bits(klass_bits)
  #endif

*** 105,12 ***
    static bool is_static_jfieldID(jfieldID id) {
      uintptr_t as_uint = (uintptr_t) id;
      return ((as_uint & instance_mask_in_place) == 0);
    }
  
!   static jfieldID to_instance_jfieldID(Klass* k, int offset) {
!     intptr_t as_uint = ((offset & large_offset_mask) << offset_shift) | instance_mask_in_place;
      if (VerifyJNIFields) {
        as_uint |= encode_klass_hash(k, offset);
      }
      jfieldID result = (jfieldID) as_uint;
  #ifndef ASSERT
--- 111,21 ---
    static bool is_static_jfieldID(jfieldID id) {
      uintptr_t as_uint = (uintptr_t) id;
      return ((as_uint & instance_mask_in_place) == 0);
    }
  
!   static bool is_inlined_jfieldID(jfieldID id) {
!     uintptr_t as_uint = (uintptr_t) id;
+     return ((as_uint & inlined_mask_in_place) != 0);
+   }
+ 
+   static jfieldID to_instance_jfieldID(Klass* k, int offset, bool inlined) {
+     intptr_t as_uint = ((offset & large_offset_mask) << offset_shift) |
+                         instance_mask_in_place;
+     if (inlined) {
+       as_uint |= inlined_mask_in_place;
+     }
      if (VerifyJNIFields) {
        as_uint |= encode_klass_hash(k, offset);
      }
      jfieldID result = (jfieldID) as_uint;
  #ifndef ASSERT

*** 148,17 ***
      JNIid* result = (JNIid*) id;
      assert(result->is_static_field_id(), "to_JNIid, but not static field id");
      return result;
    }
  
!   static jfieldID to_jfieldID(InstanceKlass* k, int offset, bool is_static) {
      if (is_static) {
        JNIid *id = k->jni_id_for(offset);
        debug_only(id->set_is_static_field_id());
        return jfieldIDWorkaround::to_static_jfieldID(id);
      } else {
!       return jfieldIDWorkaround::to_instance_jfieldID(k, offset);
      }
    }
  };
  
  #endif // SHARE_RUNTIME_JFIELDIDWORKAROUND_HPP
--- 163,17 ---
      JNIid* result = (JNIid*) id;
      assert(result->is_static_field_id(), "to_JNIid, but not static field id");
      return result;
    }
  
!   static jfieldID to_jfieldID(InstanceKlass* k, int offset, bool is_static, bool inlined) {
      if (is_static) {
        JNIid *id = k->jni_id_for(offset);
        debug_only(id->set_is_static_field_id());
        return jfieldIDWorkaround::to_static_jfieldID(id);
      } else {
!       return jfieldIDWorkaround::to_instance_jfieldID(k, offset, inlined);
      }
    }
  };
  
  #endif // SHARE_RUNTIME_JFIELDIDWORKAROUND_HPP
< prev index next >