mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-20 10:24:12 +00:00
fix a tricky bug in the JIT global variable emitter, that was triggered when JITing a variable independently of a function. This lead to sharing memory memory between functions and GVs thus changing the value of a GV could change the code in execution. more details on the ML.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57900 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -298,7 +298,24 @@ namespace {
|
||||
// Release the memory at the end of this block that isn't needed.
|
||||
FreeMemoryList =CurBlock->TrimAllocationToSize(FreeMemoryList, BlockSize);
|
||||
}
|
||||
|
||||
|
||||
/// allocateSpace - Allocate a memory block of the given size.
|
||||
unsigned char *allocateSpace(intptr_t Size, unsigned Alignment) {
|
||||
CurBlock = FreeMemoryList;
|
||||
FreeMemoryList = FreeMemoryList->AllocateBlock();
|
||||
|
||||
unsigned char *result = (unsigned char *)CurBlock+1;
|
||||
|
||||
if (Alignment == 0) Alignment = 1;
|
||||
result = (unsigned char*)(((intptr_t)result+Alignment-1) &
|
||||
~(intptr_t)(Alignment-1));
|
||||
|
||||
uintptr_t BlockSize = result + Size - (unsigned char *)CurBlock;
|
||||
FreeMemoryList =CurBlock->TrimAllocationToSize(FreeMemoryList, BlockSize);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// startExceptionTable - Use startFunctionBody to allocate memory for the
|
||||
/// function's exception table.
|
||||
unsigned char* startExceptionTable(const Function* F,
|
||||
|
Reference in New Issue
Block a user