Support for unresolved types in new-instance during verification.
Also, ensure that classes that don't load are erroneous, warn early
about exceptions left on a thread by the verifier/compiler, factor out
slowpath checks for the compiler and fix the slowpath selector for
const-class.
This change causes more dex cache misses at runtime (more slowpath
execution). It also requires a "mm clean-oat".
Change-Id: I014b49ebdd7d8f7dd2e39cc0958fc0b708d58c4c
diff --git a/src/compiler/codegen/arm/MethodCodegenDriver.cc b/src/compiler/codegen/arm/MethodCodegenDriver.cc
index 7ea7d69..4326a9e 100644
--- a/src/compiler/codegen/arm/MethodCodegenDriver.cc
+++ b/src/compiler/codegen/arm/MethodCodegenDriver.cc
@@ -46,10 +46,19 @@
RegLocation rlSrc)
{
oatFlushAllRegs(cUnit); /* Everything to home location */
- loadWordDisp(cUnit, rSELF,
- OFFSETOF_MEMBER(Thread, pAllocArrayFromCode), rLR);
+ uint32_t type_idx = mir->dalvikInsn.vC;
+ if (cUnit->compiler->CanAccessTypeWithoutChecks(cUnit->method, type_idx)) {
+ loadWordDisp(cUnit, rSELF,
+ OFFSETOF_MEMBER(Thread, pAllocArrayFromCode), rLR);
+ } else {
+ UNIMPLEMENTED(WARNING) << "Need to check access of '"
+ << PrettyMethod(cUnit->method)
+ << "' to unresolved type " << type_idx;
+ loadWordDisp(cUnit, rSELF,
+ OFFSETOF_MEMBER(Thread, pAllocArrayFromCode), rLR);
+ }
loadCurrMethodDirect(cUnit, r1); // arg1 <- Method*
- loadConstant(cUnit, r0, mir->dalvikInsn.vC); // arg0 <- type_id
+ loadConstant(cUnit, r0, type_idx); // arg0 <- type_id
loadValueDirectFixed(cUnit, rlSrc, r2); // arg2 <- count
callRuntimeHelper(cUnit, rLR);
RegLocation rlResult = oatGetReturn(cUnit);
@@ -70,6 +79,10 @@
oatFlushAllRegs(cUnit); /* Everything to home location */
loadWordDisp(cUnit, rSELF,
OFFSETOF_MEMBER(Thread, pCheckAndAllocArrayFromCode), rLR);
+ if (!cUnit->compiler->CanAccessTypeWithoutChecks(cUnit->method, typeId)) {
+ UNIMPLEMENTED(WARNING) << "Need to check access of '" << PrettyMethod(cUnit->method)
+ << "' to unresolved type " << typeId;
+ }
loadCurrMethodDirect(cUnit, r1); // arg1 <- Method*
loadConstant(cUnit, r0, typeId); // arg0 <- type_id
loadConstant(cUnit, r2, elems); // arg2 <- count