Skip to content

Commit

Permalink
[MERGE #1623 @MikeHolman] fix bailout path for oopjit on arm
Browse files Browse the repository at this point in the history
Merge pull request #1623 from MikeHolman:armbailout
  • Loading branch information
MikeHolman committed Sep 22, 2016
2 parents c63560d + f2be1ed commit 0e52ceb
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 8 deletions.
14 changes: 14 additions & 0 deletions lib/Backend/LinearScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4965,3 +4965,17 @@ IR::Instr* LinearScan::InsertMove(IR::Opnd *dst, IR::Opnd *src, IR::Instr *const

return instrRet;
}

IR::Instr* LinearScan::InsertLea(IR::RegOpnd *dst, IR::Opnd *src, IR::Instr *const insertBeforeInstr)
{
IR::Instr *instrPrev = insertBeforeInstr->m_prev;

IR::Instr *instrRet = Lowerer::InsertLea(dst, src, insertBeforeInstr);

for (IR::Instr *instr = instrPrev->m_next; instr != insertBeforeInstr; instr = instr->m_next)
{
instr->CopyNumber(insertBeforeInstr);
}

return instrRet;
}
1 change: 1 addition & 0 deletions lib/Backend/LinearScan.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,5 +220,6 @@ class LinearScan
#endif

static IR::Instr * InsertMove(IR::Opnd *dst, IR::Opnd *src, IR::Instr *const insertBeforeInstr);
static IR::Instr * InsertLea(IR::RegOpnd *dst, IR::Opnd *src, IR::Instr *const insertBeforeInstr);

};
39 changes: 31 additions & 8 deletions lib/Backend/arm/LinearScanMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,35 @@ LinearScanMD::GenerateBailOut(
linearScan->SetSrcRegs(newInstr);
}

// Pass in the bailout record
// ldimm r0, bailOutRecord
LinearScan::InsertMove(
IR::RegOpnd::New(nullptr, RegR0, TyMachPtr, func),
IR::AddrOpnd::New(bailOutInfo->bailOutRecord, IR::AddrOpndKindDynamicBailOutRecord, func, true),
instr);
if (func->IsOOPJIT())
{
// ldimm r0, dataAddr
intptr_t nativeDataAddr = func->GetWorkItem()->GetWorkItemData()->nativeDataAddr;
IR::RegOpnd * r0 = IR::RegOpnd::New(nullptr, RegR0, TyMachPtr, func);
LinearScan::InsertMove(r0, IR::AddrOpnd::New(nativeDataAddr, IR::AddrOpndKindDynamicNativeCodeDataRef, func), instr);

// mov r0, [r0]
LinearScan::InsertMove(r0, IR::IndirOpnd::New(r0, 0, TyMachPtr, func), instr);

// lea r0, [r0 + bailoutRecord_offset]
unsigned int bailoutRecordOffset = NativeCodeData::GetDataTotalOffset(bailOutInfo->bailOutRecord);
LinearScan::InsertLea(
r0,
IR::IndirOpnd::New(r0, bailoutRecordOffset, TyUint32,
#if DBG
NativeCodeData::GetDataDescription(bailOutInfo->bailOutRecord, func->m_alloc),
#endif
this->func), instr);
}
else
{
// Pass in the bailout record
// ldimm r0, bailOutRecord
LinearScan::InsertMove(
IR::RegOpnd::New(nullptr, RegR0, TyMachPtr, func),
IR::AddrOpnd::New(bailOutInfo->bailOutRecord, IR::AddrOpndKindDynamicBailOutRecord, func, true),
instr);
}

firstInstr = firstInstr->m_next;
for(uint i = 0; i < registerSaveSymsCount; i++)
Expand Down Expand Up @@ -349,6 +372,6 @@ RegNum LinearScanMD::GetRegisterFromSaveIndex(uint offset)

RegNum LinearScanMD::GetParamReg(IR::SymOpnd *symOpnd, Func *func)
{
/* TODO - Add ARM32 support according to register calling convention */
return RegNOREG;
/* TODO - Add ARM32 support according to register calling convention */
return RegNOREG;
}

0 comments on commit 0e52ceb

Please sign in to comment.