8306474: Move InstanceKlass read-only flags

Reviewed-by: jrose, dholmes
This commit is contained in:
Coleen Phillimore 2023-04-20 19:20:03 +00:00
parent afd2501fcc
commit f63362310e
10 changed files with 19 additions and 33 deletions

View file

@ -4070,7 +4070,7 @@ void OopMapBlocksBuilder::print_value_on(outputStream* st) const {
void ClassFileParser::set_precomputed_flags(InstanceKlass* ik) {
assert(ik != nullptr, "invariant");
const Klass* const super = ik->super();
const InstanceKlass* const super = ik->java_super();
// Check if this klass has an empty finalize method (i.e. one with return bytecode only),
// in which case we don't have to register objects as finalizable
@ -4349,7 +4349,7 @@ static void check_final_method_override(const InstanceKlass* this_klass, TRAPS)
const Symbol* const name = m->name();
const Symbol* const signature = m->signature();
const Klass* k = this_klass->super();
const InstanceKlass* k = this_klass->java_super();
const Method* super_m = nullptr;
while (k != nullptr) {
// skip supers that don't have final methods.
@ -4381,11 +4381,11 @@ static void check_final_method_override(const InstanceKlass* this_klass, TRAPS)
}
// continue to look from super_m's holder's super.
k = super_m->method_holder()->super();
k = super_m->method_holder()->java_super();
continue;
}
k = k->super();
k = k->java_super();
}
}
}

View file

