mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-22 10:24:26 +00:00
Fix bug in exception table allocation (PR13678)
Patch by Michael Muller. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172214 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -969,14 +969,24 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
|
||||
SavedBufferBegin = BufferBegin;
|
||||
SavedBufferEnd = BufferEnd;
|
||||
SavedCurBufferPtr = CurBufferPtr;
|
||||
uint8_t *FrameRegister;
|
||||
|
||||
BufferBegin = CurBufferPtr = MemMgr->startExceptionTable(F.getFunction(),
|
||||
ActualSize);
|
||||
BufferEnd = BufferBegin+ActualSize;
|
||||
EmittedFunctions[F.getFunction()].ExceptionTable = BufferBegin;
|
||||
uint8_t *EhStart;
|
||||
uint8_t *FrameRegister = DE->EmitDwarfTable(F, *this, FnStart, FnEnd,
|
||||
EhStart);
|
||||
while (true) {
|
||||
BufferBegin = CurBufferPtr = MemMgr->startExceptionTable(F.getFunction(),
|
||||
ActualSize);
|
||||
BufferEnd = BufferBegin+ActualSize;
|
||||
EmittedFunctions[F.getFunction()].ExceptionTable = BufferBegin;
|
||||
uint8_t *EhStart;
|
||||
FrameRegister = DE->EmitDwarfTable(F, *this, FnStart, FnEnd, EhStart);
|
||||
|
||||
// If the buffer was large enough to hold the table then we are done.
|
||||
if (CurBufferPtr != BufferEnd)
|
||||
break;
|
||||
|
||||
// Try again with twice as much space.
|
||||
ActualSize = (CurBufferPtr - BufferBegin) * 2;
|
||||
MemMgr->deallocateExceptionTable(BufferBegin);
|
||||
}
|
||||
MemMgr->endExceptionTable(F.getFunction(), BufferBegin, CurBufferPtr,
|
||||
FrameRegister);
|
||||
BufferBegin = SavedBufferBegin;
|
||||
|
Reference in New Issue
Block a user