Implement array allocation with access checks.
Change-Id: I0b2c0274087f3f7ed5b0b71c441e5d7e5a25f819
diff --git a/src/compiler/codegen/arm/MethodCodegenDriver.cc b/src/compiler/codegen/arm/MethodCodegenDriver.cc
index 6f476f9..bb66451 100644
--- a/src/compiler/codegen/arm/MethodCodegenDriver.cc
+++ b/src/compiler/codegen/arm/MethodCodegenDriver.cc
@@ -58,11 +58,8 @@
loadWordDisp(cUnit, rSELF,
OFFSETOF_MEMBER(Thread, pAllocArrayFromCode), rLR);
} else {
- UNIMPLEMENTED(WARNING) << "Need to check access of '"
- << PrettyMethod(cUnit->method_idx, *cUnit->dex_file)
- << "' to unresolved type " << type_idx;
loadWordDisp(cUnit, rSELF,
- OFFSETOF_MEMBER(Thread, pAllocArrayFromCode), rLR);
+ OFFSETOF_MEMBER(Thread, pAllocArrayFromCodeWithAccessCheck), rLR);
}
loadCurrMethodDirect(cUnit, r1); // arg1 <- Method*
loadConstant(cUnit, r0, type_idx); // arg0 <- type_id
@@ -84,15 +81,15 @@
int elems = dInsn->vA;
int typeId = dInsn->vB;
oatFlushAllRegs(cUnit); /* Everything to home location */
- loadWordDisp(cUnit, rSELF,
- OFFSETOF_MEMBER(Thread, pCheckAndAllocArrayFromCode), rLR);
- if (!cUnit->compiler->CanAccessTypeWithoutChecks(cUnit->method_idx,
- cUnit->dex_cache,
- *cUnit->dex_file,
- typeId)) {
- UNIMPLEMENTED(WARNING) << "Need to check access of '"
- << PrettyMethod(cUnit->method_idx, *cUnit->dex_file)
- << "' to unresolved type " << typeId;
+ if (cUnit->compiler->CanAccessTypeWithoutChecks(cUnit->method_idx,
+ cUnit->dex_cache,
+ *cUnit->dex_file,
+ typeId)) {
+ loadWordDisp(cUnit, rSELF,
+ OFFSETOF_MEMBER(Thread, pCheckAndAllocArrayFromCode), rLR);
+ } else {
+ loadWordDisp(cUnit, rSELF,
+ OFFSETOF_MEMBER(Thread, pCheckAndAllocArrayFromCodeWithAccessCheck), rLR);
}
loadCurrMethodDirect(cUnit, r1); // arg1 <- Method*
loadConstant(cUnit, r0, typeId); // arg0 <- type_id