8186789: CDS dump crashes at ConstantPool::resolve_class_constants
ConstantPool::resolve_class_constants needs to check for NULL _cache. Reviewed-by: sspitsyn, coleenp, iklam
This commit is contained in:
parent
92ad2630a1
commit
ba16fabd20
@ -294,6 +294,28 @@ void ConstantPool::archive_resolved_references(Thread* THREAD) {
|
||||
set_resolved_references(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void ConstantPool::resolve_class_constants(TRAPS) {
|
||||
assert(DumpSharedSpaces, "used during dump time only");
|
||||
// The _cache may be NULL if the _pool_holder klass fails verification
|
||||
// at dump time due to missing dependencies.
|
||||
if (cache() == NULL || reference_map() == NULL) {
|
||||
return; // nothing to do
|
||||
}
|
||||
|
||||
constantPoolHandle cp(THREAD, this);
|
||||
for (int index = 1; index < length(); index++) { // Index 0 is unused
|
||||
if (tag_at(index).is_string()) {
|
||||
Symbol* sym = cp->unresolved_string_at(index);
|
||||
// Look up only. Only resolve references to already interned strings.
|
||||
oop str = StringTable::lookup(sym);
|
||||
if (str != NULL) {
|
||||
int cache_index = cp->cp_to_object_index(index);
|
||||
cp->string_at_put(index, cache_index, str);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// CDS support. Create a new resolved_references array.
|
||||
@ -722,22 +744,6 @@ void ConstantPool::resolve_string_constants_impl(const constantPoolHandle& this_
|
||||
}
|
||||
}
|
||||
|
||||
bool ConstantPool::resolve_class_constants(TRAPS) {
|
||||
constantPoolHandle cp(THREAD, this);
|
||||
for (int index = 1; index < length(); index++) { // Index 0 is unused
|
||||
if (tag_at(index).is_string()) {
|
||||
Symbol* sym = cp->unresolved_string_at(index);
|
||||
// Look up only. Only resolve references to already interned strings.
|
||||
oop str = StringTable::lookup(sym);
|
||||
if (str != NULL) {
|
||||
int cache_index = cp->cp_to_object_index(index);
|
||||
cp->string_at_put(index, cache_index, str);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Symbol* ConstantPool::exception_message(const constantPoolHandle& this_cp, int which, constantTag tag, oop pending_exception) {
|
||||
// Dig out the detailed message to reuse if possible
|
||||
Symbol* message = java_lang_Throwable::detail_message(pending_exception);
|
||||
|
@ -717,9 +717,9 @@ class ConstantPool : public Metadata {
|
||||
|
||||
// CDS support
|
||||
void archive_resolved_references(Thread *THREAD) NOT_CDS_JAVA_HEAP_RETURN;
|
||||
void resolve_class_constants(TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
|
||||
void remove_unshareable_info();
|
||||
void restore_unshareable_info(TRAPS);
|
||||
bool resolve_class_constants(TRAPS);
|
||||
// The ConstantPool vtable is restored by this call when the ConstantPool is
|
||||
// in the shared archive. See patch_klass_vtables() in metaspaceShared.cpp for
|
||||
// all the gory details. SA, dtrace and pstack helpers distinguish metadata
|
||||
|
Loading…
Reference in New Issue
Block a user