8178543: Optimize Klass::is_shared()
Reviewed-by: coleenp, jiangli
This commit is contained in:
parent
e4f0dea860
commit
3e3183a5a1
@ -497,10 +497,12 @@ void Klass::remove_unshareable_info() {
|
||||
|
||||
// Null out class_loader_data because we don't share that yet.
|
||||
set_class_loader_data(NULL);
|
||||
set_is_shared();
|
||||
}
|
||||
|
||||
void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
|
||||
assert(is_klass(), "ensure C++ vtable is restored");
|
||||
assert(is_shared(), "must be set");
|
||||
TRACE_RESTORE_ID(this);
|
||||
|
||||
// If an exception happened during CDS restore, some of these fields may already be
|
||||
|
@ -563,6 +563,8 @@ protected:
|
||||
void set_has_vanilla_constructor() { _access_flags.set_has_vanilla_constructor(); }
|
||||
bool has_miranda_methods () const { return access_flags().has_miranda_methods(); }
|
||||
void set_has_miranda_methods() { _access_flags.set_has_miranda_methods(); }
|
||||
bool is_shared() const { return access_flags().is_shared_class(); } // shadows MetaspaceObj::is_shared)()
|
||||
void set_is_shared() { _access_flags.set_is_shared_class(); }
|
||||
|
||||
bool is_cloneable() const;
|
||||
void set_is_cloneable();
|
||||
|
@ -1014,15 +1014,16 @@ bool klassVtable::is_initialized() {
|
||||
void itableMethodEntry::initialize(Method* m) {
|
||||
if (m == NULL) return;
|
||||
|
||||
#ifdef ASSERT
|
||||
if (MetaspaceShared::is_in_shared_space((void*)&_method) &&
|
||||
!MetaspaceShared::remapped_readwrite()) {
|
||||
// At runtime initialize_itable is rerun as part of link_class_impl()
|
||||
// for a shared class loaded by the non-boot loader.
|
||||
// The dumptime itable method entry should be the same as the runtime entry.
|
||||
assert(_method == m, "sanity");
|
||||
} else {
|
||||
_method = m;
|
||||
}
|
||||
#endif
|
||||
_method = m;
|
||||
}
|
||||
|
||||
klassItable::klassItable(InstanceKlass* klass) {
|
||||
|
@ -64,6 +64,7 @@ enum {
|
||||
JVM_ACC_HAS_FINALIZER = 0x40000000, // True if klass has a non-empty finalize() method
|
||||
JVM_ACC_IS_CLONEABLE_FAST = (int)0x80000000,// True if klass implements the Cloneable interface and can be optimized in generated code
|
||||
JVM_ACC_HAS_FINAL_METHOD = 0x01000000, // True if klass has final method
|
||||
JVM_ACC_IS_SHARED_CLASS = 0x02000000, // True if klass is shared
|
||||
|
||||
// Klass* and Method* flags
|
||||
JVM_ACC_HAS_LOCAL_VARIABLE_TABLE= 0x00200000,
|
||||
@ -146,6 +147,8 @@ class AccessFlags VALUE_OBJ_CLASS_SPEC {
|
||||
bool has_finalizer () const { return (_flags & JVM_ACC_HAS_FINALIZER ) != 0; }
|
||||
bool has_final_method () const { return (_flags & JVM_ACC_HAS_FINAL_METHOD ) != 0; }
|
||||
bool is_cloneable_fast () const { return (_flags & JVM_ACC_IS_CLONEABLE_FAST ) != 0; }
|
||||
bool is_shared_class () const { return (_flags & JVM_ACC_IS_SHARED_CLASS ) != 0; }
|
||||
|
||||
// Klass* and Method* flags
|
||||
bool has_localvariable_table () const { return (_flags & JVM_ACC_HAS_LOCAL_VARIABLE_TABLE) != 0; }
|
||||
void set_has_localvariable_table() { atomic_set_bits(JVM_ACC_HAS_LOCAL_VARIABLE_TABLE); }
|
||||
@ -216,6 +219,7 @@ class AccessFlags VALUE_OBJ_CLASS_SPEC {
|
||||
void set_has_final_method() { atomic_set_bits(JVM_ACC_HAS_FINAL_METHOD); }
|
||||
void set_is_cloneable_fast() { atomic_set_bits(JVM_ACC_IS_CLONEABLE_FAST); }
|
||||
void set_has_miranda_methods() { atomic_set_bits(JVM_ACC_HAS_MIRANDA_METHODS); }
|
||||
void set_is_shared_class() { atomic_set_bits(JVM_ACC_IS_SHARED_CLASS); }
|
||||
|
||||
public:
|
||||
// field flags
|
||||
|
Loading…
Reference in New Issue
Block a user