Skip to content
Snippets Groups Projects
Commit d58c8e75 authored by Nicolas Geoffray's avatar Nicolas Geoffray
Browse files

Update the JIT exception writer to better mimic the codegen exception writer.

Also skip indirect encoding for platforms that ask for one: we direclty
write an address, not a pointer to the address.

llvm-svn: 54987
parent ad7013b1
No related branches found
No related tags found
No related merge requests found
...@@ -66,7 +66,8 @@ JITDwarfEmitter::EmitFrameMoves(intptr_t BaseLabelPtr, ...@@ -66,7 +66,8 @@ JITDwarfEmitter::EmitFrameMoves(intptr_t BaseLabelPtr,
unsigned PointerSize = TD->getPointerSize(); unsigned PointerSize = TD->getPointerSize();
int stackGrowth = stackGrowthDirection == TargetFrameInfo::StackGrowsUp ? int stackGrowth = stackGrowthDirection == TargetFrameInfo::StackGrowsUp ?
PointerSize : -PointerSize; PointerSize : -PointerSize;
bool IsLocal = BaseLabelPtr; bool IsLocal = false;
unsigned BaseLabelID = 0;
for (unsigned i = 0, N = Moves.size(); i < N; ++i) { for (unsigned i = 0, N = Moves.size(); i < N; ++i) {
const MachineMove &Move = Moves[i]; const MachineMove &Move = Moves[i];
...@@ -86,7 +87,7 @@ JITDwarfEmitter::EmitFrameMoves(intptr_t BaseLabelPtr, ...@@ -86,7 +87,7 @@ JITDwarfEmitter::EmitFrameMoves(intptr_t BaseLabelPtr,
const MachineLocation &Src = Move.getSource(); const MachineLocation &Src = Move.getSource();
// Advance row if new location. // Advance row if new location.
if (BaseLabelPtr && LabelID && (BaseLabelPtr != LabelPtr || !IsLocal)) { if (BaseLabelPtr && LabelID && (BaseLabelID != LabelID || !IsLocal)) {
MCE->emitByte(dwarf::DW_CFA_advance_loc4); MCE->emitByte(dwarf::DW_CFA_advance_loc4);
if (PointerSize == 8) { if (PointerSize == 8) {
MCE->emitInt64(LabelPtr - BaseLabelPtr); MCE->emitInt64(LabelPtr - BaseLabelPtr);
...@@ -94,6 +95,7 @@ JITDwarfEmitter::EmitFrameMoves(intptr_t BaseLabelPtr, ...@@ -94,6 +95,7 @@ JITDwarfEmitter::EmitFrameMoves(intptr_t BaseLabelPtr,
MCE->emitInt32(LabelPtr - BaseLabelPtr); MCE->emitInt32(LabelPtr - BaseLabelPtr);
} }
BaseLabelID = LabelID;
BaseLabelPtr = LabelPtr; BaseLabelPtr = LabelPtr;
IsLocal = true; IsLocal = true;
} }
...@@ -541,12 +543,9 @@ JITDwarfEmitter::EmitCommonEHFrame(const Function* Personality) const { ...@@ -541,12 +543,9 @@ JITDwarfEmitter::EmitCommonEHFrame(const Function* Personality) const {
if (Personality) { if (Personality) {
MCE->emitULEB128Bytes(7); MCE->emitULEB128Bytes(7);
if (needsIndirectEncoding) // Direct encoding, because we use the function pointer.
MCE->emitByte(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4 | MCE->emitByte(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
dwarf::DW_EH_PE_indirect);
else
MCE->emitByte(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
if (PointerSize == 8) if (PointerSize == 8)
MCE->emitInt64((intptr_t)Jit.getPointerToGlobal(Personality) - MCE->emitInt64((intptr_t)Jit.getPointerToGlobal(Personality) -
MCE->getCurrentPCValue()); MCE->getCurrentPCValue());
...@@ -554,12 +553,12 @@ JITDwarfEmitter::EmitCommonEHFrame(const Function* Personality) const { ...@@ -554,12 +553,12 @@ JITDwarfEmitter::EmitCommonEHFrame(const Function* Personality) const {
MCE->emitInt32((intptr_t)Jit.getPointerToGlobal(Personality) - MCE->emitInt32((intptr_t)Jit.getPointerToGlobal(Personality) -
MCE->getCurrentPCValue()); MCE->getCurrentPCValue());
MCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel); MCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
MCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel); MCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
} else { } else {
MCE->emitULEB128Bytes(1); MCE->emitULEB128Bytes(1);
MCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel); MCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
} }
std::vector<MachineMove> Moves; std::vector<MachineMove> Moves;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment