OpenJDK / portola / portola
changeset 51683:cda49f297cb1
8209361: [AOT] Unexpected number of references for JVMTI_HEAP_REFERENCE_CONSTANT_POOL [111-->111]: 0 (expected at least 1)
Reviewed-by: coleenp, dholmes
author | dlong |
---|---|
date | Thu, 06 Sep 2018 17:45:15 -0700 |
parents | a8bdd9c24d37 |
children | 7e6b86eb7914 |
files | src/hotspot/share/prims/jvmtiTagMap.cpp |
diffstat | 1 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/hotspot/share/prims/jvmtiTagMap.cpp Fri Sep 07 09:09:31 2018 +0800 +++ b/src/hotspot/share/prims/jvmtiTagMap.cpp Thu Sep 06 17:45:15 2018 -0700 @@ -2875,14 +2875,26 @@ 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; + if (entry == NULL) { + continue; + } + } else if (tag.is_klass()) { + entry = pool->resolved_klass_at(i)->java_mirror(); } else { - entry = pool->resolved_klass_at(i)->java_mirror(); + // 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;