< prev index next >

src/hotspot/share/oops/instanceKlass.hpp

Print this page
*** 236,10 ***
--- 236,12 ---
    // State is set either at parse time or while executing, atomically to not disturb other state
    InstanceKlassFlags _misc_flags;
  
    JavaThread* volatile _init_thread;        // Pointer to current thread doing initialization (to handle recursive initialization)
  
+   int             _hash_offset;             // Offset of hidden field for i-hash
+ 
    OopMapCache*    volatile _oop_map_cache;   // OopMapCache for all methods in the klass (allocated lazily)
    JNIid*          _jni_ids;                  // First JNI identifier for static fields in this class
    jmethodID* volatile _methods_jmethod_ids;  // jmethodIDs corresponding to method_idnum, or null if none
    nmethodBucket*  volatile _dep_context;     // packed DependencyContext structure
    uint64_t        volatile _dep_context_last_cleaned;

*** 884,11 ***
   public:
    // virtual operations from Klass
    GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
                                                    Array<InstanceKlass*>* transitive_interfaces);
    bool can_be_primary_super_slow() const;
!   size_t oop_size(oop obj)  const             { return size_helper(); }
    // slow because it's a virtual call and used for verifying the layout_helper.
    // Using the layout_helper bits, we can call is_instance_klass without a virtual call.
    DEBUG_ONLY(bool is_instance_klass_slow() const      { return true; })
  
    // Iterators
--- 886,11 ---
   public:
    // virtual operations from Klass
    GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
                                                    Array<InstanceKlass*>* transitive_interfaces);
    bool can_be_primary_super_slow() const;
!   size_t oop_size(oop obj, markWord mark) const { return size_helper(); }
    // slow because it's a virtual call and used for verifying the layout_helper.
    // Using the layout_helper bits, we can call is_instance_klass without a virtual call.
    DEBUG_ONLY(bool is_instance_klass_slow() const      { return true; })
  
    // Iterators

*** 945,10 ***
--- 947,19 ---
    // Use this to return the size of an instance in heap words:
    int size_helper() const {
      return layout_helper_to_size_helper(layout_helper());
    }
  
+   virtual int hash_offset_in_bytes(oop obj) const {
+     assert(UseCompactObjectHeaders, "only with compact i-hash");
+     return _hash_offset;
+   }
+   static int hash_offset_offset_in_bytes() {
+     assert(UseCompactObjectHeaders, "only with compact i-hash");
+     return (int)offset_of(InstanceKlass, _hash_offset);
+   }
+ 
    // This bit is initialized in classFileParser.cpp.
    // It is false under any of the following conditions:
    //  - the class is abstract (including any interface)
    //  - the class size is larger than FastAllocateSizeLimit
    //  - the class is java/lang/Class, which cannot be allocated directly
< prev index next >