mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 03:24:09 +00:00
Fixed alignment of code sections in the JIT mode. Added a test to the JITMemoryManager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185421 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -468,7 +468,11 @@ namespace {
|
||||
// Grow the required block size to account for the block header
|
||||
Size += sizeof(*CurBlock);
|
||||
|
||||
// FIXME: Alignement handling.
|
||||
// Alignment handling.
|
||||
if (!Alignment)
|
||||
Alignment = 16;
|
||||
Size += Alignment - 1;
|
||||
|
||||
FreeRangeHeader* candidateBlock = FreeMemoryList;
|
||||
FreeRangeHeader* head = FreeMemoryList;
|
||||
FreeRangeHeader* iter = head->Next;
|
||||
@ -500,7 +504,8 @@ namespace {
|
||||
FreeMemoryList = candidateBlock->AllocateBlock();
|
||||
// Release the memory at the end of this block that isn't needed.
|
||||
FreeMemoryList = CurBlock->TrimAllocationToSize(FreeMemoryList, Size);
|
||||
return (uint8_t *)(CurBlock + 1);
|
||||
uintptr_t unalignedAddr = (uintptr_t)CurBlock + sizeof(*CurBlock);
|
||||
return (uint8_t*)RoundUpToAlignment((uint64_t)unalignedAddr, Alignment);
|
||||
}
|
||||
|
||||
/// allocateDataSection - Allocate memory for a data section.
|
||||
|
Reference in New Issue
Block a user