@ -2133,9 +2133,9 @@ void PrintClassClosure::do_klass(Klass* k) {
char buf[10];
int i = 0;
if (k->has_finalizer()) buf[i++] = 'F';
if (k->has_final_method()) buf[i++] = 'f';
if (k->is_instance_klass()) {
InstanceKlass* ik = InstanceKlass::cast(k);
if (ik->has_final_method()) buf[i++] = 'f';
if (ik->is_rewritten()) buf[i++] = 'W';
if (ik->is_contended()) buf[i++] = 'C';
if (ik->has_been_redefined()) buf[i++] = 'R';

View file

@ -759,6 +759,13 @@ public:
bool declares_nonstatic_concrete_methods() const { return _misc_flags.declares_nonstatic_concrete_methods(); }
void set_declares_nonstatic_concrete_methods(bool b) { _misc_flags.set_declares_nonstatic_concrete_methods(b); }
bool has_vanilla_constructor() const { return _misc_flags.has_vanilla_constructor(); }
void set_has_vanilla_constructor() { _misc_flags.set_has_vanilla_constructor(true); }
bool has_miranda_methods () const { return _misc_flags.has_miranda_methods(); }
void set_has_miranda_methods() { _misc_flags.set_has_miranda_methods(true); }
bool has_final_method() const { return _misc_flags.has_final_method(); }
void set_has_final_method() { _misc_flags.set_has_final_method(true); }
// for adding methods, ConstMethod::UNSET_IDNUM means no more ids available
inline u2 next_method_idnum();
void set_initial_method_idnum(u2 value) { _idnum_allocated_count = value; }

View file

@ -49,7 +49,11 @@ class InstanceKlassFlags {
flag(is_shared_platform_class , 1 << 8) /* defining class loader is platform class loader */ \
flag(is_shared_app_class , 1 << 9) /* defining class loader is app class loader */ \
flag(has_contended_annotations , 1 << 10) /* has @Contended annotation */ \
flag(has_localvariable_table , 1 << 11) /* has localvariable information */
flag(has_localvariable_table , 1 << 11) /* has localvariable information */ \
flag(has_miranda_methods , 1 << 12) /* True if this class has miranda methods in it's vtable */ \
flag(has_vanilla_constructor , 1 << 13) /* True if klass has a vanilla default constructor */ \
flag(has_final_method , 1 << 14) /* True if klass has final method */ \
/* end of list */
#define IK_FLAGS_ENUM_NAME(name, value) _misc_##name = value,
enum {
@ -82,7 +86,7 @@ class InstanceKlassFlags {
public:
InstanceKlassFlags() : _flags(0) {}
InstanceKlassFlags() : _flags(0), _status(0) {}
// Create getters and setters for the flag values.
#define IK_FLAGS_GET(name, ignore) \

View file

@ -659,13 +659,7 @@ protected:
bool is_synthetic() const { return _access_flags.is_synthetic(); }
void set_is_synthetic() { _access_flags.set_is_synthetic(); }
bool has_finalizer() const { return _access_flags.has_finalizer(); }
bool has_final_method() const { return _access_flags.has_final_method(); }
void set_has_finalizer() { _access_flags.set_has_finalizer(); }
void set_has_final_method() { _access_flags.set_has_final_method(); }
bool has_vanilla_constructor() const { return _access_flags.has_vanilla_constructor(); }
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_hidden() const { return access_flags().is_hidden_class(); }
void set_is_hidden() { _access_flags.set_is_hidden_class(); }
bool is_value_based() { return _access_flags.is_value_based_class(); }

View file

@ -2093,8 +2093,6 @@
declare_constant(JVM_ACC_IS_OLD) \
declare_constant(JVM_ACC_IS_OBSOLETE) \
declare_constant(JVM_ACC_IS_PREFIXED_NATIVE) \
declare_constant(JVM_ACC_HAS_MIRANDA_METHODS) \
declare_constant(JVM_ACC_HAS_VANILLA_CONSTRUCTOR) \
declare_constant(JVM_ACC_HAS_FINALIZER) \
declare_constant(JVM_ACC_IS_CLONEABLE_FAST) \
\

View file

@ -59,11 +59,8 @@ enum {
JVM_ACC_IS_DELETED = 0x00008000, // RedefineClasses() has deleted this method
// Klass* flags
JVM_ACC_HAS_MIRANDA_METHODS = 0x10000000, // True if this class has miranda methods in it's vtable
JVM_ACC_HAS_VANILLA_CONSTRUCTOR = 0x20000000, // True if klass has a vanilla default constructor
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_HIDDEN_CLASS = 0x04000000, // True if klass is hidden
JVM_ACC_IS_VALUE_BASED_CLASS = 0x08000000, // True if klass is marked as a ValueBased class
};
@ -111,10 +108,7 @@ class AccessFlags {
bool is_prefixed_native () const { return (_flags & JVM_ACC_IS_PREFIXED_NATIVE ) != 0; }
// Klass* flags
bool has_miranda_methods () const { return (_flags & JVM_ACC_HAS_MIRANDA_METHODS ) != 0; }
bool has_vanilla_constructor () const { return (_flags & JVM_ACC_HAS_VANILLA_CONSTRUCTOR) != 0; }
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_hidden_class () const { return (_flags & JVM_ACC_IS_HIDDEN_CLASS ) != 0; }
bool is_value_based_class () const { return (_flags & JVM_ACC_IS_VALUE_BASED_CLASS ) != 0; }
@ -166,11 +160,8 @@ class AccessFlags {
void clear_not_c2_compilable() { atomic_clear_bits(JVM_ACC_NOT_C2_COMPILABLE); }
void clear_not_c2_osr_compilable() { atomic_clear_bits(JVM_ACC_NOT_C2_OSR_COMPILABLE); }
// Klass* flags
void set_has_vanilla_constructor() { atomic_set_bits(JVM_ACC_HAS_VANILLA_CONSTRUCTOR); }
void set_has_finalizer() { atomic_set_bits(JVM_ACC_HAS_FINALIZER); }
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_hidden_class() { atomic_set_bits(JVM_ACC_IS_HIDDEN_CLASS); }
void set_is_value_based_class() { atomic_set_bits(JVM_ACC_IS_VALUE_BASED_CLASS); }

View file

@ -68,8 +68,6 @@ public class AccessFlags implements /* imports */ ClassConstants {
public boolean isObsolete () { return (flags & JVM_ACC_IS_OBSOLETE ) != 0; }
// Klass* flags
public boolean hasMirandaMethods () { return (flags & JVM_ACC_HAS_MIRANDA_METHODS ) != 0; }
public boolean hasVanillaConstructor() { return (flags & JVM_ACC_HAS_VANILLA_CONSTRUCTOR) != 0; }
public boolean hasFinalizer () { return (flags & JVM_ACC_HAS_FINALIZER ) != 0; }
public boolean isCloneable () { return (flags & JVM_ACC_IS_CLONEABLE ) != 0; }

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -232,6 +232,4 @@ public class Klass extends Metadata implements ClassConstants {
public boolean isSynthetic() { return getAccessFlagsObj().isSynthetic(); }
public boolean hasFinalizer() { return getAccessFlagsObj().hasFinalizer(); }
public boolean isCloneable() { return getAccessFlagsObj().isCloneable(); }
public boolean hasVanillaConstructor() { return getAccessFlagsObj().hasVanillaConstructor(); }
public boolean hasMirandaMethods () { return getAccessFlagsObj().hasMirandaMethods(); }
}

View file

@ -123,10 +123,6 @@ public interface ClassConstants
public static final long JVM_ACC_IS_OBSOLETE = 0x00010000;
// Klass* flags
// True if this class has miranda methods in it's vtable
public static final long JVM_ACC_HAS_MIRANDA_METHODS = 0x10000000;
// True if klass has a vanilla default constructor
public static final long JVM_ACC_HAS_VANILLA_CONSTRUCTOR = 0x20000000;
// True if klass has a non-empty finalize() method
public static final long JVM_ACC_HAS_FINALIZER = 0x40000000;
// True if klass supports the Clonable interface