summaryrefslogtreecommitdiff
path: root/src/compiler/codegen/arm/MethodCodegenDriver.cc
diff options
context:
space:
mode:
author buzbee <buzbee@google.com> 2011-08-28 21:15:53 -0700
committer buzbee <buzbee@google.com> 2011-08-28 21:39:17 -0700
commite1931749814dbb80c5a756f9842e9c261bb2e8f6 (patch)
tree6e0d28df7394cd1921643032ed2030c3e0bc113c /src/compiler/codegen/arm/MethodCodegenDriver.cc
parent48a35d0cc5cf5dec38808d147862e165e9d67163 (diff)
Use slow-path static field accessors; added tests
Modified the compiler to always take the slow path for static field accesses. Still need to implement the fast path, but this allows us to test the slow path now. It's also about time we added command-line (or other) options for compiler control. We'll want to have a testing option to force slow paths for testing, and also an option to control the compiler's debug output (which is starting to get annoying). Change-Id: I9c1bc6faea0042894270d242366c688f1662842b
Diffstat (limited to 'src/compiler/codegen/arm/MethodCodegenDriver.cc')
-rw-r--r--src/compiler/codegen/arm/MethodCodegenDriver.cc76
1 files changed, 72 insertions, 4 deletions
diff --git a/src/compiler/codegen/arm/MethodCodegenDriver.cc b/src/compiler/codegen/arm/MethodCodegenDriver.cc
index bd50742f35..ea0272172c 100644
--- a/src/compiler/codegen/arm/MethodCodegenDriver.cc
+++ b/src/compiler/codegen/arm/MethodCodegenDriver.cc
@@ -139,7 +139,26 @@ static void genFilledNewArray(CompilationUnit* cUnit, MIR* mir, bool isRange)
static void genSput(CompilationUnit* cUnit, MIR* mir, RegLocation rlSrc)
{
- UNIMPLEMENTED(FATAL) << "Must update for new world";
+ bool slow_path = true;
+ bool isObject = ((mir->dalvikInsn.opcode == OP_SPUT_OBJECT) ||
+ (mir->dalvikInsn.opcode == OP_SPUT_OBJECT_VOLATILE));
+ UNIMPLEMENTED(WARNING) << "Implement sput fast path";
+ int funcOffset;
+ if (slow_path) {
+ if (isObject) {
+ funcOffset = OFFSETOF_MEMBER(Thread, pSetObjStatic);
+ } else {
+ funcOffset = OFFSETOF_MEMBER(Thread, pSet32Static);
+ }
+ oatFlushAllRegs(cUnit);
+ loadWordDisp(cUnit, rSELF, funcOffset, rLR);
+ loadConstant(cUnit, r0, mir->dalvikInsn.vB);
+ loadCurrMethodDirect(cUnit, r1);
+ loadValueDirect(cUnit, rlSrc, r2);
+ opReg(cUnit, kOpBlx, rLR);
+ oatClobberCallRegs(cUnit);
+ } else {
+ UNIMPLEMENTED(FATAL) << "Must update for new world";
#if 0
int valOffset = OFFSETOF_MEMBER(StaticField, value);
int tReg = oatAllocTemp(cUnit);
@@ -188,11 +207,25 @@ static void genSput(CompilationUnit* cUnit, MIR* mir, RegLocation rlSrc)
oatFreeTemp(cUnit, objHead);
}
#endif
+ }
}
static void genSputWide(CompilationUnit* cUnit, MIR* mir, RegLocation rlSrc)
{
- UNIMPLEMENTED(FATAL) << "Must update for new world";
+ bool slow_path = true;
+ UNIMPLEMENTED(WARNING) << "Implement sput-wide fast path";
+ int funcOffset;
+ if (slow_path) {
+ funcOffset = OFFSETOF_MEMBER(Thread, pSet64Static);
+ oatFlushAllRegs(cUnit);
+ loadWordDisp(cUnit, rSELF, funcOffset, rLR);
+ loadConstant(cUnit, r0, mir->dalvikInsn.vB);
+ loadCurrMethodDirect(cUnit, r1);
+ loadValueDirectWideFixed(cUnit, rlSrc, r2, r3);
+ opReg(cUnit, kOpBlx, rLR);
+ oatClobberCallRegs(cUnit);
+ } else {
+ UNIMPLEMENTED(FATAL) << "Must update for new world";
#if 0
int tReg = oatAllocTemp(cUnit);
int valOffset = OFFSETOF_MEMBER(StaticField, value);
@@ -212,6 +245,7 @@ static void genSputWide(CompilationUnit* cUnit, MIR* mir, RegLocation rlSrc)
storePair(cUnit, tReg, rlSrc.lowReg, rlSrc.highReg);
#endif
+ }
}
@@ -219,7 +253,20 @@ static void genSputWide(CompilationUnit* cUnit, MIR* mir, RegLocation rlSrc)
static void genSgetWide(CompilationUnit* cUnit, MIR* mir,
RegLocation rlResult, RegLocation rlDest)
{
- UNIMPLEMENTED(FATAL) << "Must update for new world";
+ bool slow_path = true;
+ UNIMPLEMENTED(WARNING) << "Implement sget-wide fast path";
+ int funcOffset;
+ if (slow_path) {
+ funcOffset = OFFSETOF_MEMBER(Thread, pGet64Static);
+ oatFlushAllRegs(cUnit);
+ loadWordDisp(cUnit, rSELF, funcOffset, rLR);
+ loadConstant(cUnit, r0, mir->dalvikInsn.vB);
+ loadCurrMethodDirect(cUnit, r1);
+ opReg(cUnit, kOpBlx, rLR);
+ RegLocation rlResult = oatGetReturnWide(cUnit);
+ storeValueWide(cUnit, rlDest, rlResult);
+ } else {
+ UNIMPLEMENTED(FATAL) << "Must update for new world";
#if 0
int valOffset = OFFSETOF_MEMBER(StaticField, value);
const Method *method = (mir->OptimizationFlags & MIR_CALLEE) ?
@@ -241,12 +288,32 @@ static void genSgetWide(CompilationUnit* cUnit, MIR* mir,
storeValueWide(cUnit, rlDest, rlResult);
#endif
+ }
}
static void genSget(CompilationUnit* cUnit, MIR* mir,
RegLocation rlResult, RegLocation rlDest)
{
- UNIMPLEMENTED(FATAL) << "Must update for new world";
+ bool slow_path = true;
+ bool isObject = ((mir->dalvikInsn.opcode == OP_SGET_OBJECT) ||
+ (mir->dalvikInsn.opcode == OP_SGET_OBJECT_VOLATILE));
+ UNIMPLEMENTED(WARNING) << "Implement sget fast path";
+ int funcOffset;
+ if (slow_path) {
+ if (isObject) {
+ funcOffset = OFFSETOF_MEMBER(Thread, pGetObjStatic);
+ } else {
+ funcOffset = OFFSETOF_MEMBER(Thread, pGet32Static);
+ }
+ oatFlushAllRegs(cUnit);
+ loadWordDisp(cUnit, rSELF, funcOffset, rLR);
+ loadConstant(cUnit, r0, mir->dalvikInsn.vB);
+ loadCurrMethodDirect(cUnit, r1);
+ opReg(cUnit, kOpBlx, rLR);
+ RegLocation rlResult = oatGetReturn(cUnit);
+ storeValue(cUnit, rlDest, rlResult);
+ } else {
+ UNIMPLEMENTED(FATAL) << "Must update for new world";
#if 0
int valOffset = OFFSETOF_MEMBER(StaticField, value);
int tReg = oatAllocTemp(cUnit);
@@ -288,6 +355,7 @@ static void genSget(CompilationUnit* cUnit, MIR* mir,
storeValue(cUnit, rlDest, rlResult);
#endif
+ }
}
typedef int (*NextCallInsn)(CompilationUnit*, MIR*, DecodedInstruction*, int);