diff options
| author | 2012-07-10 15:18:31 -0700 | |
|---|---|---|
| committer | 2012-07-10 19:19:27 -0700 | |
| commit | f1f863695b28f630abb772f50170fefaddc2fb91 (patch) | |
| tree | 9a5bdda08897530e998484a2a400ac34ff7962f4 /src/compiler/codegen | |
| parent | dcfdd2b03af29dcaf234d062a79acb919f130435 (diff) | |
Quick compiler - fix run-test 019
Two problems:
1. Was treating an array object store as a regular array store
2. Codegen bug that (somewhat disturbingly) existed in the
non-quick code. I'm a little surprised that it hadn't
shown up before now, but it would tend to be masked if
the array base register in question was promoted.
Change-Id: I62bcb866174538ceedcc1309edcf22261237840a
Diffstat (limited to 'src/compiler/codegen')
| -rw-r--r-- | src/compiler/codegen/GenCommon.cc | 2 | ||||
| -rw-r--r-- | src/compiler/codegen/MethodBitcode.cc | 38 | ||||
| -rw-r--r-- | src/compiler/codegen/arm/ArchUtility.cc | 2 |
3 files changed, 31 insertions, 11 deletions
diff --git a/src/compiler/codegen/GenCommon.cc b/src/compiler/codegen/GenCommon.cc index 40c0f22fa9..9082a49ad3 100644 --- a/src/compiler/codegen/GenCommon.cc +++ b/src/compiler/codegen/GenCommon.cc @@ -1439,7 +1439,7 @@ void genArrayObjPut(CompilationUnit* cUnit, int optFlags, RegLocation rlArray, int regLen = INVALID_REG; if (needsRangeCheck) { regLen = rARG1; - loadWordDisp(cUnit, rlArray.lowReg, lenOffset, regLen); // Get len + loadWordDisp(cUnit, rArray, lenOffset, regLen); // Get len } /* rPtr -> array data */ int rPtr = oatAllocTemp(cUnit); diff --git a/src/compiler/codegen/MethodBitcode.cc b/src/compiler/codegen/MethodBitcode.cc index cf7b6ff8ad..89c11c6fa2 100644 --- a/src/compiler/codegen/MethodBitcode.cc +++ b/src/compiler/codegen/MethodBitcode.cc @@ -2557,7 +2557,7 @@ void cvtAget(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size, } void cvtAput(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size, - int scale) + int scale, bool isObject) { DCHECK_EQ(callInst->getNumArgOperands(), 4U); llvm::ConstantInt* optFlags = @@ -2565,8 +2565,24 @@ void cvtAput(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size, RegLocation rlSrc = getLoc(cUnit, callInst->getArgOperand(1)); RegLocation rlArray = getLoc(cUnit, callInst->getArgOperand(2)); RegLocation rlIndex = getLoc(cUnit, callInst->getArgOperand(3)); - genArrayPut(cUnit, optFlags->getZExtValue(), size, rlArray, rlIndex, - rlSrc, scale); + if (isObject) { + genArrayObjPut(cUnit, optFlags->getZExtValue(), rlArray, rlIndex, + rlSrc, scale); + } else { + genArrayPut(cUnit, optFlags->getZExtValue(), size, rlArray, rlIndex, + rlSrc, scale); + } +} + +void cvtAputObj(CompilationUnit* cUnit, llvm::CallInst* callInst) +{ + cvtAput(cUnit, callInst, kWord, 2, true /* isObject */); +} + +void cvtAputPrimitive(CompilationUnit* cUnit, llvm::CallInst* callInst, + OpSize size, int scale) +{ + cvtAput(cUnit, callInst, size, scale, false /* isObject */); } void cvtIget(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size, @@ -2942,25 +2958,27 @@ bool methodBitcodeBlockCodeGen(CompilationUnit* cUnit, llvm::BasicBlock* bb) break; case greenland::IntrinsicHelper::HLArrayPut: - case greenland::IntrinsicHelper::HLArrayPutObject: case greenland::IntrinsicHelper::HLArrayPutFloat: - cvtAput(cUnit, callInst, kWord, 2); + cvtAputPrimitive(cUnit, callInst, kWord, 2); + break; + case greenland::IntrinsicHelper::HLArrayPutObject: + cvtAputObj(cUnit, callInst); break; case greenland::IntrinsicHelper::HLArrayPutWide: case greenland::IntrinsicHelper::HLArrayPutDouble: - cvtAput(cUnit, callInst, kLong, 3); + cvtAputPrimitive(cUnit, callInst, kLong, 3); break; case greenland::IntrinsicHelper::HLArrayPutBoolean: - cvtAput(cUnit, callInst, kUnsignedByte, 0); + cvtAputPrimitive(cUnit, callInst, kUnsignedByte, 0); break; case greenland::IntrinsicHelper::HLArrayPutByte: - cvtAput(cUnit, callInst, kSignedByte, 0); + cvtAputPrimitive(cUnit, callInst, kSignedByte, 0); break; case greenland::IntrinsicHelper::HLArrayPutChar: - cvtAput(cUnit, callInst, kUnsignedHalf, 1); + cvtAputPrimitive(cUnit, callInst, kUnsignedHalf, 1); break; case greenland::IntrinsicHelper::HLArrayPutShort: - cvtAput(cUnit, callInst, kSignedHalf, 1); + cvtAputPrimitive(cUnit, callInst, kSignedHalf, 1); break; case greenland::IntrinsicHelper::HLIGet: diff --git a/src/compiler/codegen/arm/ArchUtility.cc b/src/compiler/codegen/arm/ArchUtility.cc index 725200a6f6..cdb8486f50 100644 --- a/src/compiler/codegen/arm/ArchUtility.cc +++ b/src/compiler/codegen/arm/ArchUtility.cc @@ -218,6 +218,8 @@ std::string buildInsnString(const char* fmt, LIR* lir, unsigned char* baseAddr) sprintf(tbuf,"%d", operand); break; case 'C': + DCHECK_LT(operand, static_cast<int>( + sizeof(coreRegNames)/sizeof(coreRegNames[0]))); sprintf(tbuf,"%s",coreRegNames[operand]); break; case 'E': |