--- a/src/hotspot/share/oops/constantPool.cpp Thu Oct 17 20:27:44 2019 +0100
+++ b/src/hotspot/share/oops/constantPool.cpp Thu Oct 17 20:53:35 2019 +0100
@@ -556,7 +556,8 @@
Handle h_loader (thread, loader);
Klass* k = SystemDictionary::find(name, h_loader, h_prot, thread);
- if (k != NULL) {
+ // Avoid constant pool verification at a safepoint, which takes the Module_lock.
+ if (k != NULL && !SafepointSynchronize::is_at_safepoint()) {
// Make sure that resolving is legal
EXCEPTION_MARK;
// return NULL if verification fails
@@ -760,6 +761,10 @@
// return the method type signature in the error message
message = this_cp->method_type_signature_at(which);
break;
+ case JVM_CONSTANT_Dynamic:
+ // return the name of the condy in the error message
+ message = this_cp->uncached_name_ref_at(which);
+ break;
default:
ShouldNotReachHere();
}
@@ -862,7 +867,7 @@
if (cache_index >= 0) {
result_oop = this_cp->resolved_references()->obj_at(cache_index);
if (result_oop != NULL) {
- if (oopDesc::equals(result_oop, Universe::the_null_sentinel())) {
+ if (result_oop == Universe::the_null_sentinel()) {
DEBUG_ONLY(int temp_index = (index >= 0 ? index : this_cp->object_to_cp_index(cache_index)));
assert(this_cp->tag_at(temp_index).is_dynamic_constant(), "only condy uses the null sentinel");
result_oop = NULL;
@@ -1092,12 +1097,12 @@
} else {
// Return the winning thread's result. This can be different than
// the result here for MethodHandles.
- if (oopDesc::equals(old_result, Universe::the_null_sentinel()))
+ if (old_result == Universe::the_null_sentinel())
old_result = NULL;
return old_result;
}
} else {
- assert(!oopDesc::equals(result_oop, Universe::the_null_sentinel()), "");
+ assert(result_oop != Universe::the_null_sentinel(), "");
return result_oop;
}
}
@@ -1150,7 +1155,7 @@
oop ConstantPool::string_at_impl(const constantPoolHandle& this_cp, int which, int obj_index, TRAPS) {
// If the string has already been interned, this entry will be non-null
oop str = this_cp->resolved_references()->obj_at(obj_index);
- assert(!oopDesc::equals(str, Universe::the_null_sentinel()), "");
+ assert(str != Universe::the_null_sentinel(), "");
if (str != NULL) return str;
Symbol* sym = this_cp->unresolved_string_at(which);
str = StringTable::intern(sym, CHECK_(NULL));