Add slow path for OP_NEW_INSTANCE
If the type is unresolved at verification time, we can't be sure
it's a valid new. The compiler will now check for type resolution
at compile time. If unresolved, we'll call out to the slow path,
where the access check will take place.
This CL only contains the compiler portion of this change. For
now, the slow path code just calls out to the normal routine.
Change-Id: Ia568a164389baedaa695a44f6845a0fdfe585b56
diff --git a/src/compiler/codegen/arm/Thumb2/Gen.cc b/src/compiler/codegen/arm/Thumb2/Gen.cc
index 00be2be..7098188 100644
--- a/src/compiler/codegen/arm/Thumb2/Gen.cc
+++ b/src/compiler/codegen/arm/Thumb2/Gen.cc
@@ -693,8 +693,11 @@
RegLocation rlDest)
{
oatFlushAllRegs(cUnit); /* Everything to home location */
- loadWordDisp(cUnit, rSELF,
- OFFSETOF_MEMBER(Thread, pAllocObjectFromCode), rLR);
+ art::Class* classPtr = cUnit->method->GetDexCacheResolvedTypes()->
+ Get(mir->dalvikInsn.vB);
+ loadWordDisp(cUnit, rSELF, (classPtr != NULL)
+ ? OFFSETOF_MEMBER(Thread, pAllocObjectFromCode)
+ : OFFSETOF_MEMBER(Thread, pAllocObjectFromCodeSlowPath), rLR);
loadCurrMethodDirect(cUnit, r1); // arg1 <= Method*
loadConstant(cUnit, r0, mir->dalvikInsn.vB); // arg0 <- type_id
callRuntimeHelper(cUnit, rLR);