Quick Compiler function renaming
Move the Quick compiler's function naming to Art coding conventions. Will
be done is pieces: names first, then arguments and locals. Also removed
some dead code and marked statics for the top level source files
No logic changes aside from eliminating a few useless exported "oat"
routines.
Change-Id: Iadaddc560942a0fc1199ba5b1c261cd6ac5cfd9a
diff --git a/src/compiler/codegen/x86/call_x86.cc b/src/compiler/codegen/x86/call_x86.cc
index 51dda66..7ada136 100644
--- a/src/compiler/codegen/x86/call_x86.cc
+++ b/src/compiler/codegen/x86/call_x86.cc
@@ -22,7 +22,7 @@
namespace art {
-void genSpecialCase(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
+void GenSpecialCase(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
SpecialCaseHandler specialCase)
{
// TODO
@@ -32,26 +32,26 @@
* The sparse table in the literal pool is an array of <key,displacement>
* pairs.
*/
-BasicBlock *findBlock(CompilationUnit* cUnit, unsigned int codeOffset,
+BasicBlock *FindBlock(CompilationUnit* cUnit, unsigned int codeOffset,
bool split, bool create, BasicBlock** immedPredBlockP);
-void genSparseSwitch(CompilationUnit* cUnit, uint32_t tableOffset,
+void GenSparseSwitch(CompilationUnit* cUnit, uint32_t tableOffset,
RegLocation rlSrc)
{
const uint16_t* table = cUnit->insns + cUnit->currentDalvikOffset + tableOffset;
if (cUnit->printMe) {
- dumpSparseSwitchTable(table);
+ DumpSparseSwitchTable(table);
}
int entries = table[1];
const int* keys = reinterpret_cast<const int*>(&table[2]);
const int* targets = &keys[entries];
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
for (int i = 0; i < entries; i++) {
int key = keys[i];
- BasicBlock* case_block = findBlock(cUnit,
+ BasicBlock* case_block = FindBlock(cUnit,
cUnit->currentDalvikOffset + targets[i],
false, false, NULL);
LIR* labelList = cUnit->blockLabelList;
- opCmpImmBranch(cUnit, kCondEq, rlSrc.lowReg, key,
+ OpCmpImmBranch(cUnit, kCondEq, rlSrc.lowReg, key,
&labelList[case_block->id]);
}
}
@@ -72,57 +72,57 @@
* jmp rStartOfMethod
* done:
*/
-void genPackedSwitch(CompilationUnit* cUnit, uint32_t tableOffset,
+void GenPackedSwitch(CompilationUnit* cUnit, uint32_t tableOffset,
RegLocation rlSrc)
{
const uint16_t* table = cUnit->insns + cUnit->currentDalvikOffset + tableOffset;
if (cUnit->printMe) {
- dumpPackedSwitchTable(table);
+ DumpPackedSwitchTable(table);
}
// Add the table to the list - we'll process it later
SwitchTable *tabRec =
- static_cast<SwitchTable *>(oatNew(cUnit, sizeof(SwitchTable), true, kAllocData));
+ static_cast<SwitchTable *>(NewMem(cUnit, sizeof(SwitchTable), true, kAllocData));
tabRec->table = table;
tabRec->vaddr = cUnit->currentDalvikOffset;
int size = table[1];
- tabRec->targets = static_cast<LIR**>(oatNew(cUnit, size * sizeof(LIR*), true, kAllocLIR));
- oatInsertGrowableList(cUnit, &cUnit->switchTables, reinterpret_cast<uintptr_t>(tabRec));
+ tabRec->targets = static_cast<LIR**>(NewMem(cUnit, size * sizeof(LIR*), true, kAllocLIR));
+ InsertGrowableList(cUnit, &cUnit->switchTables, reinterpret_cast<uintptr_t>(tabRec));
// Get the switch value
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
- int startOfMethodReg = oatAllocTemp(cUnit);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
+ int startOfMethodReg = AllocTemp(cUnit);
// Materialize a pointer to the switch table
- //newLIR0(cUnit, kX86Bkpt);
- newLIR1(cUnit, kX86StartOfMethod, startOfMethodReg);
+ //NewLIR0(cUnit, kX86Bkpt);
+ NewLIR1(cUnit, kX86StartOfMethod, startOfMethodReg);
int lowKey = s4FromSwitchData(&table[2]);
int keyReg;
// Remove the bias, if necessary
if (lowKey == 0) {
keyReg = rlSrc.lowReg;
} else {
- keyReg = oatAllocTemp(cUnit);
- opRegRegImm(cUnit, kOpSub, keyReg, rlSrc.lowReg, lowKey);
+ keyReg = AllocTemp(cUnit);
+ OpRegRegImm(cUnit, kOpSub, keyReg, rlSrc.lowReg, lowKey);
}
// Bounds check - if < 0 or >= size continue following switch
- opRegImm(cUnit, kOpCmp, keyReg, size-1);
- LIR* branchOver = opCondBranch(cUnit, kCondHi, NULL);
+ OpRegImm(cUnit, kOpCmp, keyReg, size-1);
+ LIR* branchOver = OpCondBranch(cUnit, kCondHi, NULL);
// Load the displacement from the switch table
- int dispReg = oatAllocTemp(cUnit);
- newLIR5(cUnit, kX86PcRelLoadRA, dispReg, startOfMethodReg, keyReg, 2,
+ int dispReg = AllocTemp(cUnit);
+ NewLIR5(cUnit, kX86PcRelLoadRA, dispReg, startOfMethodReg, keyReg, 2,
reinterpret_cast<uintptr_t>(tabRec));
// Add displacement to start of method
- opRegReg(cUnit, kOpAdd, startOfMethodReg, dispReg);
+ OpRegReg(cUnit, kOpAdd, startOfMethodReg, dispReg);
// ..and go!
- LIR* switchBranch = newLIR1(cUnit, kX86JmpR, startOfMethodReg);
+ LIR* switchBranch = NewLIR1(cUnit, kX86JmpR, startOfMethodReg);
tabRec->anchor = switchBranch;
/* branchOver target here */
- LIR* target = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* target = NewLIR0(cUnit, kPseudoTargetLabel);
branchOver->target = target;
}
-void callRuntimeHelperRegReg(CompilationUnit* cUnit, int helperOffset,
+void CallRuntimeHelperRegReg(CompilationUnit* cUnit, int helperOffset,
int arg0, int arg1, bool safepointPC);
/*
* Array data table format:
@@ -134,90 +134,90 @@
*
* Total size is 4+(width * size + 1)/2 16-bit code units.
*/
-void genFillArrayData(CompilationUnit* cUnit, uint32_t tableOffset,
+void GenFillArrayData(CompilationUnit* cUnit, uint32_t tableOffset,
RegLocation rlSrc)
{
const uint16_t* table = cUnit->insns + cUnit->currentDalvikOffset + tableOffset;
// Add the table to the list - we'll process it later
FillArrayData *tabRec =
- static_cast<FillArrayData*>(oatNew(cUnit, sizeof(FillArrayData), true, kAllocData));
+ static_cast<FillArrayData*>(NewMem(cUnit, sizeof(FillArrayData), true, kAllocData));
tabRec->table = table;
tabRec->vaddr = cUnit->currentDalvikOffset;
uint16_t width = tabRec->table[1];
uint32_t size = tabRec->table[2] | ((static_cast<uint32_t>(tabRec->table[3])) << 16);
tabRec->size = (size * width) + 8;
- oatInsertGrowableList(cUnit, &cUnit->fillArrayData, reinterpret_cast<uintptr_t>(tabRec));
+ InsertGrowableList(cUnit, &cUnit->fillArrayData, reinterpret_cast<uintptr_t>(tabRec));
// Making a call - use explicit registers
- oatFlushAllRegs(cUnit); /* Everything to home location */
- loadValueDirectFixed(cUnit, rlSrc, rX86_ARG0);
+ FlushAllRegs(cUnit); /* Everything to home location */
+ LoadValueDirectFixed(cUnit, rlSrc, rX86_ARG0);
// Materialize a pointer to the fill data image
- newLIR1(cUnit, kX86StartOfMethod, rX86_ARG2);
- newLIR2(cUnit, kX86PcRelAdr, rX86_ARG1, reinterpret_cast<uintptr_t>(tabRec));
- newLIR2(cUnit, kX86Add32RR, rX86_ARG1, rX86_ARG2);
- callRuntimeHelperRegReg(cUnit, ENTRYPOINT_OFFSET(pHandleFillArrayDataFromCode), rX86_ARG0,
+ NewLIR1(cUnit, kX86StartOfMethod, rX86_ARG2);
+ NewLIR2(cUnit, kX86PcRelAdr, rX86_ARG1, reinterpret_cast<uintptr_t>(tabRec));
+ NewLIR2(cUnit, kX86Add32RR, rX86_ARG1, rX86_ARG2);
+ CallRuntimeHelperRegReg(cUnit, ENTRYPOINT_OFFSET(pHandleFillArrayDataFromCode), rX86_ARG0,
rX86_ARG1, true);
}
-void genMonitorEnter(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc)
+void GenMonitorEnter(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc)
{
- oatFlushAllRegs(cUnit);
- loadValueDirectFixed(cUnit, rlSrc, rCX); // Get obj
- oatLockCallTemps(cUnit); // Prepare for explicit register usage
- genNullCheck(cUnit, rlSrc.sRegLow, rCX, optFlags);
+ FlushAllRegs(cUnit);
+ LoadValueDirectFixed(cUnit, rlSrc, rCX); // Get obj
+ LockCallTemps(cUnit); // Prepare for explicit register usage
+ GenNullCheck(cUnit, rlSrc.sRegLow, rCX, optFlags);
// If lock is unheld, try to grab it quickly with compare and exchange
// TODO: copy and clear hash state?
- newLIR2(cUnit, kX86Mov32RT, rDX, Thread::ThinLockIdOffset().Int32Value());
- newLIR2(cUnit, kX86Sal32RI, rDX, LW_LOCK_OWNER_SHIFT);
- newLIR2(cUnit, kX86Xor32RR, rAX, rAX);
- newLIR3(cUnit, kX86LockCmpxchgMR, rCX, Object::MonitorOffset().Int32Value(), rDX);
- LIR* branch = newLIR2(cUnit, kX86Jcc8, 0, kX86CondEq);
+ NewLIR2(cUnit, kX86Mov32RT, rDX, Thread::ThinLockIdOffset().Int32Value());
+ NewLIR2(cUnit, kX86Sal32RI, rDX, LW_LOCK_OWNER_SHIFT);
+ NewLIR2(cUnit, kX86Xor32RR, rAX, rAX);
+ NewLIR3(cUnit, kX86LockCmpxchgMR, rCX, Object::MonitorOffset().Int32Value(), rDX);
+ LIR* branch = NewLIR2(cUnit, kX86Jcc8, 0, kX86CondEq);
// If lock is held, go the expensive route - artLockObjectFromCode(self, obj);
- callRuntimeHelperReg(cUnit, ENTRYPOINT_OFFSET(pLockObjectFromCode), rCX, true);
- branch->target = newLIR0(cUnit, kPseudoTargetLabel);
+ CallRuntimeHelperReg(cUnit, ENTRYPOINT_OFFSET(pLockObjectFromCode), rCX, true);
+ branch->target = NewLIR0(cUnit, kPseudoTargetLabel);
}
-void genMonitorExit(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc)
+void GenMonitorExit(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc)
{
- oatFlushAllRegs(cUnit);
- loadValueDirectFixed(cUnit, rlSrc, rAX); // Get obj
- oatLockCallTemps(cUnit); // Prepare for explicit register usage
- genNullCheck(cUnit, rlSrc.sRegLow, rAX, optFlags);
+ FlushAllRegs(cUnit);
+ LoadValueDirectFixed(cUnit, rlSrc, rAX); // Get obj
+ LockCallTemps(cUnit); // Prepare for explicit register usage
+ GenNullCheck(cUnit, rlSrc.sRegLow, rAX, optFlags);
// If lock is held by the current thread, clear it to quickly release it
// TODO: clear hash state?
- newLIR2(cUnit, kX86Mov32RT, rDX, Thread::ThinLockIdOffset().Int32Value());
- newLIR2(cUnit, kX86Sal32RI, rDX, LW_LOCK_OWNER_SHIFT);
- newLIR3(cUnit, kX86Mov32RM, rCX, rAX, Object::MonitorOffset().Int32Value());
- opRegReg(cUnit, kOpSub, rCX, rDX);
- LIR* branch = newLIR2(cUnit, kX86Jcc8, 0, kX86CondNe);
- newLIR3(cUnit, kX86Mov32MR, rAX, Object::MonitorOffset().Int32Value(), rCX);
- LIR* branch2 = newLIR1(cUnit, kX86Jmp8, 0);
- branch->target = newLIR0(cUnit, kPseudoTargetLabel);
+ NewLIR2(cUnit, kX86Mov32RT, rDX, Thread::ThinLockIdOffset().Int32Value());
+ NewLIR2(cUnit, kX86Sal32RI, rDX, LW_LOCK_OWNER_SHIFT);
+ NewLIR3(cUnit, kX86Mov32RM, rCX, rAX, Object::MonitorOffset().Int32Value());
+ OpRegReg(cUnit, kOpSub, rCX, rDX);
+ LIR* branch = NewLIR2(cUnit, kX86Jcc8, 0, kX86CondNe);
+ NewLIR3(cUnit, kX86Mov32MR, rAX, Object::MonitorOffset().Int32Value(), rCX);
+ LIR* branch2 = NewLIR1(cUnit, kX86Jmp8, 0);
+ branch->target = NewLIR0(cUnit, kPseudoTargetLabel);
// Otherwise, go the expensive route - UnlockObjectFromCode(obj);
- callRuntimeHelperReg(cUnit, ENTRYPOINT_OFFSET(pUnlockObjectFromCode), rAX, true);
- branch2->target = newLIR0(cUnit, kPseudoTargetLabel);
+ CallRuntimeHelperReg(cUnit, ENTRYPOINT_OFFSET(pUnlockObjectFromCode), rAX, true);
+ branch2->target = NewLIR0(cUnit, kPseudoTargetLabel);
}
/*
* Mark garbage collection card. Skip if the value we're storing is null.
*/
-void markGCCard(CompilationUnit* cUnit, int valReg, int tgtAddrReg)
+void MarkGCCard(CompilationUnit* cUnit, int valReg, int tgtAddrReg)
{
- int regCardBase = oatAllocTemp(cUnit);
- int regCardNo = oatAllocTemp(cUnit);
- LIR* branchOver = opCmpImmBranch(cUnit, kCondEq, valReg, 0, NULL);
- newLIR2(cUnit, kX86Mov32RT, regCardBase, Thread::CardTableOffset().Int32Value());
- opRegRegImm(cUnit, kOpLsr, regCardNo, tgtAddrReg, CardTable::kCardShift);
- storeBaseIndexed(cUnit, regCardBase, regCardNo, regCardBase, 0,
+ int regCardBase = AllocTemp(cUnit);
+ int regCardNo = AllocTemp(cUnit);
+ LIR* branchOver = OpCmpImmBranch(cUnit, kCondEq, valReg, 0, NULL);
+ NewLIR2(cUnit, kX86Mov32RT, regCardBase, Thread::CardTableOffset().Int32Value());
+ OpRegRegImm(cUnit, kOpLsr, regCardNo, tgtAddrReg, CardTable::kCardShift);
+ StoreBaseIndexed(cUnit, regCardBase, regCardNo, regCardBase, 0,
kUnsignedByte);
- LIR* target = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* target = NewLIR0(cUnit, kPseudoTargetLabel);
branchOver->target = target;
- oatFreeTemp(cUnit, regCardBase);
- oatFreeTemp(cUnit, regCardNo);
+ FreeTemp(cUnit, regCardBase);
+ FreeTemp(cUnit, regCardNo);
}
-void genEntrySequence(CompilationUnit* cUnit, RegLocation* argLocs,
+void GenEntrySequence(CompilationUnit* cUnit, RegLocation* ArgLocs,
RegLocation rlMethod)
{
/*
@@ -226,12 +226,12 @@
* expanding the frame or flushing. This leaves the utility
* code with no spare temps.
*/
- oatLockTemp(cUnit, rX86_ARG0);
- oatLockTemp(cUnit, rX86_ARG1);
- oatLockTemp(cUnit, rX86_ARG2);
+ LockTemp(cUnit, rX86_ARG0);
+ LockTemp(cUnit, rX86_ARG1);
+ LockTemp(cUnit, rX86_ARG2);
/* Build frame, return address already on stack */
- opRegImm(cUnit, kOpSub, rX86_SP, cUnit->frameSize - 4);
+ OpRegImm(cUnit, kOpSub, rX86_SP, cUnit->frameSize - 4);
/*
* We can safely skip the stack overflow check if we're
@@ -240,40 +240,40 @@
bool skipOverflowCheck = ((cUnit->attrs & METHOD_IS_LEAF) &&
(static_cast<size_t>(cUnit->frameSize) <
Thread::kStackOverflowReservedBytes));
- newLIR0(cUnit, kPseudoMethodEntry);
+ NewLIR0(cUnit, kPseudoMethodEntry);
/* Spill core callee saves */
- spillCoreRegs(cUnit);
+ SpillCoreRegs(cUnit);
/* NOTE: promotion of FP regs currently unsupported, thus no FP spill */
DCHECK_EQ(cUnit->numFPSpills, 0);
if (!skipOverflowCheck) {
// cmp rX86_SP, fs:[stack_end_]; jcc throw_launchpad
- LIR* tgt = rawLIR(cUnit, 0, kPseudoThrowTarget, kThrowStackOverflow, 0, 0, 0, 0);
- opRegThreadMem(cUnit, kOpCmp, rX86_SP, Thread::StackEndOffset().Int32Value());
- opCondBranch(cUnit, kCondUlt, tgt);
+ LIR* tgt = RawLIR(cUnit, 0, kPseudoThrowTarget, kThrowStackOverflow, 0, 0, 0, 0);
+ OpRegThreadMem(cUnit, kOpCmp, rX86_SP, Thread::StackEndOffset().Int32Value());
+ OpCondBranch(cUnit, kCondUlt, tgt);
// Remember branch target - will process later
- oatInsertGrowableList(cUnit, &cUnit->throwLaunchpads, reinterpret_cast<uintptr_t>(tgt));
+ InsertGrowableList(cUnit, &cUnit->throwLaunchpads, reinterpret_cast<uintptr_t>(tgt));
}
- flushIns(cUnit, argLocs, rlMethod);
+ FlushIns(cUnit, ArgLocs, rlMethod);
- oatFreeTemp(cUnit, rX86_ARG0);
- oatFreeTemp(cUnit, rX86_ARG1);
- oatFreeTemp(cUnit, rX86_ARG2);
+ FreeTemp(cUnit, rX86_ARG0);
+ FreeTemp(cUnit, rX86_ARG1);
+ FreeTemp(cUnit, rX86_ARG2);
}
-void genExitSequence(CompilationUnit* cUnit) {
+void GenExitSequence(CompilationUnit* cUnit) {
/*
* In the exit path, rX86_RET0/rX86_RET1 are live - make sure they aren't
* allocated by the register utilities as temps.
*/
- oatLockTemp(cUnit, rX86_RET0);
- oatLockTemp(cUnit, rX86_RET1);
+ LockTemp(cUnit, rX86_RET0);
+ LockTemp(cUnit, rX86_RET1);
- newLIR0(cUnit, kPseudoMethodExit);
- unSpillCoreRegs(cUnit);
+ NewLIR0(cUnit, kPseudoMethodExit);
+ UnSpillCoreRegs(cUnit);
/* Remove frame except for return address */
- opRegImm(cUnit, kOpAdd, rX86_SP, cUnit->frameSize - 4);
- newLIR0(cUnit, kX86Ret);
+ OpRegImm(cUnit, kOpAdd, rX86_SP, cUnit->frameSize - 4);
+ NewLIR0(cUnit, kX86Ret);
}
} // namespace art