< prev index next > src/hotspot/share/oops/resolvedFieldEntry.hpp
Print this page
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
void copy_from(const ResolvedFieldEntry& other) {
_field_holder = other._field_holder;
_field_offset = other._field_offset;
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: [000|has_null_marker|is_null_free_inline_type|is_flat|is_final|is_volatile]
u1 _get_code, _put_code; // Get and Put bytecodes of the field
void copy_from(const ResolvedFieldEntry& other) {
_field_holder = other._field_holder;
_field_offset = other._field_offset;
// 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,
+ has_null_marker_shift = 4,
+ max_flag_shift = has_null_marker_shift
};
// Getters
InstanceKlass* field_holder() const { return _field_holder; }
int field_offset() const { return _field_offset; }
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 has_null_marker() const { return (_flags & (1 << has_null_marker_shift)) != 0; }
bool is_resolved(Bytecodes::Code code) const {
switch(code) {
case Bytecodes::_getstatic:
case Bytecodes::_getfield:
return (get_code() == code);
}
// 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.
}
// 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,
! bool has_null_marker_flag) {
+ u1 new_flags = ((is_final_flag ? 1 : 0) << is_final_shift) | static_cast<int>(is_volatile_flag) |
+ ((is_flat_flag ? 1 : 0) << is_flat_shift) |
+ ((is_null_free_inline_type_flag ? 1 : 0) << is_null_free_inline_type_shift) |
+ ((has_null_marker_flag ? 1 : 0) << has_null_marker_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");
+ assert(has_null_marker() == has_null_marker_flag, "Must be");
}
inline void set_bytecode(u1* code, u1 new_code) {
#ifdef ASSERT
// Read once.
assert(c == 0 || c == new_code || new_code == 0, "update must be consistent");
#endif
Atomic::release_store(code, new_code);
}
! // Populate the strucutre with resolution information
void fill_in(InstanceKlass* klass, int offset, u2 index, u1 tos_state, u1 b1, u1 b2) {
_field_holder = klass;
_field_offset = offset;
_field_index = index;
_tos_state = tos_state;
// These must be set after the other fields
set_bytecode(&_get_code, b1);
set_bytecode(&_put_code, b2);
}
// CDS
#if INCLUDE_CDS
void remove_unshareable_info();
assert(c == 0 || c == new_code || new_code == 0, "update must be consistent");
#endif
Atomic::release_store(code, new_code);
}
! // Populate the structure with resolution information
void fill_in(InstanceKlass* klass, int offset, u2 index, u1 tos_state, u1 b1, u1 b2) {
_field_holder = klass;
_field_offset = offset;
_field_index = index;
_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
#if INCLUDE_CDS
void remove_unshareable_info();
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 >