8237767: Field layout computation overhaul

Reviewed-by: dholmes, coleenp, lfoltan, shade
This commit is contained in:
Frederic Parain 2020-02-10 09:49:12 -05:00
parent 304d764a72
commit 9886cb401c
19 changed files with 1528 additions and 231 deletions

View file

@ -103,12 +103,28 @@ class OopMapBlock {
uint count() const { return _count; }
void set_count(uint count) { _count = count; }
void increment_count(int diff) { _count += diff; }
int offset_span() const { return _count * heapOopSize; }
int end_offset() const {
return offset() + offset_span();
}
bool is_contiguous(int another_offset) const {
return another_offset == end_offset();
}
// sizeof(OopMapBlock) in words.
static const int size_in_words() {
return align_up((int)sizeof(OopMapBlock), wordSize) >>
LogBytesPerWord;
}
static int compare_offset(const OopMapBlock* a, const OopMapBlock* b) {
return a->offset() - b->offset();
}
private:
int _offset;
uint _count;
@ -212,7 +228,6 @@ class InstanceKlass: public Klass {
// _is_marked_dependent can be set concurrently, thus cannot be part of the
// _misc_flags.
bool _is_marked_dependent; // used for marking during flushing and deoptimization
bool _is_being_redefined; // used for locking redefinition
// The low two bits of _misc_flags contains the kind field.
// This can be used to quickly discriminate among the four kinds of
@ -243,12 +258,14 @@ class InstanceKlass: public Klass {
_misc_is_shared_boot_class = 1 << 12, // defining class loader is boot class loader
_misc_is_shared_platform_class = 1 << 13, // defining class loader is platform class loader
_misc_is_shared_app_class = 1 << 14, // defining class loader is app class loader
_misc_has_resolved_methods = 1 << 15 // resolved methods table entries added for this class
_misc_has_resolved_methods = 1 << 15, // resolved methods table entries added for this class
_misc_is_being_redefined = 1 << 16, // used for locking redefinition
_misc_has_contended_annotations = 1 << 17 // has @Contended annotation
};
u2 loader_type_bits() {
return _misc_is_shared_boot_class|_misc_is_shared_platform_class|_misc_is_shared_app_class;
}
u2 _misc_flags;
u4 _misc_flags;
u2 _minor_version; // minor version number of class file
u2 _major_version; // major version number of class file
Thread* _init_thread; // Pointer to current thread doing initialization (to handle recursive initialization)
@ -571,9 +588,7 @@ public:
Klass* find_field(Symbol* name, Symbol* sig, bool is_static, fieldDescriptor* fd) const;
// find a non-static or static field given its offset within the class.
bool contains_field_offset(int offset) {
return instanceOopDesc::contains_field_offset(offset, nonstatic_field_size());
}
bool contains_field_offset(int offset);
bool find_local_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const;
bool find_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const;
@ -735,10 +750,29 @@ public:
_nonstatic_oop_map_size = words;
}
bool has_contended_annotations() const {
return ((_misc_flags & _misc_has_contended_annotations) != 0);
}
void set_has_contended_annotations(bool value) {
if (value) {
_misc_flags |= _misc_has_contended_annotations;
} else {
_misc_flags &= ~_misc_has_contended_annotations;
}
}
#if INCLUDE_JVMTI
// Redefinition locking. Class can only be redefined by one thread at a time.
bool is_being_redefined() const { return _is_being_redefined; }
void set_is_being_redefined(bool value) { _is_being_redefined = value; }
bool is_being_redefined() const {
return ((_misc_flags & _misc_is_being_redefined) != 0);
}
void set_is_being_redefined(bool value) {
if (value) {
_misc_flags |= _misc_is_being_redefined;
} else {
_misc_flags &= ~_misc_is_being_redefined;
}
}
// RedefineClasses() support for previous versions:
void add_previous_version(InstanceKlass* ik, int emcp_method_count);