Fix "const-class v0, I" for libartd.so
This CL fixes the verification of "const-class v0, I"
by adding HasClassVirtual() to PrimitiveType.
Without this CL, the DCHECK for HasClass() in RegType::GetClass()
will raise an assertion failure, since the verifier is trying to get
the class object for the dex cache.
This issue can be reproduced by running the CTS
dot.junit.opcodes.const_class.Main_testN2 with libartd.so.
Change-Id: I605a3fcf7dd9d63e1f739fbb3153d0367911bb3e
diff --git a/runtime/verifier/reg_type_cache.cc b/runtime/verifier/reg_type_cache.cc
index bffec4b..fb0616d 100644
--- a/runtime/verifier/reg_type_cache.cc
+++ b/runtime/verifier/reg_type_cache.cc
@@ -288,6 +288,7 @@
if (!descriptor.empty()) {
klass = art::Runtime::Current()->GetClassLinker()->FindSystemClass(Thread::Current(),
descriptor.c_str());
+ DCHECK(klass != nullptr);
}
const Type* entry = Type::CreateInstance(klass, descriptor, RegTypeCache::primitive_count_);
RegTypeCache::primitive_count_++;