From 0eb7d7e2a0c2767b5fd86bd52436c618fd4c3120 Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Tue, 31 Jan 2012 21:12:32 -0800 Subject: Implement array allocation with access checks. Change-Id: I0b2c0274087f3f7ed5b0b71c441e5d7e5a25f819 --- src/compiler/codegen/arm/MethodCodegenDriver.cc | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'src/compiler/codegen/arm/MethodCodegenDriver.cc') diff --git a/src/compiler/codegen/arm/MethodCodegenDriver.cc b/src/compiler/codegen/arm/MethodCodegenDriver.cc index 6f476f930f..bb66451221 100644 --- a/src/compiler/codegen/arm/MethodCodegenDriver.cc +++ b/src/compiler/codegen/arm/MethodCodegenDriver.cc @@ -58,11 +58,8 @@ STATIC void genNewArray(CompilationUnit* cUnit, MIR* mir, RegLocation rlDest, 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 @@ STATIC void genFilledNewArray(CompilationUnit* cUnit, MIR* mir, bool isRange) 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 -- cgit v1.2.3-59-g8ed1b