Skip to content
Permalink
Browse files

8232071: Avoid shared dictionary lookup when the class name is not sh…

…ared

Reviewed-by: jiangli, ccheung
  • Loading branch information
iklam committed Oct 10, 2019
1 parent dc66194 commit 5a120f0967fe7740edcb175e1da51270db281858
@@ -905,14 +905,9 @@ InstanceKlass* SystemDictionaryShared::lookup_from_stream(Symbol* class_name,
return NULL;
}

const RunTimeSharedClassInfo* record = find_record(&_unregistered_dictionary, class_name);
const RunTimeSharedClassInfo* record = find_record(&_unregistered_dictionary, &_dynamic_unregistered_dictionary, class_name);
if (record == NULL) {
if (DynamicArchive::is_mapped()) {
record = find_record(&_dynamic_unregistered_dictionary, class_name);
}
if (record == NULL) {
return NULL;
}
return NULL;
}

int clsfile_size = cfs->length();
@@ -1412,29 +1407,34 @@ void SystemDictionaryShared::serialize_dictionary_headers(SerializeClosure* soc,
}

const RunTimeSharedClassInfo*
SystemDictionaryShared::find_record(RunTimeSharedDictionary* dict, Symbol* name) {
if (UseSharedSpaces) {
unsigned int hash = primitive_hash<Symbol*>(name);
return dict->lookup(name, hash, 0);
} else {
SystemDictionaryShared::find_record(RunTimeSharedDictionary* static_dict, RunTimeSharedDictionary* dynamic_dict, Symbol* name) {
if (!UseSharedSpaces || !name->is_shared()) {
// The names of all shared classes must also be a shared Symbol.
return NULL;
}
}

InstanceKlass* SystemDictionaryShared::find_builtin_class(Symbol* name) {
const RunTimeSharedClassInfo* record = find_record(&_builtin_dictionary, name);
if (record) {
return record->_klass;
unsigned int hash = primitive_hash<Symbol*>(name);
const RunTimeSharedClassInfo* record = NULL;
if (!MetaspaceShared::is_shared_dynamic(name)) {
// The names of all shared classes in the static dict must also be in the
// static archive
record = static_dict->lookup(name, hash, 0);
}

if (DynamicArchive::is_mapped()) {
record = find_record(&_dynamic_builtin_dictionary, name);
if (record) {
return record->_klass;
}
if (record == NULL && DynamicArchive::is_mapped()) {
record = dynamic_dict->lookup(name, hash, 0);
}

return NULL;
return record;
}

InstanceKlass* SystemDictionaryShared::find_builtin_class(Symbol* name) {
const RunTimeSharedClassInfo* record = find_record(&_builtin_dictionary, &_dynamic_builtin_dictionary, name);
if (record != NULL) {
return record->_klass;
} else {
return NULL;
}
}

void SystemDictionaryShared::update_shared_entry(InstanceKlass* k, int id) {
@@ -223,7 +223,9 @@ class SystemDictionaryShared: public SystemDictionary {
public:
static InstanceKlass* find_builtin_class(Symbol* class_name);

static const RunTimeSharedClassInfo* find_record(RunTimeSharedDictionary* dict, Symbol* name);
static const RunTimeSharedClassInfo* find_record(RunTimeSharedDictionary* static_dict,
RunTimeSharedDictionary* dynamic_dict,
Symbol* name);

static bool has_platform_or_app_classes();

0 comments on commit 5a120f0

Please sign in to comment.