< prev index next >

src/hotspot/share/oops/resolvedFieldEntry.hpp

Print this page
*** 50,11 ***
    InstanceKlass* _field_holder; // Field holder klass
    int _field_offset;            // Field offset in bytes
    u2 _field_index;              // Index into field information in holder InstanceKlass
    u2 _cpool_index;              // Constant pool index
    u1 _tos_state;                // TOS state
!   u1 _flags;                    // Flags: [0000|00|is_final|is_volatile]
    u1 _get_code, _put_code;      // Get and Put bytecodes of the field
  
  public:
    ResolvedFieldEntry(u2 cpi) :
      _field_holder(nullptr),
--- 50,11 ---
    InstanceKlass* _field_holder; // Field holder klass
    int _field_offset;            // Field offset in bytes
    u2 _field_index;              // Index into field information in holder InstanceKlass
    u2 _cpool_index;              // Constant pool index
    u1 _tos_state;                // TOS state
!   u1 _flags;                    // Flags: [0000|is_null_free_inline_type|is_flat|is_final|is_volatile]
    u1 _get_code, _put_code;      // Get and Put bytecodes of the field
  
  public:
    ResolvedFieldEntry(u2 cpi) :
      _field_holder(nullptr),

*** 71,10 ***
--- 71,13 ---
    // Bit shift to get flags
    // Note: Only two flags exists at the moment but more could be added
    enum {
        is_volatile_shift     = 0,
        is_final_shift        = 1, // unused
+       is_flat_shift         = 2,
+       is_null_free_inline_type_shift = 3,
+       max_flag_shift = is_null_free_inline_type_shift,
    };
  
    // Getters
    InstanceKlass* field_holder() const { return _field_holder; }
    int field_offset()            const { return _field_offset; }

*** 83,10 ***
--- 86,12 ---
    u1 tos_state()                const { return _tos_state;    }
    u1 get_code()                 const { return Atomic::load_acquire(&_get_code);      }
    u1 put_code()                 const { return Atomic::load_acquire(&_put_code);      }
    bool is_final()               const { return (_flags & (1 << is_final_shift))    != 0; }
    bool is_volatile ()           const { return (_flags & (1 << is_volatile_shift)) != 0; }
+   bool is_flat()                const { return (_flags & (1 << is_flat_shift))     != 0; }
+   bool is_null_free_inline_type() const { return (_flags & (1 << is_null_free_inline_type_shift)) != 0; }
    bool is_resolved(Bytecodes::Code code) const {
      switch(code) {
      case Bytecodes::_getstatic:
      case Bytecodes::_getfield:
        return (get_code() == code);

*** 100,15 ***
    }
  
    // Printing
    void print_on(outputStream* st) const;
  
!   void set_flags(bool is_final_flag, bool is_volatile_flag) {
!     int new_flags = (is_final_flag << is_final_shift) | static_cast<int>(is_volatile_flag);
      _flags = checked_cast<u1>(new_flags);
      assert(is_final() == is_final_flag, "Must be");
      assert(is_volatile() == is_volatile_flag, "Must be");
    }
  
    inline void set_bytecode(u1* code, u1 new_code) {
    #ifdef ASSERT
      // Read once.
--- 105,19 ---
    }
  
    // Printing
    void print_on(outputStream* st) const;
  
!   void set_flags(bool is_final_flag, bool is_volatile_flag, bool is_flat_flag, bool is_null_free_inline_type_flag) {
!     u1 new_flags = (is_final_flag << is_final_shift) | static_cast<int>(is_volatile_flag) |
+       (is_flat_flag << is_flat_shift) |
+       (is_null_free_inline_type_flag << is_null_free_inline_type_shift);
      _flags = checked_cast<u1>(new_flags);
      assert(is_final() == is_final_flag, "Must be");
      assert(is_volatile() == is_volatile_flag, "Must be");
+     assert(is_flat() == is_flat_flag, "Must be");
+     assert(is_null_free_inline_type() == is_null_free_inline_type_flag, "Must be");
    }
  
    inline void set_bytecode(u1* code, u1 new_code) {
    #ifdef ASSERT
      // Read once.

*** 126,10 ***
--- 135,11 ---
      _tos_state = tos_state;
  
      // These must be set after the other fields
      set_bytecode(&_get_code, b1);
      set_bytecode(&_put_code, b2);
+     assert(is_valid(), "invalid");
    }
  
    // CDS
    void remove_unshareable_info();
  

*** 140,8 ***
--- 150,10 ---
    static ByteSize get_code_offset()     { return byte_offset_of(ResolvedFieldEntry, _get_code);     }
    static ByteSize put_code_offset()     { return byte_offset_of(ResolvedFieldEntry, _put_code);     }
    static ByteSize type_offset()         { return byte_offset_of(ResolvedFieldEntry, _tos_state);    }
    static ByteSize flags_offset()        { return byte_offset_of(ResolvedFieldEntry, _flags);        }
  
+   // Debug help
+   bool is_valid() const;
  };
  
  #endif //SHARE_OOPS_RESOLVEDFIELDENTRY_HPP
< prev index next >