8213250: CDS archive creation aborts due to metaspace object allocation failure

Reviewed-by: jiangli, ccheung
This commit is contained in:
Ioi Lam 2018-11-01 10:59:05 -07:00
parent 836e02e1f1
commit b84cf61b08
4 changed files with 27 additions and 36 deletions

View file

@ -27,6 +27,7 @@
#include "classfile/classListParser.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/classLoaderData.inline.hpp"
#include "classfile/classLoaderDataGraph.hpp"
#include "classfile/classLoaderExt.hpp"
#include "classfile/dictionary.hpp"
#include "classfile/javaClasses.hpp"
@ -782,8 +783,16 @@ bool SystemDictionaryShared::add_verification_constraint(InstanceKlass* k, Symbo
}
}
void SystemDictionaryShared::finalize_verification_constraints_for(InstanceKlass* k) {
if (!k->is_unsafe_anonymous()) {
SharedDictionaryEntry* entry = ((SharedDictionary*)(k->class_loader_data()->dictionary()))->find_entry_for(k);
entry->finalize_verification_constraints();
}
}
void SystemDictionaryShared::finalize_verification_constraints() {
boot_loader_dictionary()->finalize_verification_constraints();
MutexLocker mcld(ClassLoaderDataGraph_lock);
ClassLoaderDataGraph::dictionary_classes_do(finalize_verification_constraints_for);
}
void SystemDictionaryShared::check_verification_constraints(InstanceKlass* klass,
@ -810,28 +819,6 @@ SharedDictionaryEntry* SharedDictionary::find_entry_for(InstanceKlass* klass) {
return NULL;
}
void SharedDictionary::finalize_verification_constraints() {
int bytes = 0, count = 0;
for (int index = 0; index < table_size(); index++) {
for (SharedDictionaryEntry *probe = bucket(index);
probe != NULL;
probe = probe->next()) {
int n = probe->finalize_verification_constraints();
if (n > 0) {
bytes += n;
count ++;
}
}
}
if (log_is_enabled(Info, cds, verification)) {
double avg = 0;
if (count > 0) {
avg = double(bytes) / double(count);
}
log_info(cds, verification)("Recorded verification constraints for %d classes = %d bytes (avg = %.2f bytes) ", count, bytes, avg);
}
}
void SharedDictionaryEntry::add_verification_constraint(Symbol* name,
Symbol* from_name, bool from_field_is_protected, bool from_is_array, bool from_is_object) {
if (_verifier_constraints == NULL) {