8209361: [AOT] Unexpected number of references for JVMTI_HEAP_REFERENCE_CONSTANT_POOL [111-->111]: 0 (expected at least 1)

Reviewed-by: coleenp, dholmes
This commit is contained in:
Dean Long 2018-09-06 17:45:15 -07:00
parent 334d64e9a0
commit 25280e30d4

@ -2875,14 +2875,26 @@ inline bool VM_HeapWalkOperation::iterate_over_class(oop java_class) {
ConstantPool* pool = ik->constants();
for (int i = 1; i < pool->length(); i++) {
constantTag tag = pool->tag_at(i).value();
if (tag.is_string() || tag.is_klass()) {
if (tag.is_string() || tag.is_klass() || tag.is_unresolved_klass()) {
oop entry;
if (tag.is_string()) {
entry = pool->resolved_string_at(i);
// If the entry is non-null it is resolved.
if (entry == NULL) continue;
} else {
if (entry == NULL) {
continue;
}
} else if (tag.is_klass()) {
entry = pool->resolved_klass_at(i)->java_mirror();
} else {
// Code generated by JIT and AOT compilers might not resolve constant
// pool entries. Treat them as resolved if they are loaded.
assert(tag.is_unresolved_klass(), "must be");
constantPoolHandle cp(Thread::current(), pool);
Klass* klass = ConstantPool::klass_at_if_loaded(cp, i);
if (klass == NULL) {
continue;
}
entry = klass->java_mirror();
}
if (!CallbackInvoker::report_constant_pool_reference(mirror, entry, (jint)i)) {
return false;