8208999: Some use of Klass* should be replaced by InstanceKlass*

Klass::java_super() => InstanceKlass*; InstanceKlass::{local,transitive}_interfaces() => Array<InstanceKlass*>*

Reviewed-by: coleenp, hseigel
This commit is contained in:
Ioi Lam 2018-08-07 15:45:07 -07:00
parent 01cc27f875
commit 1b2e7cbaef
32 changed files with 275 additions and 245 deletions

View file

@ -922,10 +922,10 @@ void ClassFileParser::parse_interfaces(const ClassFileStream* const stream,
assert(has_nonstatic_concrete_methods != NULL, "invariant"); assert(has_nonstatic_concrete_methods != NULL, "invariant");
if (itfs_len == 0) { if (itfs_len == 0) {
_local_interfaces = Universe::the_empty_klass_array(); _local_interfaces = Universe::the_empty_instance_klass_array();
} else { } else {
assert(itfs_len > 0, "only called for len>0"); assert(itfs_len > 0, "only called for len>0");
_local_interfaces = MetadataFactory::new_array<Klass*>(_loader_data, itfs_len, NULL, CHECK); _local_interfaces = MetadataFactory::new_array<InstanceKlass*>(_loader_data, itfs_len, NULL, CHECK);
int index; int index;
for (index = 0; index < itfs_len; index++) { for (index = 0; index < itfs_len; index++) {
@ -966,7 +966,7 @@ void ClassFileParser::parse_interfaces(const ClassFileStream* const stream,
if (InstanceKlass::cast(interf)->has_nonstatic_concrete_methods()) { if (InstanceKlass::cast(interf)->has_nonstatic_concrete_methods()) {
*has_nonstatic_concrete_methods = true; *has_nonstatic_concrete_methods = true;
} }
_local_interfaces->at_put(index, interf); _local_interfaces->at_put(index, InstanceKlass::cast(interf));
} }
if (!_need_verify || itfs_len <= 1) { if (!_need_verify || itfs_len <= 1) {
@ -984,8 +984,8 @@ void ClassFileParser::parse_interfaces(const ClassFileStream* const stream,
{ {
debug_only(NoSafepointVerifier nsv;) debug_only(NoSafepointVerifier nsv;)
for (index = 0; index < itfs_len; index++) { for (index = 0; index < itfs_len; index++) {
const Klass* const k = _local_interfaces->at(index); const InstanceKlass* const k = _local_interfaces->at(index);
name = InstanceKlass::cast(k)->name(); name = k->name();
// If no duplicates, add (name, NULL) in hashtable interface_names. // If no duplicates, add (name, NULL) in hashtable interface_names.
if (!put_after_lookup(name, NULL, interface_names)) { if (!put_after_lookup(name, NULL, interface_names)) {
dup = true; dup = true;
@ -4496,7 +4496,7 @@ static void record_defined_class_dependencies(const InstanceKlass* defined_klass
} }
// add super interface dependencies // add super interface dependencies
const Array<Klass*>* const local_interfaces = defined_klass->local_interfaces(); const Array<InstanceKlass*>* const local_interfaces = defined_klass->local_interfaces();
if (local_interfaces != NULL) { if (local_interfaces != NULL) {
const int length = local_interfaces->length(); const int length = local_interfaces->length();
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
@ -4508,19 +4508,19 @@ static void record_defined_class_dependencies(const InstanceKlass* defined_klass
// utility methods for appending an array with check for duplicates // utility methods for appending an array with check for duplicates
static void append_interfaces(GrowableArray<Klass*>* result, static void append_interfaces(GrowableArray<InstanceKlass*>* result,
const Array<Klass*>* const ifs) { const Array<InstanceKlass*>* const ifs) {
// iterate over new interfaces // iterate over new interfaces
for (int i = 0; i < ifs->length(); i++) { for (int i = 0; i < ifs->length(); i++) {
Klass* const e = ifs->at(i); InstanceKlass* const e = ifs->at(i);
assert(e->is_klass() && InstanceKlass::cast(e)->is_interface(), "just checking"); assert(e->is_klass() && e->is_interface(), "just checking");
// add new interface // add new interface
result->append_if_missing(e); result->append_if_missing(e);
} }
} }
static Array<Klass*>* compute_transitive_interfaces(const InstanceKlass* super, static Array<InstanceKlass*>* compute_transitive_interfaces(const InstanceKlass* super,
Array<Klass*>* local_ifs, Array<InstanceKlass*>* local_ifs,
ClassLoaderData* loader_data, ClassLoaderData* loader_data,
TRAPS) { TRAPS) {
assert(local_ifs != NULL, "invariant"); assert(local_ifs != NULL, "invariant");
@ -4537,15 +4537,15 @@ static Array<Klass*>* compute_transitive_interfaces(const InstanceKlass* super,
// Add local interfaces' super interfaces // Add local interfaces' super interfaces
const int local_size = local_ifs->length(); const int local_size = local_ifs->length();
for (int i = 0; i < local_size; i++) { for (int i = 0; i < local_size; i++) {
Klass* const l = local_ifs->at(i); InstanceKlass* const l = local_ifs->at(i);
max_transitive_size += InstanceKlass::cast(l)->transitive_interfaces()->length(); max_transitive_size += l->transitive_interfaces()->length();
} }
// Finally add local interfaces // Finally add local interfaces
max_transitive_size += local_size; max_transitive_size += local_size;
// Construct array // Construct array
if (max_transitive_size == 0) { if (max_transitive_size == 0) {
// no interfaces, use canonicalized array // no interfaces, use canonicalized array
return Universe::the_empty_klass_array(); return Universe::the_empty_instance_klass_array();
} else if (max_transitive_size == super_size) { } else if (max_transitive_size == super_size) {
// no new local interfaces added, share superklass' transitive interface array // no new local interfaces added, share superklass' transitive interface array
return super->transitive_interfaces(); return super->transitive_interfaces();
@ -4554,7 +4554,7 @@ static Array<Klass*>* compute_transitive_interfaces(const InstanceKlass* super,
return local_ifs; return local_ifs;
} else { } else {
ResourceMark rm; ResourceMark rm;
GrowableArray<Klass*>* const result = new GrowableArray<Klass*>(max_transitive_size); GrowableArray<InstanceKlass*>* const result = new GrowableArray<InstanceKlass*>(max_transitive_size);
// Copy down from superclass // Copy down from superclass
if (super != NULL) { if (super != NULL) {
@ -4563,8 +4563,8 @@ static Array<Klass*>* compute_transitive_interfaces(const InstanceKlass* super,
// Copy down from local interfaces' superinterfaces // Copy down from local interfaces' superinterfaces
for (int i = 0; i < local_size; i++) { for (int i = 0; i < local_size; i++) {
Klass* const l = local_ifs->at(i); InstanceKlass* const l = local_ifs->at(i);
append_interfaces(result, InstanceKlass::cast(l)->transitive_interfaces()); append_interfaces(result, l->transitive_interfaces());
} }
// Finally add local interfaces // Finally add local interfaces
append_interfaces(result, local_ifs); append_interfaces(result, local_ifs);
@ -4572,10 +4572,10 @@ static Array<Klass*>* compute_transitive_interfaces(const InstanceKlass* super,
// length will be less than the max_transitive_size if duplicates were removed // length will be less than the max_transitive_size if duplicates were removed
const int length = result->length(); const int length = result->length();
assert(length <= max_transitive_size, "just checking"); assert(length <= max_transitive_size, "just checking");
Array<Klass*>* const new_result = Array<InstanceKlass*>* const new_result =
MetadataFactory::new_array<Klass*>(loader_data, length, CHECK_NULL); MetadataFactory::new_array<InstanceKlass*>(loader_data, length, CHECK_NULL);
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
Klass* const e = result->at(i); InstanceKlass* const e = result->at(i);
assert(e != NULL, "just checking"); assert(e != NULL, "just checking");
new_result->at_put(i, e); new_result->at_put(i, e);
} }
@ -4643,17 +4643,17 @@ static void check_super_class_access(const InstanceKlass* this_klass, TRAPS) {
static void check_super_interface_access(const InstanceKlass* this_klass, TRAPS) { static void check_super_interface_access(const InstanceKlass* this_klass, TRAPS) {
assert(this_klass != NULL, "invariant"); assert(this_klass != NULL, "invariant");
const Array<Klass*>* const local_interfaces = this_klass->local_interfaces(); const Array<InstanceKlass*>* const local_interfaces = this_klass->local_interfaces();
const int lng = local_interfaces->length(); const int lng = local_interfaces->length();
for (int i = lng - 1; i >= 0; i--) { for (int i = lng - 1; i >= 0; i--) {
Klass* const k = local_interfaces->at(i); InstanceKlass* const k = local_interfaces->at(i);
assert (k != NULL && k->is_interface(), "invalid interface"); assert (k != NULL && k->is_interface(), "invalid interface");
Reflection::VerifyClassAccessResults vca_result = Reflection::VerifyClassAccessResults vca_result =
Reflection::verify_class_access(this_klass, InstanceKlass::cast(k), false); Reflection::verify_class_access(this_klass, k, false);
if (vca_result != Reflection::ACCESS_OK) { if (vca_result != Reflection::ACCESS_OK) {
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
char* msg = Reflection::verify_class_access_msg(this_klass, char* msg = Reflection::verify_class_access_msg(this_klass,
InstanceKlass::cast(k), k,
vca_result); vca_result);
if (msg == NULL) { if (msg == NULL) {
bool same_module = (this_klass->module() == k->module()); bool same_module = (this_klass->module() == k->module());
@ -5735,11 +5735,11 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik, bool changed_by_loa
ik->java_super()->external_name()); ik->java_super()->external_name());
} }
// print out each of the interface classes referred to by this class. // print out each of the interface classes referred to by this class.
const Array<Klass*>* const local_interfaces = ik->local_interfaces(); const Array<InstanceKlass*>* const local_interfaces = ik->local_interfaces();
if (local_interfaces != NULL) { if (local_interfaces != NULL) {
const int length = local_interfaces->length(); const int length = local_interfaces->length();
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
const Klass* const k = local_interfaces->at(i); const InstanceKlass* const k = local_interfaces->at(i);
const char * to = k->external_name(); const char * to = k->external_name();
log_debug(class, resolve)("%s %s (interface)", from, to); log_debug(class, resolve)("%s %s (interface)", from, to);
} }
@ -6272,7 +6272,7 @@ void ClassFileParser::post_process_parsed_stream(const ClassFileStream* const st
assert(_loader_data != NULL, "invariant"); assert(_loader_data != NULL, "invariant");
if (_class_name == vmSymbols::java_lang_Object()) { if (_class_name == vmSymbols::java_lang_Object()) {
check_property(_local_interfaces == Universe::the_empty_klass_array(), check_property(_local_interfaces == Universe::the_empty_instance_klass_array(),
"java.lang.Object cannot implement an interface in class file %s", "java.lang.Object cannot implement an interface in class file %s",
CHECK); CHECK);
} }

View file

@ -99,8 +99,8 @@ class ClassFileParser {
Array<u2>* _inner_classes; Array<u2>* _inner_classes;
Array<u2>* _nest_members; Array<u2>* _nest_members;
u2 _nest_host; u2 _nest_host;
Array<Klass*>* _local_interfaces; Array<InstanceKlass*>* _local_interfaces;
Array<Klass*>* _transitive_interfaces; Array<InstanceKlass*>* _transitive_interfaces;
Annotations* _combined_annotations; Annotations* _combined_annotations;
AnnotationArray* _annotations; AnnotationArray* _annotations;
AnnotationArray* _type_annotations; AnnotationArray* _type_annotations;

View file

@ -242,12 +242,23 @@ Klass* SystemDictionary::resolve_or_fail(Symbol* class_name,
} }
// Forwards to resolve_instance_class_or_null // Forwards to resolve_array_class_or_null or resolve_instance_class_or_null
Klass* SystemDictionary::resolve_or_null(Symbol* class_name, Handle class_loader, Handle protection_domain, TRAPS) { Klass* SystemDictionary::resolve_or_null(Symbol* class_name, Handle class_loader, Handle protection_domain, TRAPS) {
if (FieldType::is_array(class_name)) { if (FieldType::is_array(class_name)) {
return resolve_array_class_or_null(class_name, class_loader, protection_domain, THREAD); return resolve_array_class_or_null(class_name, class_loader, protection_domain, THREAD);
} else if (FieldType::is_obj(class_name)) { } else {
return resolve_instance_class_or_null_helper(class_name, class_loader, protection_domain, THREAD);
}
}
// name may be in the form of "java/lang/Object" or "Ljava/lang/Object;"
InstanceKlass* SystemDictionary::resolve_instance_class_or_null_helper(Symbol* class_name,
Handle class_loader,
Handle protection_domain,
TRAPS) {
assert(class_name != NULL && !FieldType::is_array(class_name), "must be");
if (FieldType::is_obj(class_name)) {
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
// Ignore wrapping L and ;. // Ignore wrapping L and ;.
TempNewSymbol name = SymbolTable::new_symbol(class_name->as_C_string() + 1, TempNewSymbol name = SymbolTable::new_symbol(class_name->as_C_string() + 1,
@ -330,17 +341,18 @@ Klass* SystemDictionary::resolve_array_class_or_null(Symbol* class_name,
// placeholders()->find_and_add(PlaceholderTable::LOAD_SUPER), // placeholders()->find_and_add(PlaceholderTable::LOAD_SUPER),
// you need to find_and_remove it before returning. // you need to find_and_remove it before returning.
// So be careful to not exit with a CHECK_ macro betweeen these calls. // So be careful to not exit with a CHECK_ macro betweeen these calls.
Klass* SystemDictionary::resolve_super_or_fail(Symbol* child_name, InstanceKlass* SystemDictionary::resolve_super_or_fail(Symbol* child_name,
Symbol* class_name, Symbol* super_name,
Handle class_loader, Handle class_loader,
Handle protection_domain, Handle protection_domain,
bool is_superclass, bool is_superclass,
TRAPS) { TRAPS) {
assert(!FieldType::is_array(super_name), "invalid super class name");
#if INCLUDE_CDS #if INCLUDE_CDS
if (DumpSharedSpaces) { if (DumpSharedSpaces) {
// Special processing for CDS dump time. // Special processing for CDS dump time.
Klass* k = SystemDictionaryShared::dump_time_resolve_super_or_fail(child_name, InstanceKlass* k = SystemDictionaryShared::dump_time_resolve_super_or_fail(child_name,
class_name, class_loader, protection_domain, is_superclass, CHECK_NULL); super_name, class_loader, protection_domain, is_superclass, CHECK_NULL);
if (k) { if (k) {
return k; return k;
} }
@ -372,18 +384,17 @@ Klass* SystemDictionary::resolve_super_or_fail(Symbol* child_name,
bool throw_circularity_error = false; bool throw_circularity_error = false;
{ {
MutexLocker mu(SystemDictionary_lock, THREAD); MutexLocker mu(SystemDictionary_lock, THREAD);
Klass* childk = find_class(d_hash, child_name, dictionary); InstanceKlass* childk = find_class(d_hash, child_name, dictionary);
Klass* quicksuperk; InstanceKlass* quicksuperk;
// to support // loading: if child done loading, just return superclass // to support // loading: if child done loading, just return superclass
// if class_name, & class_loader don't match: // if super_name, & class_loader don't match:
// if initial define, SD update will give LinkageError // if initial define, SD update will give LinkageError
// if redefine: compare_class_versions will give HIERARCHY_CHANGED // if redefine: compare_class_versions will give HIERARCHY_CHANGED
// so we don't throw an exception here. // so we don't throw an exception here.
// see: nsk redefclass014 & java.lang.instrument Instrument032 // see: nsk redefclass014 & java.lang.instrument Instrument032
if ((childk != NULL ) && (is_superclass) && if ((childk != NULL ) && (is_superclass) &&
((quicksuperk = childk->super()) != NULL) && ((quicksuperk = childk->java_super()) != NULL) &&
((quicksuperk->name() == super_name) &&
((quicksuperk->name() == class_name) &&
(oopDesc::equals(quicksuperk->class_loader(), class_loader())))) { (oopDesc::equals(quicksuperk->class_loader(), class_loader())))) {
return quicksuperk; return quicksuperk;
} else { } else {
@ -394,7 +405,7 @@ Klass* SystemDictionary::resolve_super_or_fail(Symbol* child_name,
} }
if (!throw_circularity_error) { if (!throw_circularity_error) {
// Be careful not to exit resolve_super // Be careful not to exit resolve_super
PlaceholderEntry* newprobe = placeholders()->find_and_add(p_index, p_hash, child_name, loader_data, PlaceholderTable::LOAD_SUPER, class_name, THREAD); PlaceholderEntry* newprobe = placeholders()->find_and_add(p_index, p_hash, child_name, loader_data, PlaceholderTable::LOAD_SUPER, super_name, THREAD);
} }
} }
if (throw_circularity_error) { if (throw_circularity_error) {
@ -403,9 +414,10 @@ Klass* SystemDictionary::resolve_super_or_fail(Symbol* child_name,
} }
// java.lang.Object should have been found above // java.lang.Object should have been found above
assert(class_name != NULL, "null super class for resolving"); assert(super_name != NULL, "null super class for resolving");
// Resolve the super class or interface, check results on return // Resolve the super class or interface, check results on return
Klass* superk = SystemDictionary::resolve_or_null(class_name, InstanceKlass* superk =
SystemDictionary::resolve_instance_class_or_null_helper(super_name,
class_loader, class_loader,
protection_domain, protection_domain,
THREAD); THREAD);
@ -423,7 +435,11 @@ Klass* SystemDictionary::resolve_super_or_fail(Symbol* child_name,
} }
if (HAS_PENDING_EXCEPTION || superk == NULL) { if (HAS_PENDING_EXCEPTION || superk == NULL) {
// can null superk // can null superk
superk = handle_resolution_exception(class_name, true, superk, THREAD); Klass* k = handle_resolution_exception(super_name, true, superk, THREAD);
assert(k == NULL || k == superk, "must be");
if (k == NULL) {
superk = NULL;
}
} }
return superk; return superk;
@ -639,7 +655,9 @@ static void post_class_load_event(EventClassLoad* event, const InstanceKlass* k,
// placeholders()->find_and_add(PlaceholderTable::LOAD_INSTANCE), // placeholders()->find_and_add(PlaceholderTable::LOAD_INSTANCE),
// you need to find_and_remove it before returning. // you need to find_and_remove it before returning.
// So be careful to not exit with a CHECK_ macro betweeen these calls. // So be careful to not exit with a CHECK_ macro betweeen these calls.
Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, //
// name must be in the form of "java/lang/Object" -- cannot be "Ljava/lang/Object;"
InstanceKlass* SystemDictionary::resolve_instance_class_or_null(Symbol* name,
Handle class_loader, Handle class_loader,
Handle protection_domain, Handle protection_domain,
TRAPS) { TRAPS) {
@ -663,7 +681,7 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name,
// before we return a result we call out to java to check for valid protection domain // before we return a result we call out to java to check for valid protection domain
// to allow returning the Klass* and add it to the pd_set if it is valid // to allow returning the Klass* and add it to the pd_set if it is valid
{ {
Klass* probe = dictionary->find(d_hash, name, protection_domain); InstanceKlass* probe = dictionary->find(d_hash, name, protection_domain);
if (probe != NULL) return probe; if (probe != NULL) return probe;
} }
@ -706,7 +724,7 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name,
MutexLocker mu(SystemDictionary_lock, THREAD); MutexLocker mu(SystemDictionary_lock, THREAD);
InstanceKlass* check = find_class(d_hash, name, dictionary); InstanceKlass* check = find_class(d_hash, name, dictionary);
if (check != NULL) { if (check != NULL) {
// Klass is already loaded, so just return it // InstanceKlass is already loaded, so just return it
class_has_been_loaded = true; class_has_been_loaded = true;
k = check; k = check;
} else { } else {
@ -877,7 +895,7 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name,
{ {
ClassLoaderData* loader_data = k->class_loader_data(); ClassLoaderData* loader_data = k->class_loader_data();
MutexLocker mu(SystemDictionary_lock, THREAD); MutexLocker mu(SystemDictionary_lock, THREAD);
Klass* kk = find_class(name, loader_data); InstanceKlass* kk = find_class(name, loader_data);
assert(kk == k, "should be present in dictionary"); assert(kk == k, "should be present in dictionary");
} }
#endif #endif
@ -1308,10 +1326,10 @@ InstanceKlass* SystemDictionary::load_shared_class(InstanceKlass* ik,
} }
} }
Array<Klass*>* interfaces = ik->local_interfaces(); Array<InstanceKlass*>* interfaces = ik->local_interfaces();
int num_interfaces = interfaces->length(); int num_interfaces = interfaces->length();
for (int index = 0; index < num_interfaces; index++) { for (int index = 0; index < num_interfaces; index++) {
Klass* k = interfaces->at(index); InstanceKlass* k = interfaces->at(index);
Symbol* name = k->name(); Symbol* name = k->name();
Klass* i = resolve_super_or_fail(class_name, name, class_loader, protection_domain, false, CHECK_NULL); Klass* i = resolve_super_or_fail(class_name, name, class_loader, protection_domain, false, CHECK_NULL);
if (k != i) { if (k != i) {

View file

@ -280,7 +280,7 @@ public:
// Resolve a superclass or superinterface. Called from ClassFileParser, // Resolve a superclass or superinterface. Called from ClassFileParser,
// parse_interfaces, resolve_instance_class_or_null, load_shared_class // parse_interfaces, resolve_instance_class_or_null, load_shared_class
// "child_name" is the class whose super class or interface is being resolved. // "child_name" is the class whose super class or interface is being resolved.
static Klass* resolve_super_or_fail(Symbol* child_name, static InstanceKlass* resolve_super_or_fail(Symbol* child_name,
Symbol* class_name, Symbol* class_name,
Handle class_loader, Handle class_loader,
Handle protection_domain, Handle protection_domain,
@ -638,7 +638,11 @@ protected:
static SymbolPropertyTable* invoke_method_table() { return _invoke_method_table; } static SymbolPropertyTable* invoke_method_table() { return _invoke_method_table; }
// Basic loading operations // Basic loading operations
static Klass* resolve_instance_class_or_null(Symbol* class_name, Handle class_loader, Handle protection_domain, TRAPS); static InstanceKlass* resolve_instance_class_or_null_helper(Symbol* name,
Handle class_loader,
Handle protection_domain,
TRAPS);
static InstanceKlass* resolve_instance_class_or_null(Symbol* class_name, Handle class_loader, Handle protection_domain, TRAPS);
static Klass* resolve_array_class_or_null(Symbol* class_name, Handle class_loader, Handle protection_domain, TRAPS); static Klass* resolve_array_class_or_null(Symbol* class_name, Handle class_loader, Handle protection_domain, TRAPS);
static InstanceKlass* handle_parallel_super_load(Symbol* class_name, Symbol* supername, Handle class_loader, Handle protection_domain, Handle lockObject, TRAPS); static InstanceKlass* handle_parallel_super_load(Symbol* class_name, Symbol* supername, Handle class_loader, Handle protection_domain, Handle lockObject, TRAPS);
// Wait on SystemDictionary_lock; unlocks lockObject before // Wait on SystemDictionary_lock; unlocks lockObject before

View file

@ -505,9 +505,9 @@ InstanceKlass* SystemDictionaryShared::find_or_load_shared_class(
{ {
MutexLocker mu(SystemDictionary_lock, THREAD); MutexLocker mu(SystemDictionary_lock, THREAD);
Klass* check = find_class(d_hash, name, dictionary); InstanceKlass* check = find_class(d_hash, name, dictionary);
if (check != NULL) { if (check != NULL) {
return InstanceKlass::cast(check); return check;
} }
} }
@ -524,10 +524,9 @@ InstanceKlass* SystemDictionaryShared::load_shared_class_for_builtin_loader(
Symbol* class_name, Handle class_loader, TRAPS) { Symbol* class_name, Handle class_loader, TRAPS) {
assert(UseSharedSpaces, "must be"); assert(UseSharedSpaces, "must be");
assert(shared_dictionary() != NULL, "already checked"); assert(shared_dictionary() != NULL, "already checked");
Klass* k = shared_dictionary()->find_class_for_builtin_loader(class_name); InstanceKlass* ik = shared_dictionary()->find_class_for_builtin_loader(class_name);
if (k != NULL) { if (ik != NULL) {
InstanceKlass* ik = InstanceKlass::cast(k);
if ((ik->is_shared_app_class() && if ((ik->is_shared_app_class() &&
SystemDictionary::is_system_class_loader(class_loader())) || SystemDictionary::is_system_class_loader(class_loader())) ||
(ik->is_shared_platform_class() && (ik->is_shared_platform_class() &&
@ -594,7 +593,7 @@ InstanceKlass* SystemDictionaryShared::lookup_from_stream(const Symbol* class_na
} }
ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader()); ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader());
Klass* k; InstanceKlass* k;
{ // UNREGISTERED loader { // UNREGISTERED loader
if (!shared_dictionary()->class_exists_for_unregistered_loader(class_name)) { if (!shared_dictionary()->class_exists_for_unregistered_loader(class_name)) {
@ -613,7 +612,7 @@ InstanceKlass* SystemDictionaryShared::lookup_from_stream(const Symbol* class_na
return NULL; return NULL;
} }
return acquire_class_for_current_thread(InstanceKlass::cast(k), class_loader, return acquire_class_for_current_thread(k, class_loader,
protection_domain, THREAD); protection_domain, THREAD);
} }
@ -672,7 +671,7 @@ bool SystemDictionaryShared::add_non_builtin_klass(Symbol* name,
// java/lang/Object id: 0 // java/lang/Object id: 0
// Interface id: 2 super: 0 source: cust.jar // Interface id: 2 super: 0 source: cust.jar
// ChildClass id: 4 super: 0 interfaces: 2 source: cust.jar // ChildClass id: 4 super: 0 interfaces: 2 source: cust.jar
Klass* SystemDictionaryShared::dump_time_resolve_super_or_fail( InstanceKlass* SystemDictionaryShared::dump_time_resolve_super_or_fail(
Symbol* child_name, Symbol* class_name, Handle class_loader, Symbol* child_name, Symbol* class_name, Handle class_loader,
Handle protection_domain, bool is_superclass, TRAPS) { Handle protection_domain, bool is_superclass, TRAPS) {
@ -700,14 +699,14 @@ Klass* SystemDictionaryShared::dump_time_resolve_super_or_fail(
} }
struct SharedMiscInfo { struct SharedMiscInfo {
Klass* _klass; InstanceKlass* _klass;
int _clsfile_size; int _clsfile_size;
int _clsfile_crc32; int _clsfile_crc32;
}; };
static GrowableArray<SharedMiscInfo>* misc_info_array = NULL; static GrowableArray<SharedMiscInfo>* misc_info_array = NULL;
void SystemDictionaryShared::set_shared_class_misc_info(Klass* k, ClassFileStream* cfs) { void SystemDictionaryShared::set_shared_class_misc_info(InstanceKlass* k, ClassFileStream* cfs) {
assert(DumpSharedSpaces, "only when dumping"); assert(DumpSharedSpaces, "only when dumping");
int clsfile_size = cfs->length(); int clsfile_size = cfs->length();
int clsfile_crc32 = ClassLoader::crc32(0, (const char*)cfs->buffer(), cfs->length()); int clsfile_crc32 = ClassLoader::crc32(0, (const char*)cfs->buffer(), cfs->length());
@ -731,7 +730,7 @@ void SystemDictionaryShared::set_shared_class_misc_info(Klass* k, ClassFileStrea
misc_info_array->append(misc_info); misc_info_array->append(misc_info);
} }
void SystemDictionaryShared::init_shared_dictionary_entry(Klass* k, DictionaryEntry* ent) { void SystemDictionaryShared::init_shared_dictionary_entry(InstanceKlass* k, DictionaryEntry* ent) {
SharedDictionaryEntry* entry = (SharedDictionaryEntry*)ent; SharedDictionaryEntry* entry = (SharedDictionaryEntry*)ent;
entry->_id = -1; entry->_id = -1;
entry->_clsfile_size = -1; entry->_clsfile_size = -1;
@ -752,7 +751,7 @@ void SystemDictionaryShared::init_shared_dictionary_entry(Klass* k, DictionaryEn
} }
} }
bool SystemDictionaryShared::add_verification_constraint(Klass* k, Symbol* name, bool SystemDictionaryShared::add_verification_constraint(InstanceKlass* k, Symbol* name,
Symbol* from_name, bool from_field_is_protected, bool from_is_array, bool from_is_object) { Symbol* from_name, bool from_field_is_protected, bool from_is_array, bool from_is_object) {
assert(DumpSharedSpaces, "called at dump time only"); assert(DumpSharedSpaces, "called at dump time only");
@ -796,7 +795,7 @@ void SystemDictionaryShared::check_verification_constraints(InstanceKlass* klass
entry->check_verification_constraints(klass, THREAD); entry->check_verification_constraints(klass, THREAD);
} }
SharedDictionaryEntry* SharedDictionary::find_entry_for(Klass* klass) { SharedDictionaryEntry* SharedDictionary::find_entry_for(InstanceKlass* klass) {
Symbol* class_name = klass->name(); Symbol* class_name = klass->name();
unsigned int hash = compute_hash(class_name); unsigned int hash = compute_hash(class_name);
int index = hash_to_index(hash); int index = hash_to_index(hash);
@ -970,7 +969,7 @@ bool SharedDictionary::add_non_builtin_klass(const Symbol* class_name,
entry != NULL; entry != NULL;
entry = entry->next()) { entry = entry->next()) {
if (entry->hash() == hash) { if (entry->hash() == hash) {
Klass* klass = (Klass*)entry->literal(); InstanceKlass* klass = entry->instance_klass();
if (klass->name() == class_name && klass->class_loader_data() == loader_data) { if (klass->name() == class_name && klass->class_loader_data() == loader_data) {
// There is already a class defined with the same name // There is already a class defined with the same name
return false; return false;
@ -993,22 +992,22 @@ bool SharedDictionary::add_non_builtin_klass(const Symbol* class_name,
//----------------- //-----------------
Klass* SharedDictionary::find_class_for_builtin_loader(const Symbol* name) const { InstanceKlass* SharedDictionary::find_class_for_builtin_loader(const Symbol* name) const {
SharedDictionaryEntry* entry = get_entry_for_builtin_loader(name); SharedDictionaryEntry* entry = get_entry_for_builtin_loader(name);
return entry != NULL ? entry->instance_klass() : (Klass*)NULL; return entry != NULL ? entry->instance_klass() : (InstanceKlass*)NULL;
} }
Klass* SharedDictionary::find_class_for_unregistered_loader(const Symbol* name, InstanceKlass* SharedDictionary::find_class_for_unregistered_loader(const Symbol* name,
int clsfile_size, int clsfile_size,
int clsfile_crc32) const { int clsfile_crc32) const {
const SharedDictionaryEntry* entry = get_entry_for_unregistered_loader(name, const SharedDictionaryEntry* entry = get_entry_for_unregistered_loader(name,
clsfile_size, clsfile_size,
clsfile_crc32); clsfile_crc32);
return entry != NULL ? entry->instance_klass() : (Klass*)NULL; return entry != NULL ? entry->instance_klass() : NULL;
} }
void SharedDictionary::update_entry(Klass* klass, int id) { void SharedDictionary::update_entry(InstanceKlass* klass, int id) {
assert(DumpSharedSpaces, "supported only when dumping"); assert(DumpSharedSpaces, "supported only when dumping");
Symbol* class_name = klass->name(); Symbol* class_name = klass->name();
unsigned int hash = compute_hash(class_name); unsigned int hash = compute_hash(class_name);

View file

@ -132,7 +132,7 @@ public:
// See "Identifying the loader_type of archived classes" comments above. // See "Identifying the loader_type of archived classes" comments above.
LoaderType loader_type() const { LoaderType loader_type() const {
Klass* k = (Klass*)literal(); InstanceKlass* k = instance_klass();
if ((k->shared_classpath_index() != UNREGISTERED_INDEX)) { if ((k->shared_classpath_index() != UNREGISTERED_INDEX)) {
return LT_BUILTIN; return LT_BUILTIN;
@ -171,17 +171,17 @@ class SharedDictionary : public Dictionary {
} }
public: public:
SharedDictionaryEntry* find_entry_for(Klass* klass); SharedDictionaryEntry* find_entry_for(InstanceKlass* klass);
void finalize_verification_constraints(); void finalize_verification_constraints();
bool add_non_builtin_klass(const Symbol* class_name, bool add_non_builtin_klass(const Symbol* class_name,
ClassLoaderData* loader_data, ClassLoaderData* loader_data,
InstanceKlass* obj); InstanceKlass* obj);
void update_entry(Klass* klass, int id); void update_entry(InstanceKlass* klass, int id);
Klass* find_class_for_builtin_loader(const Symbol* name) const; InstanceKlass* find_class_for_builtin_loader(const Symbol* name) const;
Klass* find_class_for_unregistered_loader(const Symbol* name, InstanceKlass* find_class_for_unregistered_loader(const Symbol* name,
int clsfile_size, int clsfile_size,
int clsfile_crc32) const; int clsfile_crc32) const;
bool class_exists_for_unregistered_loader(const Symbol* name) { bool class_exists_for_unregistered_loader(const Symbol* name) {
@ -317,7 +317,7 @@ public:
static bool add_non_builtin_klass(Symbol* class_name, ClassLoaderData* loader_data, static bool add_non_builtin_klass(Symbol* class_name, ClassLoaderData* loader_data,
InstanceKlass* k, TRAPS); InstanceKlass* k, TRAPS);
static Klass* dump_time_resolve_super_or_fail(Symbol* child_name, static InstanceKlass* dump_time_resolve_super_or_fail(Symbol* child_name,
Symbol* class_name, Symbol* class_name,
Handle class_loader, Handle class_loader,
Handle protection_domain, Handle protection_domain,
@ -327,7 +327,7 @@ public:
static size_t dictionary_entry_size() { static size_t dictionary_entry_size() {
return (DumpSharedSpaces) ? sizeof(SharedDictionaryEntry) : sizeof(DictionaryEntry); return (DumpSharedSpaces) ? sizeof(SharedDictionaryEntry) : sizeof(DictionaryEntry);
} }
static void init_shared_dictionary_entry(Klass* k, DictionaryEntry* entry) NOT_CDS_RETURN; static void init_shared_dictionary_entry(InstanceKlass* k, DictionaryEntry* entry) NOT_CDS_RETURN;
static bool is_builtin(DictionaryEntry* ent) { static bool is_builtin(DictionaryEntry* ent) {
// Can't use virtual function is_builtin because DictionaryEntry doesn't initialize // Can't use virtual function is_builtin because DictionaryEntry doesn't initialize
// vtable because it's not constructed properly. // vtable because it's not constructed properly.
@ -345,13 +345,13 @@ public:
return (SharedDictionary*)ClassLoaderData::the_null_class_loader_data()->dictionary(); return (SharedDictionary*)ClassLoaderData::the_null_class_loader_data()->dictionary();
} }
static void update_shared_entry(Klass* klass, int id) { static void update_shared_entry(InstanceKlass* klass, int id) {
assert(DumpSharedSpaces, "sanity"); assert(DumpSharedSpaces, "sanity");
assert((SharedDictionary*)(klass->class_loader_data()->dictionary()) != NULL, "sanity"); assert((SharedDictionary*)(klass->class_loader_data()->dictionary()) != NULL, "sanity");
((SharedDictionary*)(klass->class_loader_data()->dictionary()))->update_entry(klass, id); ((SharedDictionary*)(klass->class_loader_data()->dictionary()))->update_entry(klass, id);
} }
static void set_shared_class_misc_info(Klass* k, ClassFileStream* cfs); static void set_shared_class_misc_info(InstanceKlass* k, ClassFileStream* cfs);
static InstanceKlass* lookup_from_stream(const Symbol* class_name, static InstanceKlass* lookup_from_stream(const Symbol* class_name,
Handle class_loader, Handle class_loader,
@ -367,7 +367,7 @@ public:
// ensures that you cannot load a shared class if its super type(s) are changed. However, // ensures that you cannot load a shared class if its super type(s) are changed. However,
// we need an additional check to ensure that the verification_constraints did not change // we need an additional check to ensure that the verification_constraints did not change
// between dump time and runtime. // between dump time and runtime.
static bool add_verification_constraint(Klass* k, Symbol* name, static bool add_verification_constraint(InstanceKlass* k, Symbol* name,
Symbol* from_name, bool from_field_is_protected, Symbol* from_name, bool from_field_is_protected,
bool from_is_array, bool from_is_object) NOT_CDS_RETURN_(false); bool from_is_array, bool from_is_object) NOT_CDS_RETURN_(false);
static void finalize_verification_constraints() NOT_CDS_RETURN; static void finalize_verification_constraints() NOT_CDS_RETURN;

View file

@ -2678,10 +2678,10 @@ bool ClassVerifier::is_same_or_direct_interface(
VerificationType klass_type, VerificationType klass_type,
VerificationType ref_class_type) { VerificationType ref_class_type) {
if (ref_class_type.equals(klass_type)) return true; if (ref_class_type.equals(klass_type)) return true;
Array<Klass*>* local_interfaces = klass->local_interfaces(); Array<InstanceKlass*>* local_interfaces = klass->local_interfaces();
if (local_interfaces != NULL) { if (local_interfaces != NULL) {
for (int x = 0; x < local_interfaces->length(); x++) { for (int x = 0; x < local_interfaces->length(); x++) {
Klass* k = local_interfaces->at(x); InstanceKlass* k = local_interfaces->at(x);
assert (k != NULL && k->is_interface(), "invalid interface"); assert (k != NULL && k->is_interface(), "invalid interface");
if (ref_class_type.equals(VerificationType::reference_type(k->name()))) { if (ref_class_type.equals(VerificationType::reference_type(k->name()))) {
return true; return true;

View file

@ -716,7 +716,7 @@ class DepChange : public StackObj {
// iteration variables: // iteration variables:
ChangeType _change_type; ChangeType _change_type;
Klass* _klass; Klass* _klass;
Array<Klass*>* _ti_base; // i.e., transitive_interfaces Array<InstanceKlass*>* _ti_base; // i.e., transitive_interfaces
int _ti_index; int _ti_index;
int _ti_limit; int _ti_limit;

View file

@ -465,7 +465,7 @@ static void print_classname(outputStream* st, Klass* klass) {
} }
} }
static void print_interface(outputStream* st, Klass* intf_klass, const char* intf_type, int indent) { static void print_interface(outputStream* st, InstanceKlass* intf_klass, const char* intf_type, int indent) {
print_indent(st, indent); print_indent(st, indent);
st->print(" implements "); st->print(" implements ");
print_classname(st, intf_klass); print_classname(st, intf_klass);
@ -501,13 +501,13 @@ void KlassHierarchy::print_class(outputStream* st, KlassInfoEntry* cie, bool pri
// Print any interfaces the class has. // Print any interfaces the class has.
if (print_interfaces) { if (print_interfaces) {
Array<Klass*>* local_intfs = klass->local_interfaces(); Array<InstanceKlass*>* local_intfs = klass->local_interfaces();
Array<Klass*>* trans_intfs = klass->transitive_interfaces(); Array<InstanceKlass*>* trans_intfs = klass->transitive_interfaces();
for (int i = 0; i < local_intfs->length(); i++) { for (int i = 0; i < local_intfs->length(); i++) {
print_interface(st, local_intfs->at(i), "declared", indent); print_interface(st, local_intfs->at(i), "declared", indent);
} }
for (int i = 0; i < trans_intfs->length(); i++) { for (int i = 0; i < trans_intfs->length(); i++) {
Klass* trans_interface = trans_intfs->at(i); InstanceKlass* trans_interface = trans_intfs->at(i);
// Only print transitive interfaces if they are not also declared. // Only print transitive interfaces if they are not also declared.
if (!local_intfs->contains(trans_interface)) { if (!local_intfs->contains(trans_interface)) {
print_interface(st, trans_interface, "inherited", indent); print_interface(st, trans_interface, "inherited", indent);

View file

@ -135,6 +135,7 @@ oop Universe::_reference_pending_list = NULL;
Array<int>* Universe::_the_empty_int_array = NULL; Array<int>* Universe::_the_empty_int_array = NULL;
Array<u2>* Universe::_the_empty_short_array = NULL; Array<u2>* Universe::_the_empty_short_array = NULL;
Array<Klass*>* Universe::_the_empty_klass_array = NULL; Array<Klass*>* Universe::_the_empty_klass_array = NULL;
Array<InstanceKlass*>* Universe::_the_empty_instance_klass_array = NULL;
Array<Method*>* Universe::_the_empty_method_array = NULL; Array<Method*>* Universe::_the_empty_method_array = NULL;
// These variables are guarded by FullGCALot_lock. // These variables are guarded by FullGCALot_lock.
@ -234,6 +235,7 @@ void Universe::metaspace_pointers_do(MetaspaceClosure* it) {
it->push(&_the_empty_int_array); it->push(&_the_empty_int_array);
it->push(&_the_empty_short_array); it->push(&_the_empty_short_array);
it->push(&_the_empty_klass_array); it->push(&_the_empty_klass_array);
it->push(&_the_empty_instance_klass_array);
it->push(&_the_empty_method_array); it->push(&_the_empty_method_array);
it->push(&_the_array_interfaces_array); it->push(&_the_array_interfaces_array);
@ -287,6 +289,7 @@ void Universe::serialize(SerializeClosure* f, bool do_all) {
f->do_ptr((void**)&_the_empty_short_array); f->do_ptr((void**)&_the_empty_short_array);
f->do_ptr((void**)&_the_empty_method_array); f->do_ptr((void**)&_the_empty_method_array);
f->do_ptr((void**)&_the_empty_klass_array); f->do_ptr((void**)&_the_empty_klass_array);
f->do_ptr((void**)&_the_empty_instance_klass_array);
_finalizer_register_cache->serialize(f); _finalizer_register_cache->serialize(f);
_loader_addClass_cache->serialize(f); _loader_addClass_cache->serialize(f);
_pd_implies_cache->serialize(f); _pd_implies_cache->serialize(f);
@ -354,6 +357,7 @@ void Universe::genesis(TRAPS) {
_the_empty_short_array = MetadataFactory::new_array<u2>(null_cld, 0, CHECK); _the_empty_short_array = MetadataFactory::new_array<u2>(null_cld, 0, CHECK);
_the_empty_method_array = MetadataFactory::new_array<Method*>(null_cld, 0, CHECK); _the_empty_method_array = MetadataFactory::new_array<Method*>(null_cld, 0, CHECK);
_the_empty_klass_array = MetadataFactory::new_array<Klass*>(null_cld, 0, CHECK); _the_empty_klass_array = MetadataFactory::new_array<Klass*>(null_cld, 0, CHECK);
_the_empty_instance_klass_array = MetadataFactory::new_array<InstanceKlass*>(null_cld, 0, CHECK);
} }
} }

View file

@ -163,8 +163,9 @@ class Universe: AllStatic {
static Array<int>* _the_empty_int_array; // Canonicalized int array static Array<int>* _the_empty_int_array; // Canonicalized int array
static Array<u2>* _the_empty_short_array; // Canonicalized short array static Array<u2>* _the_empty_short_array; // Canonicalized short array
static Array<Klass*>* _the_empty_klass_array; // Canonicalized klass obj array static Array<Klass*>* _the_empty_klass_array; // Canonicalized klass array
static Array<Method*>* _the_empty_method_array; // Canonicalized method obj array static Array<InstanceKlass*>* _the_empty_instance_klass_array; // Canonicalized instance klass array
static Array<Method*>* _the_empty_method_array; // Canonicalized method array
static Array<Klass*>* _the_array_interfaces_array; static Array<Klass*>* _the_array_interfaces_array;
@ -361,6 +362,7 @@ class Universe: AllStatic {
static Array<u2>* the_empty_short_array() { return _the_empty_short_array; } static Array<u2>* the_empty_short_array() { return _the_empty_short_array; }
static Array<Method*>* the_empty_method_array() { return _the_empty_method_array; } static Array<Method*>* the_empty_method_array() { return _the_empty_method_array; }
static Array<Klass*>* the_empty_klass_array() { return _the_empty_klass_array; } static Array<Klass*>* the_empty_klass_array() { return _the_empty_klass_array; }
static Array<InstanceKlass*>* the_empty_instance_klass_array() { return _the_empty_instance_klass_array; }
// OutOfMemoryError support. Returns an error with the required message. The returned error // OutOfMemoryError support. Returns an error with the required message. The returned error
// may or may not have a backtrace. If error has a backtrace then the stack trace is already // may or may not have a backtrace. If error has a backtrace then the stack trace is already

View file

@ -49,7 +49,7 @@ int ArrayKlass::static_size(int header_size) {
} }
Klass* ArrayKlass::java_super() const { InstanceKlass* ArrayKlass::java_super() const {
if (super() == NULL) return NULL; // bootstrap case if (super() == NULL) return NULL; // bootstrap case
// Array klasses have primary supertypes which are not reported to Java. // Array klasses have primary supertypes which are not reported to Java.
// Example super chain: String[][] -> Object[][] -> Object[] -> Object // Example super chain: String[][] -> Object[][] -> Object[] -> Object
@ -90,7 +90,7 @@ ArrayKlass::ArrayKlass(Symbol* name, KlassID id) :
// the vtable of klass Object. // the vtable of klass Object.
set_vtable_length(Universe::base_vtable_size()); set_vtable_length(Universe::base_vtable_size());
set_name(name); set_name(name);
set_super(Universe::is_bootstrapping() ? (Klass*)NULL : SystemDictionary::Object_klass()); set_super(Universe::is_bootstrapping() ? NULL : SystemDictionary::Object_klass());
set_layout_helper(Klass::_lh_neutral_value); set_layout_helper(Klass::_lh_neutral_value);
set_is_cloneable(); // All arrays are considered to be cloneable (See JLS 20.1.5) set_is_cloneable(); // All arrays are considered to be cloneable (See JLS 20.1.5)
JFR_ONLY(INIT_ID(this);) JFR_ONLY(INIT_ID(this);)
@ -113,7 +113,7 @@ void ArrayKlass::complete_create_array_klass(ArrayKlass* k, Klass* super_klass,
} }
GrowableArray<Klass*>* ArrayKlass::compute_secondary_supers(int num_extra_slots, GrowableArray<Klass*>* ArrayKlass::compute_secondary_supers(int num_extra_slots,
Array<Klass*>* transitive_interfaces) { Array<InstanceKlass*>* transitive_interfaces) {
// interfaces = { cloneable_klass, serializable_klass }; // interfaces = { cloneable_klass, serializable_klass };
assert(num_extra_slots == 0, "sanity of primitive array type"); assert(num_extra_slots == 0, "sanity of primitive array type");
assert(transitive_interfaces == NULL, "sanity"); assert(transitive_interfaces == NULL, "sanity");

View file

@ -73,7 +73,7 @@ class ArrayKlass: public Klass {
// type of elements (T_OBJECT for both oop arrays and array-arrays) // type of elements (T_OBJECT for both oop arrays and array-arrays)
BasicType element_type() const { return layout_helper_element_type(layout_helper()); } BasicType element_type() const { return layout_helper_element_type(layout_helper()); }
virtual Klass* java_super() const;//{ return SystemDictionary::Object_klass(); } virtual InstanceKlass* java_super() const;//{ return SystemDictionary::Object_klass(); }
// Allocation // Allocation
// Sizes points to the first dimension of the array, subsequent dimensions // Sizes points to the first dimension of the array, subsequent dimensions
@ -100,7 +100,7 @@ class ArrayKlass: public Klass {
} }
GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots, GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
Array<Klass*>* transitive_interfaces); Array<InstanceKlass*>* transitive_interfaces);
bool compute_is_subtype_of(Klass* k); bool compute_is_subtype_of(Klass* k);
// Sizing // Sizing

View file

@ -493,7 +493,7 @@ Method* ConstantPoolCacheEntry::method_if_resolved(const constantPoolHandle& cpo
switch (invoke_code) { switch (invoke_code) {
case Bytecodes::_invokeinterface: case Bytecodes::_invokeinterface:
assert(f1->is_klass(), ""); assert(f1->is_klass(), "");
return klassItable::method_for_itable_index((Klass*)f1, f2_as_index()); return klassItable::method_for_itable_index((InstanceKlass*)f1, f2_as_index());
case Bytecodes::_invokestatic: case Bytecodes::_invokestatic:
case Bytecodes::_invokespecial: case Bytecodes::_invokespecial:
assert(!has_appendix(), ""); assert(!has_appendix(), "");

View file

@ -439,24 +439,24 @@ void InstanceKlass::deallocate_methods(ClassLoaderData* loader_data,
void InstanceKlass::deallocate_interfaces(ClassLoaderData* loader_data, void InstanceKlass::deallocate_interfaces(ClassLoaderData* loader_data,
const Klass* super_klass, const Klass* super_klass,
Array<Klass*>* local_interfaces, Array<InstanceKlass*>* local_interfaces,
Array<Klass*>* transitive_interfaces) { Array<InstanceKlass*>* transitive_interfaces) {
// Only deallocate transitive interfaces if not empty, same as super class // Only deallocate transitive interfaces if not empty, same as super class
// or same as local interfaces. See code in parseClassFile. // or same as local interfaces. See code in parseClassFile.
Array<Klass*>* ti = transitive_interfaces; Array<InstanceKlass*>* ti = transitive_interfaces;
if (ti != Universe::the_empty_klass_array() && ti != local_interfaces) { if (ti != Universe::the_empty_instance_klass_array() && ti != local_interfaces) {
// check that the interfaces don't come from super class // check that the interfaces don't come from super class
Array<Klass*>* sti = (super_klass == NULL) ? NULL : Array<InstanceKlass*>* sti = (super_klass == NULL) ? NULL :
InstanceKlass::cast(super_klass)->transitive_interfaces(); InstanceKlass::cast(super_klass)->transitive_interfaces();
if (ti != sti && ti != NULL && !ti->is_shared()) { if (ti != sti && ti != NULL && !ti->is_shared()) {
MetadataFactory::free_array<Klass*>(loader_data, ti); MetadataFactory::free_array<InstanceKlass*>(loader_data, ti);
} }
} }
// local interfaces can be empty // local interfaces can be empty
if (local_interfaces != Universe::the_empty_klass_array() && if (local_interfaces != Universe::the_empty_instance_klass_array() &&
local_interfaces != NULL && !local_interfaces->is_shared()) { local_interfaces != NULL && !local_interfaces->is_shared()) {
MetadataFactory::free_array<Klass*>(loader_data, local_interfaces); MetadataFactory::free_array<InstanceKlass*>(loader_data, local_interfaces);
} }
} }
@ -517,7 +517,8 @@ void InstanceKlass::deallocate_contents(ClassLoaderData* loader_data) {
// interfaces. // interfaces.
if (secondary_supers() != NULL && if (secondary_supers() != NULL &&
secondary_supers() != Universe::the_empty_klass_array() && secondary_supers() != Universe::the_empty_klass_array() &&
secondary_supers() != transitive_interfaces() && // see comments in compute_secondary_supers about the following cast
(address)(secondary_supers()) != (address)(transitive_interfaces()) &&
!secondary_supers()->is_shared()) { !secondary_supers()->is_shared()) {
MetadataFactory::free_array<Klass*>(loader_data, secondary_supers()); MetadataFactory::free_array<Klass*>(loader_data, secondary_supers());
} }
@ -755,10 +756,10 @@ bool InstanceKlass::link_class_impl(bool throw_verifyerror, TRAPS) {
} }
// link all interfaces implemented by this class before linking this class // link all interfaces implemented by this class before linking this class
Array<Klass*>* interfaces = local_interfaces(); Array<InstanceKlass*>* interfaces = local_interfaces();
int num_interfaces = interfaces->length(); int num_interfaces = interfaces->length();
for (int index = 0; index < num_interfaces; index++) { for (int index = 0; index < num_interfaces; index++) {
InstanceKlass* interk = InstanceKlass::cast(interfaces->at(index)); InstanceKlass* interk = interfaces->at(index);
interk->link_class_impl(throw_verifyerror, CHECK_false); interk->link_class_impl(throw_verifyerror, CHECK_false);
} }
@ -872,8 +873,7 @@ void InstanceKlass::link_methods(TRAPS) {
void InstanceKlass::initialize_super_interfaces(TRAPS) { void InstanceKlass::initialize_super_interfaces(TRAPS) {
assert (has_nonstatic_concrete_methods(), "caller should have checked this"); assert (has_nonstatic_concrete_methods(), "caller should have checked this");
for (int i = 0; i < local_interfaces()->length(); ++i) { for (int i = 0; i < local_interfaces()->length(); ++i) {
Klass* iface = local_interfaces()->at(i); InstanceKlass* ik = local_interfaces()->at(i);
InstanceKlass* ik = InstanceKlass::cast(iface);
// Initialization is depth first search ie. we start with top of the inheritance tree // Initialization is depth first search ie. we start with top of the inheritance tree
// has_nonstatic_concrete_methods drives searching superinterfaces since it // has_nonstatic_concrete_methods drives searching superinterfaces since it
@ -1117,18 +1117,21 @@ bool InstanceKlass::can_be_primary_super_slow() const {
} }
GrowableArray<Klass*>* InstanceKlass::compute_secondary_supers(int num_extra_slots, GrowableArray<Klass*>* InstanceKlass::compute_secondary_supers(int num_extra_slots,
Array<Klass*>* transitive_interfaces) { Array<InstanceKlass*>* transitive_interfaces) {
// The secondaries are the implemented interfaces. // The secondaries are the implemented interfaces.
Array<Klass*>* interfaces = transitive_interfaces; Array<InstanceKlass*>* interfaces = transitive_interfaces;
int num_secondaries = num_extra_slots + interfaces->length(); int num_secondaries = num_extra_slots + interfaces->length();
if (num_secondaries == 0) { if (num_secondaries == 0) {
// Must share this for correct bootstrapping! // Must share this for correct bootstrapping!
set_secondary_supers(Universe::the_empty_klass_array()); set_secondary_supers(Universe::the_empty_klass_array());
return NULL; return NULL;
} else if (num_extra_slots == 0) { } else if (num_extra_slots == 0) {
// The secondary super list is exactly the same as the transitive interfaces. // The secondary super list is exactly the same as the transitive interfaces, so
// let's use it instead of making a copy.
// Redefine classes has to be careful not to delete this! // Redefine classes has to be careful not to delete this!
set_secondary_supers(interfaces); // We need the cast because Array<Klass*> is NOT a supertype of Array<InstanceKlass*>,
// (but it's safe to do here because we won't write into _secondary_supers from this point on).
set_secondary_supers((Array<Klass*>*)(address)interfaces);
return NULL; return NULL;
} else { } else {
// Copy transitive interfaces to a temporary growable array to be constructed // Copy transitive interfaces to a temporary growable array to be constructed
@ -1791,11 +1794,11 @@ Method* InstanceKlass::lookup_method_in_ordered_interfaces(Symbol* name,
Method* InstanceKlass::lookup_method_in_all_interfaces(Symbol* name, Method* InstanceKlass::lookup_method_in_all_interfaces(Symbol* name,
Symbol* signature, Symbol* signature,
DefaultsLookupMode defaults_mode) const { DefaultsLookupMode defaults_mode) const {
Array<Klass*>* all_ifs = transitive_interfaces(); Array<InstanceKlass*>* all_ifs = transitive_interfaces();
int num_ifs = all_ifs->length(); int num_ifs = all_ifs->length();
InstanceKlass *ik = NULL; InstanceKlass *ik = NULL;
for (int i = 0; i < num_ifs; i++) { for (int i = 0; i < num_ifs; i++) {
ik = InstanceKlass::cast(all_ifs->at(i)); ik = all_ifs->at(i);
Method* m = ik->lookup_method(name, signature); Method* m = ik->lookup_method(name, signature);
if (m != NULL && m->is_public() && !m->is_static() && if (m != NULL && m->is_public() && !m->is_static() &&
((defaults_mode != skip_defaults) || !m->is_default_method())) { ((defaults_mode != skip_defaults) || !m->is_default_method())) {
@ -2142,11 +2145,11 @@ bool InstanceKlass::supers_have_passed_fingerprint_checks() {
return false; return false;
} }
Array<Klass*>* local_interfaces = this->local_interfaces(); Array<InstanceKlass*>* local_interfaces = this->local_interfaces();
if (local_interfaces != NULL) { if (local_interfaces != NULL) {
int length = local_interfaces->length(); int length = local_interfaces->length();
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
InstanceKlass* intf = InstanceKlass::cast(local_interfaces->at(i)); InstanceKlass* intf = local_interfaces->at(i);
if (!intf->has_passed_fingerprint_check()) { if (!intf->has_passed_fingerprint_check()) {
ResourceMark rm; ResourceMark rm;
log_trace(class, fingerprint)("%s : interface %s not fingerprinted", external_name(), intf->external_name()); log_trace(class, fingerprint)("%s : interface %s not fingerprinted", external_name(), intf->external_name());
@ -2353,10 +2356,10 @@ bool InstanceKlass::check_sharing_error_state() {
} }
} }
if (!bad) { if (!bad) {
Array<Klass*>* interfaces = transitive_interfaces(); Array<InstanceKlass*>* interfaces = transitive_interfaces();
for (int i = 0; i < interfaces->length(); i++) { for (int i = 0; i < interfaces->length(); i++) {
Klass* iface = interfaces->at(i); InstanceKlass* iface = interfaces->at(i);
if (InstanceKlass::cast(iface)->is_in_error_state()) { if (iface->is_in_error_state()) {
bad = true; bad = true;
break; break;
} }
@ -3254,6 +3257,12 @@ void InstanceKlass::oop_print_on(oop obj, outputStream* st) {
} }
} }
bool InstanceKlass::verify_itable_index(int i) {
int method_count = klassItable::method_count_for_interface(this);
assert(i >= 0 && i < method_count, "index out of bounds");
return true;
}
#endif //PRODUCT #endif //PRODUCT
void InstanceKlass::oop_print_value_on(oop obj, outputStream* st) { void InstanceKlass::oop_print_value_on(oop obj, outputStream* st) {
@ -3498,18 +3507,18 @@ void InstanceKlass::verify_on(outputStream* st) {
// Verify local interfaces // Verify local interfaces
if (local_interfaces()) { if (local_interfaces()) {
Array<Klass*>* local_interfaces = this->local_interfaces(); Array<InstanceKlass*>* local_interfaces = this->local_interfaces();
for (int j = 0; j < local_interfaces->length(); j++) { for (int j = 0; j < local_interfaces->length(); j++) {
Klass* e = local_interfaces->at(j); InstanceKlass* e = local_interfaces->at(j);
guarantee(e->is_klass() && e->is_interface(), "invalid local interface"); guarantee(e->is_klass() && e->is_interface(), "invalid local interface");
} }
} }
// Verify transitive interfaces // Verify transitive interfaces
if (transitive_interfaces() != NULL) { if (transitive_interfaces() != NULL) {
Array<Klass*>* transitive_interfaces = this->transitive_interfaces(); Array<InstanceKlass*>* transitive_interfaces = this->transitive_interfaces();
for (int j = 0; j < transitive_interfaces->length(); j++) { for (int j = 0; j < transitive_interfaces->length(); j++) {
Klass* e = transitive_interfaces->at(j); InstanceKlass* e = transitive_interfaces->at(j);
guarantee(e->is_klass() && e->is_interface(), "invalid transitive interface"); guarantee(e->is_klass() && e->is_interface(), "invalid transitive interface");
} }
} }

View file

@ -279,10 +279,10 @@ class InstanceKlass: public Klass {
Array<Method*>* _methods; Array<Method*>* _methods;
// Default Method Array, concrete methods inherited from interfaces // Default Method Array, concrete methods inherited from interfaces
Array<Method*>* _default_methods; Array<Method*>* _default_methods;
// Interface (Klass*s) this class declares locally to implement. // Interfaces (InstanceKlass*s) this class declares locally to implement.
Array<Klass*>* _local_interfaces; Array<InstanceKlass*>* _local_interfaces;
// Interface (Klass*s) this class implements transitively. // Interfaces (InstanceKlass*s) this class implements transitively.
Array<Klass*>* _transitive_interfaces; Array<InstanceKlass*>* _transitive_interfaces;
// Int array containing the original order of method in the class file (for JVMTI). // Int array containing the original order of method in the class file (for JVMTI).
Array<int>* _method_ordering; Array<int>* _method_ordering;
// Int array containing the vtable_indices for default_methods // Int array containing the vtable_indices for default_methods
@ -415,13 +415,13 @@ class InstanceKlass: public Klass {
Array<int>* create_new_default_vtable_indices(int len, TRAPS); Array<int>* create_new_default_vtable_indices(int len, TRAPS);
// interfaces // interfaces
Array<Klass*>* local_interfaces() const { return _local_interfaces; } Array<InstanceKlass*>* local_interfaces() const { return _local_interfaces; }
void set_local_interfaces(Array<Klass*>* a) { void set_local_interfaces(Array<InstanceKlass*>* a) {
guarantee(_local_interfaces == NULL || a == NULL, "Just checking"); guarantee(_local_interfaces == NULL || a == NULL, "Just checking");
_local_interfaces = a; } _local_interfaces = a; }
Array<Klass*>* transitive_interfaces() const { return _transitive_interfaces; } Array<InstanceKlass*>* transitive_interfaces() const { return _transitive_interfaces; }
void set_transitive_interfaces(Array<Klass*>* a) { void set_transitive_interfaces(Array<InstanceKlass*>* a) {
guarantee(_transitive_interfaces == NULL || a == NULL, "Just checking"); guarantee(_transitive_interfaces == NULL || a == NULL, "Just checking");
_transitive_interfaces = a; _transitive_interfaces = a;
} }
@ -1052,7 +1052,7 @@ public:
// virtual operations from Klass // virtual operations from Klass
bool is_leaf_class() const { return _subklass == NULL; } bool is_leaf_class() const { return _subklass == NULL; }
GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots, GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
Array<Klass*>* transitive_interfaces); Array<InstanceKlass*>* transitive_interfaces);
bool compute_is_subtype_of(Klass* k); bool compute_is_subtype_of(Klass* k);
bool can_be_primary_super_slow() const; bool can_be_primary_super_slow() const;
int oop_size(oop obj) const { return size_helper(); } int oop_size(oop obj) const { return size_helper(); }
@ -1080,7 +1080,7 @@ public:
return static_cast<const InstanceKlass*>(k); return static_cast<const InstanceKlass*>(k);
} }
InstanceKlass* java_super() const { virtual InstanceKlass* java_super() const {
return (super() == NULL) ? NULL : cast(super()); return (super() == NULL) ? NULL : cast(super());
} }
@ -1201,8 +1201,8 @@ public:
Array<Method*>* methods); Array<Method*>* methods);
void static deallocate_interfaces(ClassLoaderData* loader_data, void static deallocate_interfaces(ClassLoaderData* loader_data,
const Klass* super_klass, const Klass* super_klass,
Array<Klass*>* local_interfaces, Array<InstanceKlass*>* local_interfaces,
Array<Klass*>* transitive_interfaces); Array<InstanceKlass*>* transitive_interfaces);
// The constant pool is on stack if any of the methods are executing or // The constant pool is on stack if any of the methods are executing or
// referenced by handles. // referenced by handles.
@ -1379,6 +1379,7 @@ public:
void print_dependent_nmethods(bool verbose = false); void print_dependent_nmethods(bool verbose = false);
bool is_dependent_nmethod(nmethod* nm); bool is_dependent_nmethod(nmethod* nm);
bool verify_itable_index(int index);
#endif #endif
const char* internal_name() const; const char* internal_name() const;

View file

@ -229,7 +229,7 @@ bool Klass::can_be_primary_super_slow() const {
return true; return true;
} }
void Klass::initialize_supers(Klass* k, Array<Klass*>* transitive_interfaces, TRAPS) { void Klass::initialize_supers(Klass* k, Array<InstanceKlass*>* transitive_interfaces, TRAPS) {
if (FastSuperclassLimit == 0) { if (FastSuperclassLimit == 0) {
// None of the other machinery matters. // None of the other machinery matters.
set_super(k); set_super(k);
@ -348,7 +348,7 @@ void Klass::initialize_supers(Klass* k, Array<Klass*>* transitive_interfaces, TR
} }
GrowableArray<Klass*>* Klass::compute_secondary_supers(int num_extra_slots, GrowableArray<Klass*>* Klass::compute_secondary_supers(int num_extra_slots,
Array<Klass*>* transitive_interfaces) { Array<InstanceKlass*>* transitive_interfaces) {
assert(num_extra_slots == 0, "override for complex klasses"); assert(num_extra_slots == 0, "override for complex klasses");
assert(transitive_interfaces == NULL, "sanity"); assert(transitive_interfaces == NULL, "sanity");
set_secondary_supers(Universe::the_empty_klass_array()); set_secondary_supers(Universe::the_empty_klass_array());
@ -765,13 +765,6 @@ bool Klass::verify_vtable_index(int i) {
return true; return true;
} }
bool Klass::verify_itable_index(int i) {
assert(is_instance_klass(), "");
int method_count = klassItable::method_count_for_interface(this);
assert(i >= 0 && i < method_count, "index out of bounds");
return true;
}
#endif // PRODUCT #endif // PRODUCT
// Caller needs ResourceMark // Caller needs ResourceMark

View file

@ -202,21 +202,21 @@ protected:
bool is_klass() const volatile { return true; } bool is_klass() const volatile { return true; }
// super // super() cannot be InstanceKlass* -- Java arrays are covariant, and _super is used
// to implement that. NB: the _super of "[Ljava/lang/Integer;" is "[Ljava/lang/Number;"
// If this is not what your code expects, you're probably looking for Klass::java_super().
Klass* super() const { return _super; } Klass* super() const { return _super; }
void set_super(Klass* k) { _super = k; } void set_super(Klass* k) { _super = k; }
// initializes _super link, _primary_supers & _secondary_supers arrays // initializes _super link, _primary_supers & _secondary_supers arrays
void initialize_supers(Klass* k, Array<Klass*>* transitive_interfaces, TRAPS); void initialize_supers(Klass* k, Array<InstanceKlass*>* transitive_interfaces, TRAPS);
void initialize_supers_impl1(Klass* k);
void initialize_supers_impl2(Klass* k);
// klass-specific helper for initializing _secondary_supers // klass-specific helper for initializing _secondary_supers
virtual GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots, virtual GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
Array<Klass*>* transitive_interfaces); Array<InstanceKlass*>* transitive_interfaces);
// java_super is the Java-level super type as specified by Class.getSuperClass. // java_super is the Java-level super type as specified by Class.getSuperClass.
virtual Klass* java_super() const { return NULL; } virtual InstanceKlass* java_super() const { return NULL; }
juint super_check_offset() const { return _super_check_offset; } juint super_check_offset() const { return _super_check_offset; }
void set_super_check_offset(juint o) { _super_check_offset = o; } void set_super_check_offset(juint o) { _super_check_offset = o; }
@ -709,7 +709,6 @@ protected:
#ifndef PRODUCT #ifndef PRODUCT
bool verify_vtable_index(int index); bool verify_vtable_index(int index);
bool verify_itable_index(int index);
#endif #endif
virtual void oop_verify_on(oop obj, outputStream* st); virtual void oop_verify_on(oop obj, outputStream* st);

View file

@ -66,7 +66,7 @@ void klassVtable::compute_vtable_size_and_num_mirandas(
int* vtable_length_ret, int* num_new_mirandas, int* vtable_length_ret, int* num_new_mirandas,
GrowableArray<Method*>* all_mirandas, const Klass* super, GrowableArray<Method*>* all_mirandas, const Klass* super,
Array<Method*>* methods, AccessFlags class_flags, u2 major_version, Array<Method*>* methods, AccessFlags class_flags, u2 major_version,
Handle classloader, Symbol* classname, Array<Klass*>* local_interfaces, Handle classloader, Symbol* classname, Array<InstanceKlass*>* local_interfaces,
TRAPS) { TRAPS) {
NoSafepointVerifier nsv; NoSafepointVerifier nsv;
@ -166,7 +166,7 @@ int klassVtable::initialize_from_super(Klass* super) {
void klassVtable::initialize_vtable(bool checkconstraints, TRAPS) { void klassVtable::initialize_vtable(bool checkconstraints, TRAPS) {
// Note: Arrays can have intermediate array supers. Use java_super to skip them. // Note: Arrays can have intermediate array supers. Use java_super to skip them.
Klass* super = _klass->java_super(); InstanceKlass* super = _klass->java_super();
int nofNewEntries = 0; int nofNewEntries = 0;
bool is_shared = _klass->is_shared(); bool is_shared = _klass->is_shared();
@ -871,7 +871,7 @@ void klassVtable::get_mirandas(GrowableArray<Method*>* new_mirandas,
const Klass* super, const Klass* super,
Array<Method*>* class_methods, Array<Method*>* class_methods,
Array<Method*>* default_methods, Array<Method*>* default_methods,
Array<Klass*>* local_interfaces, Array<InstanceKlass*>* local_interfaces,
bool is_interface) { bool is_interface) {
assert((new_mirandas->length() == 0) , "current mirandas must be 0"); assert((new_mirandas->length() == 0) , "current mirandas must be 0");
@ -883,10 +883,10 @@ void klassVtable::get_mirandas(GrowableArray<Method*>* new_mirandas,
ik->methods(), class_methods, ik->methods(), class_methods,
default_methods, super, is_interface); default_methods, super, is_interface);
// iterate thru each local's super interfaces // iterate thru each local's super interfaces
Array<Klass*>* super_ifs = ik->transitive_interfaces(); Array<InstanceKlass*>* super_ifs = ik->transitive_interfaces();
int num_super_ifs = super_ifs->length(); int num_super_ifs = super_ifs->length();
for (int j = 0; j < num_super_ifs; j++) { for (int j = 0; j < num_super_ifs; j++) {
InstanceKlass *sik = InstanceKlass::cast(super_ifs->at(j)); InstanceKlass *sik = super_ifs->at(j);
add_new_mirandas_to_lists(new_mirandas, all_mirandas, add_new_mirandas_to_lists(new_mirandas, all_mirandas,
sik->methods(), class_methods, sik->methods(), class_methods,
default_methods, super, is_interface); default_methods, super, is_interface);
@ -1082,7 +1082,7 @@ void klassItable::initialize_itable(bool checkconstraints, TRAPS) {
if (_klass->is_interface()) { if (_klass->is_interface()) {
// This needs to go after vtable indices are assigned but // This needs to go after vtable indices are assigned but
// before implementors need to know the number of itable indices. // before implementors need to know the number of itable indices.
assign_itable_indices_for_interface(_klass, THREAD); assign_itable_indices_for_interface(InstanceKlass::cast(_klass), THREAD);
} }
// Cannot be setup doing bootstrapping, interfaces don't have // Cannot be setup doing bootstrapping, interfaces don't have
@ -1107,7 +1107,7 @@ void klassItable::initialize_itable(bool checkconstraints, TRAPS) {
HandleMark hm(THREAD); HandleMark hm(THREAD);
Klass* interf = ioe->interface_klass(); Klass* interf = ioe->interface_klass();
assert(interf != NULL && ioe->offset() != 0, "bad offset entry in itable"); assert(interf != NULL && ioe->offset() != 0, "bad offset entry in itable");
initialize_itable_for_interface(ioe->offset(), interf, checkconstraints, CHECK); initialize_itable_for_interface(ioe->offset(), InstanceKlass::cast(interf), checkconstraints, CHECK);
} }
} }
@ -1128,12 +1128,12 @@ inline bool interface_method_needs_itable_index(Method* m) {
return true; return true;
} }
int klassItable::assign_itable_indices_for_interface(Klass* klass, TRAPS) { int klassItable::assign_itable_indices_for_interface(InstanceKlass* klass, TRAPS) {
// an interface does not have an itable, but its methods need to be numbered // an interface does not have an itable, but its methods need to be numbered
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
log_develop_debug(itables)("%3d: Initializing itable indices for interface %s", log_develop_debug(itables)("%3d: Initializing itable indices for interface %s",
++initialize_count, klass->name()->as_C_string()); ++initialize_count, klass->name()->as_C_string());
Array<Method*>* methods = InstanceKlass::cast(klass)->methods(); Array<Method*>* methods = klass->methods();
int nof_methods = methods->length(); int nof_methods = methods->length();
int ime_num = 0; int ime_num = 0;
for (int i = 0; i < nof_methods; i++) { for (int i = 0; i < nof_methods; i++) {
@ -1170,10 +1170,9 @@ int klassItable::assign_itable_indices_for_interface(Klass* klass, TRAPS) {
return ime_num; return ime_num;
} }
int klassItable::method_count_for_interface(Klass* interf) { int klassItable::method_count_for_interface(InstanceKlass* interf) {
assert(interf->is_instance_klass(), "must be");
assert(interf->is_interface(), "must be"); assert(interf->is_interface(), "must be");
Array<Method*>* methods = InstanceKlass::cast(interf)->methods(); Array<Method*>* methods = interf->methods();
int nof_methods = methods->length(); int nof_methods = methods->length();
int length = 0; int length = 0;
while (nof_methods > 0) { while (nof_methods > 0) {
@ -1197,11 +1196,12 @@ int klassItable::method_count_for_interface(Klass* interf) {
} }
void klassItable::initialize_itable_for_interface(int method_table_offset, Klass* interf, bool checkconstraints, TRAPS) { void klassItable::initialize_itable_for_interface(int method_table_offset, InstanceKlass* interf, bool checkconstraints, TRAPS) {
Array<Method*>* methods = InstanceKlass::cast(interf)->methods(); assert(interf->is_interface(), "must be");
Array<Method*>* methods = interf->methods();
int nof_methods = methods->length(); int nof_methods = methods->length();
HandleMark hm; HandleMark hm;
Handle interface_loader (THREAD, InstanceKlass::cast(interf)->class_loader()); Handle interface_loader (THREAD, interf->class_loader());
int ime_count = method_count_for_interface(interf); int ime_count = method_count_for_interface(interf);
for (int i = 0; i < nof_methods; i++) { for (int i = 0; i < nof_methods; i++) {
@ -1349,20 +1349,20 @@ void klassItable::dump_itable() {
// Setup // Setup
class InterfaceVisiterClosure : public StackObj { class InterfaceVisiterClosure : public StackObj {
public: public:
virtual void doit(Klass* intf, int method_count) = 0; virtual void doit(InstanceKlass* intf, int method_count) = 0;
}; };
// Visit all interfaces with at least one itable method // Visit all interfaces with at least one itable method
void visit_all_interfaces(Array<Klass*>* transitive_intf, InterfaceVisiterClosure *blk) { void visit_all_interfaces(Array<InstanceKlass*>* transitive_intf, InterfaceVisiterClosure *blk) {
// Handle array argument // Handle array argument
for(int i = 0; i < transitive_intf->length(); i++) { for(int i = 0; i < transitive_intf->length(); i++) {
Klass* intf = transitive_intf->at(i); InstanceKlass* intf = transitive_intf->at(i);
assert(intf->is_interface(), "sanity check"); assert(intf->is_interface(), "sanity check");
// Find no. of itable methods // Find no. of itable methods
int method_count = 0; int method_count = 0;
// method_count = klassItable::method_count_for_interface(intf); // method_count = klassItable::method_count_for_interface(intf);
Array<Method*>* methods = InstanceKlass::cast(intf)->methods(); Array<Method*>* methods = intf->methods();
if (methods->length() > 0) { if (methods->length() > 0) {
for (int i = methods->length(); --i >= 0; ) { for (int i = methods->length(); --i >= 0; ) {
if (interface_method_needs_itable_index(methods->at(i))) { if (interface_method_needs_itable_index(methods->at(i))) {
@ -1374,7 +1374,7 @@ void visit_all_interfaces(Array<Klass*>* transitive_intf, InterfaceVisiterClosur
// Visit all interfaces which either have any methods or can participate in receiver type check. // Visit all interfaces which either have any methods or can participate in receiver type check.
// We do not bother to count methods in transitive interfaces, although that would allow us to skip // We do not bother to count methods in transitive interfaces, although that would allow us to skip
// this step in the rare case of a zero-method interface extending another zero-method interface. // this step in the rare case of a zero-method interface extending another zero-method interface.
if (method_count > 0 || InstanceKlass::cast(intf)->transitive_interfaces()->length() > 0) { if (method_count > 0 || intf->transitive_interfaces()->length() > 0) {
blk->doit(intf, method_count); blk->doit(intf, method_count);
} }
} }
@ -1390,7 +1390,7 @@ class CountInterfacesClosure : public InterfaceVisiterClosure {
int nof_methods() const { return _nof_methods; } int nof_methods() const { return _nof_methods; }
int nof_interfaces() const { return _nof_interfaces; } int nof_interfaces() const { return _nof_interfaces; }
void doit(Klass* intf, int method_count) { _nof_methods += method_count; _nof_interfaces++; } void doit(InstanceKlass* intf, int method_count) { _nof_methods += method_count; _nof_interfaces++; }
}; };
class SetupItableClosure : public InterfaceVisiterClosure { class SetupItableClosure : public InterfaceVisiterClosure {
@ -1407,7 +1407,7 @@ class SetupItableClosure : public InterfaceVisiterClosure {
itableMethodEntry* method_entry() const { return _method_entry; } itableMethodEntry* method_entry() const { return _method_entry; }
void doit(Klass* intf, int method_count) { void doit(InstanceKlass* intf, int method_count) {
int offset = ((address)_method_entry) - _klass_begin; int offset = ((address)_method_entry) - _klass_begin;
_offset_entry->initialize(intf, offset); _offset_entry->initialize(intf, offset);
_offset_entry++; _offset_entry++;
@ -1415,7 +1415,7 @@ class SetupItableClosure : public InterfaceVisiterClosure {
} }
}; };
int klassItable::compute_itable_size(Array<Klass*>* transitive_interfaces) { int klassItable::compute_itable_size(Array<InstanceKlass*>* transitive_interfaces) {
// Count no of interfaces and total number of interface methods // Count no of interfaces and total number of interface methods
CountInterfacesClosure cic; CountInterfacesClosure cic;
visit_all_interfaces(transitive_interfaces, &cic); visit_all_interfaces(transitive_interfaces, &cic);
@ -1468,8 +1468,8 @@ void klassItable::setup_itable_offset_table(InstanceKlass* klass) {
// inverse to itable_index // inverse to itable_index
Method* klassItable::method_for_itable_index(Klass* intf, int itable_index) { Method* klassItable::method_for_itable_index(InstanceKlass* intf, int itable_index) {
assert(InstanceKlass::cast(intf)->is_interface(), "sanity check"); assert(intf->is_interface(), "sanity check");
assert(intf->verify_itable_index(itable_index), ""); assert(intf->verify_itable_index(itable_index), "");
Array<Method*>* methods = InstanceKlass::cast(intf)->methods(); Array<Method*>* methods = InstanceKlass::cast(intf)->methods();

View file

@ -92,7 +92,7 @@ class klassVtable {
u2 major_version, u2 major_version,
Handle classloader, Handle classloader,
Symbol* classname, Symbol* classname,
Array<Klass*>* local_interfaces, Array<InstanceKlass*>* local_interfaces,
TRAPS); TRAPS);
#if INCLUDE_JVMTI #if INCLUDE_JVMTI
@ -159,7 +159,7 @@ class klassVtable {
const Klass* super, const Klass* super,
Array<Method*>* class_methods, Array<Method*>* class_methods,
Array<Method*>* default_methods, Array<Method*>* default_methods,
Array<Klass*>* local_interfaces, Array<InstanceKlass*>* local_interfaces,
bool is_interface); bool is_interface);
void verify_against(outputStream* st, klassVtable* vt, int index); void verify_against(outputStream* st, klassVtable* vt, int index);
inline InstanceKlass* ik() const; inline InstanceKlass* ik() const;
@ -235,17 +235,17 @@ class itableMethodEntry;
class itableOffsetEntry { class itableOffsetEntry {
private: private:
Klass* _interface; InstanceKlass* _interface;
int _offset; int _offset;
public: public:
Klass* interface_klass() const { return _interface; } InstanceKlass* interface_klass() const { return _interface; }
Klass**interface_klass_addr() { return &_interface; } InstanceKlass**interface_klass_addr() { return &_interface; }
int offset() const { return _offset; } int offset() const { return _offset; }
static itableMethodEntry* method_entry(Klass* k, int offset) { return (itableMethodEntry*)(((address)k) + offset); } static itableMethodEntry* method_entry(Klass* k, int offset) { return (itableMethodEntry*)(((address)k) + offset); }
itableMethodEntry* first_method_entry(Klass* k) { return method_entry(k, _offset); } itableMethodEntry* first_method_entry(Klass* k) { return method_entry(k, _offset); }
void initialize(Klass* interf, int offset) { _interface = interf; _offset = offset; } void initialize(InstanceKlass* interf, int offset) { _interface = interf; _offset = offset; }
// Static size and offset accessors // Static size and offset accessors
static int size() { return sizeof(itableOffsetEntry) / wordSize; } // size in words static int size() { return sizeof(itableOffsetEntry) / wordSize; } // size in words
@ -300,7 +300,7 @@ class klassItable {
int _size_offset_table; // size of offset table (in itableOffset entries) int _size_offset_table; // size of offset table (in itableOffset entries)
int _size_method_table; // size of methodtable (in itableMethodEntry entries) int _size_method_table; // size of methodtable (in itableMethodEntry entries)
void initialize_itable_for_interface(int method_table_offset, Klass* interf_h, bool checkconstraints, TRAPS); void initialize_itable_for_interface(int method_table_offset, InstanceKlass* interf_h, bool checkconstraints, TRAPS);
public: public:
klassItable(InstanceKlass* klass); klassItable(InstanceKlass* klass);
@ -328,13 +328,13 @@ class klassItable {
#endif // INCLUDE_JVMTI #endif // INCLUDE_JVMTI
// Setup of itable // Setup of itable
static int assign_itable_indices_for_interface(Klass* klass, TRAPS); static int assign_itable_indices_for_interface(InstanceKlass* klass, TRAPS);
static int method_count_for_interface(Klass* klass); static int method_count_for_interface(InstanceKlass* klass);
static int compute_itable_size(Array<Klass*>* transitive_interfaces); static int compute_itable_size(Array<InstanceKlass*>* transitive_interfaces);
static void setup_itable_offset_table(InstanceKlass* klass); static void setup_itable_offset_table(InstanceKlass* klass);
// Resolving of method to index // Resolving of method to index
static Method* method_for_itable_index(Klass* klass, int itable_index); static Method* method_for_itable_index(InstanceKlass* klass, int itable_index);
// Debugging/Statistics // Debugging/Statistics
static void print_statistics() PRODUCT_RETURN; static void print_statistics() PRODUCT_RETURN;

View file

@ -67,7 +67,7 @@ Klass* ObjArrayKlass::allocate_objArray_klass(ClassLoaderData* loader_data,
bool supers_exist = super_klass != NULL; bool supers_exist = super_klass != NULL;
// Also, see if the element has secondary supertypes. // Also, see if the element has secondary supertypes.
// We need an array type for each. // We need an array type for each.
Array<Klass*>* element_supers = element_klass->secondary_supers(); const Array<Klass*>* element_supers = element_klass->secondary_supers();
for( int i = element_supers->length()-1; i >= 0; i-- ) { for( int i = element_supers->length()-1; i >= 0; i-- ) {
Klass* elem_super = element_supers->at(i); Klass* elem_super = element_supers->at(i);
if (elem_super->array_klass_or_null() == NULL) { if (elem_super->array_klass_or_null() == NULL) {
@ -382,10 +382,10 @@ bool ObjArrayKlass::can_be_primary_super_slow() const {
} }
GrowableArray<Klass*>* ObjArrayKlass::compute_secondary_supers(int num_extra_slots, GrowableArray<Klass*>* ObjArrayKlass::compute_secondary_supers(int num_extra_slots,
Array<Klass*>* transitive_interfaces) { Array<InstanceKlass*>* transitive_interfaces) {
assert(transitive_interfaces == NULL, "sanity"); assert(transitive_interfaces == NULL, "sanity");
// interfaces = { cloneable_klass, serializable_klass, elemSuper[], ... }; // interfaces = { cloneable_klass, serializable_klass, elemSuper[], ... };
Array<Klass*>* elem_supers = element_klass()->secondary_supers(); const Array<Klass*>* elem_supers = element_klass()->secondary_supers();
int num_elem_supers = elem_supers == NULL ? 0 : elem_supers->length(); int num_elem_supers = elem_supers == NULL ? 0 : elem_supers->length();
int num_secondaries = num_extra_slots + 2 + num_elem_supers; int num_secondaries = num_extra_slots + 2 + num_elem_supers;
if (num_secondaries == 2) { if (num_secondaries == 2) {
@ -397,7 +397,7 @@ GrowableArray<Klass*>* ObjArrayKlass::compute_secondary_supers(int num_extra_slo
secondaries->push(SystemDictionary::Cloneable_klass()); secondaries->push(SystemDictionary::Cloneable_klass());
secondaries->push(SystemDictionary::Serializable_klass()); secondaries->push(SystemDictionary::Serializable_klass());
for (int i = 0; i < num_elem_supers; i++) { for (int i = 0; i < num_elem_supers; i++) {
Klass* elem_super = (Klass*) elem_supers->at(i); Klass* elem_super = elem_supers->at(i);
Klass* array_super = elem_super->array_klass_or_null(); Klass* array_super = elem_super->array_klass_or_null();
assert(array_super != NULL, "must already have been created"); assert(array_super != NULL, "must already have been created");
secondaries->push(array_super); secondaries->push(array_super);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -69,7 +69,7 @@ class ObjArrayKlass : public ArrayKlass {
// Dispatched operation // Dispatched operation
bool can_be_primary_super_slow() const; bool can_be_primary_super_slow() const;
GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots, GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
Array<Klass*>* transitive_interfaces); Array<InstanceKlass*>* transitive_interfaces);
bool compute_is_subtype_of(Klass* k); bool compute_is_subtype_of(Klass* k);
DEBUG_ONLY(bool is_objArray_klass_slow() const { return true; }) DEBUG_ONLY(bool is_objArray_klass_slow() const { return true; })
int oop_size(oop obj) const; int oop_size(oop obj) const;

View file

@ -808,12 +808,12 @@ void JvmtiClassFileReconstituter::write_class_file_format() {
// JVMSpec| u2 interfaces_count; // JVMSpec| u2 interfaces_count;
// JVMSpec| u2 interfaces[interfaces_count]; // JVMSpec| u2 interfaces[interfaces_count];
Array<Klass*>* interfaces = ik()->local_interfaces(); Array<InstanceKlass*>* interfaces = ik()->local_interfaces();
int num_interfaces = interfaces->length(); int num_interfaces = interfaces->length();
write_u2(num_interfaces); write_u2(num_interfaces);
for (int index = 0; index < num_interfaces; index++) { for (int index = 0; index < num_interfaces; index++) {
HandleMark hm(thread()); HandleMark hm(thread());
InstanceKlass* iik = InstanceKlass::cast(interfaces->at(index)); InstanceKlass* iik = interfaces->at(index);
write_u2(class_symbol_to_cpool_index(iik->name())); write_u2(class_symbol_to_cpool_index(iik->name()));
} }

View file

@ -2630,11 +2630,11 @@ JvmtiEnv::GetImplementedInterfaces(oop k_mirror, jint* interface_count_ptr, jcla
return JVMTI_ERROR_NONE; return JVMTI_ERROR_NONE;
} }
Array<Klass*>* interface_list = InstanceKlass::cast(k)->local_interfaces(); Array<InstanceKlass*>* interface_list = InstanceKlass::cast(k)->local_interfaces();
const int result_length = (interface_list == NULL ? 0 : interface_list->length()); const int result_length = (interface_list == NULL ? 0 : interface_list->length());
jclass* result_list = (jclass*) jvmtiMalloc(result_length * sizeof(jclass)); jclass* result_list = (jclass*) jvmtiMalloc(result_length * sizeof(jclass));
for (int i_index = 0; i_index < result_length; i_index += 1) { for (int i_index = 0; i_index < result_length; i_index += 1) {
Klass* klass_at = interface_list->at(i_index); InstanceKlass* klass_at = interface_list->at(i_index);
assert(klass_at->is_klass(), "interfaces must be Klass*s"); assert(klass_at->is_klass(), "interfaces must be Klass*s");
assert(klass_at->is_interface(), "interfaces must be interfaces"); assert(klass_at->is_interface(), "interfaces must be interfaces");
oop mirror_at = klass_at->java_mirror(); oop mirror_at = klass_at->java_mirror();

View file

@ -621,7 +621,7 @@ bool VM_GetOrSetLocal::is_assignable(const char* ty_sign, Klass* klass, Thread*
} }
} }
// Compare secondary supers // Compare secondary supers
Array<Klass*>* sec_supers = klass->secondary_supers(); const Array<Klass*>* sec_supers = klass->secondary_supers();
for (idx = 0; idx < sec_supers->length(); idx++) { for (idx = 0; idx < sec_supers->length(); idx++) {
if (((Klass*) sec_supers->at(idx))->name() == ty_sym) { if (((Klass*) sec_supers->at(idx))->name() == ty_sym) {
return true; return true;

View file

@ -795,8 +795,8 @@ jvmtiError VM_RedefineClasses::compare_and_normalize_class_versions(
// technically a bit more difficult, and, more importantly, I am not sure at present that the // technically a bit more difficult, and, more importantly, I am not sure at present that the
// order of interfaces does not matter on the implementation level, i.e. that the VM does not // order of interfaces does not matter on the implementation level, i.e. that the VM does not
// rely on it somewhere. // rely on it somewhere.
Array<Klass*>* k_interfaces = the_class->local_interfaces(); Array<InstanceKlass*>* k_interfaces = the_class->local_interfaces();
Array<Klass*>* k_new_interfaces = scratch_class->local_interfaces(); Array<InstanceKlass*>* k_new_interfaces = scratch_class->local_interfaces();
int n_intfs = k_interfaces->length(); int n_intfs = k_interfaces->length();
if (n_intfs != k_new_interfaces->length()) { if (n_intfs != k_new_interfaces->length()) {
return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED; return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED;

View file

@ -2838,7 +2838,7 @@ inline bool VM_HeapWalkOperation::iterate_over_class(oop java_class) {
oop mirror = klass->java_mirror(); oop mirror = klass->java_mirror();
// super (only if something more interesting than java.lang.Object) // super (only if something more interesting than java.lang.Object)
Klass* java_super = ik->java_super(); InstanceKlass* java_super = ik->java_super();
if (java_super != NULL && java_super != SystemDictionary::Object_klass()) { if (java_super != NULL && java_super != SystemDictionary::Object_klass()) {
oop super = java_super->java_mirror(); oop super = java_super->java_mirror();
if (!CallbackInvoker::report_superclass_reference(mirror, super)) { if (!CallbackInvoker::report_superclass_reference(mirror, super)) {
@ -2894,9 +2894,9 @@ inline bool VM_HeapWalkOperation::iterate_over_class(oop java_class) {
// interfaces // interfaces
// (These will already have been reported as references from the constant pool // (These will already have been reported as references from the constant pool
// but are specified by IterateOverReachableObjects and must be reported). // but are specified by IterateOverReachableObjects and must be reported).
Array<Klass*>* interfaces = ik->local_interfaces(); Array<InstanceKlass*>* interfaces = ik->local_interfaces();
for (i = 0; i < interfaces->length(); i++) { for (i = 0; i < interfaces->length(); i++) {
oop interf = ((Klass*)interfaces->at(i))->java_mirror(); oop interf = interfaces->at(i)->java_mirror();
if (interf == NULL) { if (interf == NULL) {
continue; continue;
} }

View file

@ -219,7 +219,7 @@ oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info) {
assert(info.resolved_appendix().is_null(), "only normal methods here"); assert(info.resolved_appendix().is_null(), "only normal methods here");
methodHandle m = info.resolved_method(); methodHandle m = info.resolved_method();
assert(m.not_null(), "null method handle"); assert(m.not_null(), "null method handle");
Klass* m_klass = m->method_holder(); InstanceKlass* m_klass = m->method_holder();
assert(m_klass != NULL, "null holder for method handle"); assert(m_klass != NULL, "null holder for method handle");
int flags = (jushort)( m->access_flags().as_short() & JVM_RECOGNIZED_METHOD_MODIFIERS ); int flags = (jushort)( m->access_flags().as_short() & JVM_RECOGNIZED_METHOD_MODIFIERS );
int vmindex = Method::invalid_vtable_index; int vmindex = Method::invalid_vtable_index;
@ -257,7 +257,8 @@ oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info) {
// This is a vtable call to an interface method (abstract "miranda method" or default method). // This is a vtable call to an interface method (abstract "miranda method" or default method).
// The vtable index is meaningless without a class (not interface) receiver type, so get one. // The vtable index is meaningless without a class (not interface) receiver type, so get one.
// (LinkResolver should help us figure this out.) // (LinkResolver should help us figure this out.)
Klass* m_klass_non_interface = info.resolved_klass(); assert(info.resolved_klass()->is_instance_klass(), "subtype of interface must be an instance klass");
InstanceKlass* m_klass_non_interface = InstanceKlass::cast(info.resolved_klass());
if (m_klass_non_interface->is_interface()) { if (m_klass_non_interface->is_interface()) {
m_klass_non_interface = SystemDictionary::Object_klass(); m_klass_non_interface = SystemDictionary::Object_klass();
#ifdef ASSERT #ifdef ASSERT

View file

@ -33,7 +33,7 @@ KlassStream::KlassStream(InstanceKlass* klass, bool local_only,
_base_class_search_defaults = false; _base_class_search_defaults = false;
_defaults_checked = false; _defaults_checked = false;
if (classes_only) { if (classes_only) {
_interfaces = Universe::the_empty_klass_array(); _interfaces = Universe::the_empty_instance_klass_array();
} else { } else {
_interfaces = klass->transitive_interfaces(); _interfaces = klass->transitive_interfaces();
} }
@ -48,7 +48,7 @@ bool KlassStream::eos() {
if (_local_only) return true; if (_local_only) return true;
if (!_klass->is_interface() && _klass->super() != NULL) { if (!_klass->is_interface() && _klass->super() != NULL) {
// go up superclass chain (not for interfaces) // go up superclass chain (not for interfaces)
_klass = InstanceKlass::cast(_klass->super()); _klass = _klass->java_super();
// Next for method walks, walk default methods // Next for method walks, walk default methods
} else if (_walk_defaults && (_defaults_checked == false) && (_base_klass->default_methods() != NULL)) { } else if (_walk_defaults && (_defaults_checked == false) && (_base_klass->default_methods() != NULL)) {
_base_class_search_defaults = true; _base_class_search_defaults = true;
@ -57,7 +57,7 @@ bool KlassStream::eos() {
} else { } else {
// Next walk transitive interfaces // Next walk transitive interfaces
if (_interface_index > 0) { if (_interface_index > 0) {
_klass = InstanceKlass::cast(_interfaces->at(--_interface_index)); _klass = _interfaces->at(--_interface_index);
} else { } else {
return true; return true;
} }

View file

@ -48,7 +48,7 @@ class KlassStream {
protected: protected:
InstanceKlass* _klass; // current klass/interface iterated over InstanceKlass* _klass; // current klass/interface iterated over
InstanceKlass* _base_klass; // initial klass/interface to iterate over InstanceKlass* _base_klass; // initial klass/interface to iterate over
Array<Klass*>* _interfaces; // transitive interfaces for initial class Array<InstanceKlass*>*_interfaces; // transitive interfaces for initial class
int _interface_index; // current interface being processed int _interface_index; // current interface being processed
bool _local_only; // process initial class/interface only bool _local_only; // process initial class/interface only
bool _classes_only; // process classes only (no interfaces) bool _classes_only; // process classes only (no interfaces)

View file

@ -225,8 +225,8 @@ typedef PaddedEnd<ObjectMonitor> PaddedObjectMonitor;
volatile_nonstatic_field(InstanceKlass, _array_klasses, Klass*) \ volatile_nonstatic_field(InstanceKlass, _array_klasses, Klass*) \
nonstatic_field(InstanceKlass, _methods, Array<Method*>*) \ nonstatic_field(InstanceKlass, _methods, Array<Method*>*) \
nonstatic_field(InstanceKlass, _default_methods, Array<Method*>*) \ nonstatic_field(InstanceKlass, _default_methods, Array<Method*>*) \
nonstatic_field(InstanceKlass, _local_interfaces, Array<Klass*>*) \ nonstatic_field(InstanceKlass, _local_interfaces, Array<InstanceKlass*>*) \
nonstatic_field(InstanceKlass, _transitive_interfaces, Array<Klass*>*) \ nonstatic_field(InstanceKlass, _transitive_interfaces, Array<InstanceKlass*>*) \
nonstatic_field(InstanceKlass, _fields, Array<u2>*) \ nonstatic_field(InstanceKlass, _fields, Array<u2>*) \
nonstatic_field(InstanceKlass, _java_fields_count, u2) \ nonstatic_field(InstanceKlass, _java_fields_count, u2) \
nonstatic_field(InstanceKlass, _constants, ConstantPool*) \ nonstatic_field(InstanceKlass, _constants, ConstantPool*) \

View file

@ -989,7 +989,7 @@ void DumperSupport::dump_class_and_array_classes(DumpWriter* writer, Klass* k) {
writer->write_u4(STACK_TRACE_ID); writer->write_u4(STACK_TRACE_ID);
// super class ID // super class ID
Klass* java_super = ik->java_super(); InstanceKlass* java_super = ik->java_super();
if (java_super == NULL) { if (java_super == NULL) {
writer->write_objectID(oop(NULL)); writer->write_objectID(oop(NULL));
} else { } else {
@ -1059,7 +1059,7 @@ void DumperSupport::dump_basic_type_array_class(DumpWriter* writer, Klass* k) {
writer->write_u4(STACK_TRACE_ID); writer->write_u4(STACK_TRACE_ID);
// super class of array classes is java.lang.Object // super class of array classes is java.lang.Object
Klass* java_super = klass->java_super(); InstanceKlass* java_super = klass->java_super();
assert(java_super != NULL, "checking"); assert(java_super != NULL, "checking");
writer->write_classID(java_super); writer->write_classID(java_super);