Revert 72650

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72783 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bruno Cardoso Lopes 2009-06-03 16:55:02 +00:00
parent 974d90bb70
commit bae049cd9e
5 changed files with 117 additions and 113 deletions

View File

@ -89,7 +89,7 @@ public:
/// emitByte - This callback is invoked when a byte needs to be written to the
/// output stream.
///
void emitByte(uint8_t B) {
void emitByte(unsigned char B) {
if (CurBufferPtr != BufferEnd)
*CurBufferPtr++ = B;
}
@ -99,10 +99,10 @@ public:
///
void emitWordLE(unsigned W) {
if (4 <= BufferEnd-CurBufferPtr) {
*CurBufferPtr++ = (uint8_t)(W >> 0);
*CurBufferPtr++ = (uint8_t)(W >> 8);
*CurBufferPtr++ = (uint8_t)(W >> 16);
*CurBufferPtr++ = (uint8_t)(W >> 24);
*CurBufferPtr++ = (unsigned char)(W >> 0);
*CurBufferPtr++ = (unsigned char)(W >> 8);
*CurBufferPtr++ = (unsigned char)(W >> 16);
*CurBufferPtr++ = (unsigned char)(W >> 24);
} else {
CurBufferPtr = BufferEnd;
}
@ -113,10 +113,10 @@ public:
///
void emitWordBE(unsigned W) {
if (4 <= BufferEnd-CurBufferPtr) {
*CurBufferPtr++ = (uint8_t)(W >> 24);
*CurBufferPtr++ = (uint8_t)(W >> 16);
*CurBufferPtr++ = (uint8_t)(W >> 8);
*CurBufferPtr++ = (uint8_t)(W >> 0);
*CurBufferPtr++ = (unsigned char)(W >> 24);
*CurBufferPtr++ = (unsigned char)(W >> 16);
*CurBufferPtr++ = (unsigned char)(W >> 8);
*CurBufferPtr++ = (unsigned char)(W >> 0);
} else {
CurBufferPtr = BufferEnd;
}
@ -127,14 +127,14 @@ public:
///
void emitDWordLE(uint64_t W) {
if (8 <= BufferEnd-CurBufferPtr) {
*CurBufferPtr++ = (uint8_t)(W >> 0);
*CurBufferPtr++ = (uint8_t)(W >> 8);
*CurBufferPtr++ = (uint8_t)(W >> 16);
*CurBufferPtr++ = (uint8_t)(W >> 24);
*CurBufferPtr++ = (uint8_t)(W >> 32);
*CurBufferPtr++ = (uint8_t)(W >> 40);
*CurBufferPtr++ = (uint8_t)(W >> 48);
*CurBufferPtr++ = (uint8_t)(W >> 56);
*CurBufferPtr++ = (unsigned char)(W >> 0);
*CurBufferPtr++ = (unsigned char)(W >> 8);
*CurBufferPtr++ = (unsigned char)(W >> 16);
*CurBufferPtr++ = (unsigned char)(W >> 24);
*CurBufferPtr++ = (unsigned char)(W >> 32);
*CurBufferPtr++ = (unsigned char)(W >> 40);
*CurBufferPtr++ = (unsigned char)(W >> 48);
*CurBufferPtr++ = (unsigned char)(W >> 56);
} else {
CurBufferPtr = BufferEnd;
}
@ -145,14 +145,14 @@ public:
///
void emitDWordBE(uint64_t W) {
if (8 <= BufferEnd-CurBufferPtr) {
*CurBufferPtr++ = (uint8_t)(W >> 56);
*CurBufferPtr++ = (uint8_t)(W >> 48);
*CurBufferPtr++ = (uint8_t)(W >> 40);
*CurBufferPtr++ = (uint8_t)(W >> 32);
*CurBufferPtr++ = (uint8_t)(W >> 24);
*CurBufferPtr++ = (uint8_t)(W >> 16);
*CurBufferPtr++ = (uint8_t)(W >> 8);
*CurBufferPtr++ = (uint8_t)(W >> 0);
*CurBufferPtr++ = (unsigned char)(W >> 56);
*CurBufferPtr++ = (unsigned char)(W >> 48);
*CurBufferPtr++ = (unsigned char)(W >> 40);
*CurBufferPtr++ = (unsigned char)(W >> 32);
*CurBufferPtr++ = (unsigned char)(W >> 24);
*CurBufferPtr++ = (unsigned char)(W >> 16);
*CurBufferPtr++ = (unsigned char)(W >> 8);
*CurBufferPtr++ = (unsigned char)(W >> 0);
} else {
CurBufferPtr = BufferEnd;
}
@ -166,8 +166,8 @@ public:
if(Alignment <= (uintptr_t)(BufferEnd-CurBufferPtr)) {
// Move the current buffer ptr up to the specified alignment.
CurBufferPtr =
(uint8_t*)(((uintptr_t)CurBufferPtr+Alignment-1) &
~(uintptr_t)(Alignment-1));
(unsigned char*)(((uintptr_t)CurBufferPtr+Alignment-1) &
~(uintptr_t)(Alignment-1));
} else {
CurBufferPtr = BufferEnd;
}
@ -178,7 +178,7 @@ public:
/// written to the output stream.
void emitULEB128Bytes(unsigned Value) {
do {
uint8_t Byte = Value & 0x7f;
unsigned char Byte = Value & 0x7f;
Value >>= 7;
if (Value) Byte |= 0x80;
emitByte(Byte);
@ -187,12 +187,12 @@ public:
/// emitSLEB128Bytes - This callback is invoked when a SLEB128 needs to be
/// written to the output stream.
void emitSLEB128Bytes(int32_t Value) {
int32_t Sign = Value >> (8 * sizeof(Value) - 1);
void emitSLEB128Bytes(int Value) {
int Sign = Value >> (8 * sizeof(Value) - 1);
bool IsMore;
do {
uint8_t Byte = Value & 0x7f;
unsigned char Byte = Value & 0x7f;
Value >>= 7;
IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;
if (IsMore) Byte |= 0x80;
@ -205,14 +205,14 @@ public:
void emitString(const std::string &String) {
for (unsigned i = 0, N = static_cast<unsigned>(String.size());
i < N; ++i) {
uint8_t C = String[i];
unsigned char C = String[i];
emitByte(C);
}
emitByte(0);
}
/// emitInt32 - Emit a int32 directive.
void emitInt32(int32_t Value) {
void emitInt32(int Value) {
if (4 <= BufferEnd-CurBufferPtr) {
*((uint32_t*)CurBufferPtr) = Value;
CurBufferPtr += 4;

View File

@ -50,14 +50,14 @@ class MachineCodeEmitter {
protected:
/// BufferBegin/BufferEnd - Pointers to the start and end of the memory
/// allocated for this code buffer.
uint8_t *BufferBegin, *BufferEnd;
unsigned char *BufferBegin, *BufferEnd;
/// CurBufferPtr - Pointer to the next byte of memory to fill when emitting
/// code. This is guranteed to be in the range [BufferBegin,BufferEnd]. If
/// this pointer is at BufferEnd, it will never move due to code emission, and
/// all code emission requests will be ignored (this is the buffer overflow
/// condition).
uint8_t *CurBufferPtr;
unsigned char *CurBufferPtr;
public:
virtual ~MachineCodeEmitter() {}
@ -96,7 +96,7 @@ public:
/// emitByte - This callback is invoked when a byte needs to be written to the
/// output stream.
///
void emitByte(uint8_t B) {
void emitByte(unsigned char B) {
if (CurBufferPtr != BufferEnd)
*CurBufferPtr++ = B;
}
@ -106,10 +106,10 @@ public:
///
void emitWordLE(unsigned W) {
if (4 <= BufferEnd-CurBufferPtr) {
*CurBufferPtr++ = (uint8_t)(W >> 0);
*CurBufferPtr++ = (uint8_t)(W >> 8);
*CurBufferPtr++ = (uint8_t)(W >> 16);
*CurBufferPtr++ = (uint8_t)(W >> 24);
*CurBufferPtr++ = (unsigned char)(W >> 0);
*CurBufferPtr++ = (unsigned char)(W >> 8);
*CurBufferPtr++ = (unsigned char)(W >> 16);
*CurBufferPtr++ = (unsigned char)(W >> 24);
} else {
CurBufferPtr = BufferEnd;
}
@ -120,10 +120,10 @@ public:
///
void emitWordBE(unsigned W) {
if (4 <= BufferEnd-CurBufferPtr) {
*CurBufferPtr++ = (uint8_t)(W >> 24);
*CurBufferPtr++ = (uint8_t)(W >> 16);
*CurBufferPtr++ = (uint8_t)(W >> 8);
*CurBufferPtr++ = (uint8_t)(W >> 0);
*CurBufferPtr++ = (unsigned char)(W >> 24);
*CurBufferPtr++ = (unsigned char)(W >> 16);
*CurBufferPtr++ = (unsigned char)(W >> 8);
*CurBufferPtr++ = (unsigned char)(W >> 0);
} else {
CurBufferPtr = BufferEnd;
}
@ -134,14 +134,14 @@ public:
///
void emitDWordLE(uint64_t W) {
if (8 <= BufferEnd-CurBufferPtr) {
*CurBufferPtr++ = (uint8_t)(W >> 0);
*CurBufferPtr++ = (uint8_t)(W >> 8);
*CurBufferPtr++ = (uint8_t)(W >> 16);
*CurBufferPtr++ = (uint8_t)(W >> 24);
*CurBufferPtr++ = (uint8_t)(W >> 32);
*CurBufferPtr++ = (uint8_t)(W >> 40);
*CurBufferPtr++ = (uint8_t)(W >> 48);
*CurBufferPtr++ = (uint8_t)(W >> 56);
*CurBufferPtr++ = (unsigned char)(W >> 0);
*CurBufferPtr++ = (unsigned char)(W >> 8);
*CurBufferPtr++ = (unsigned char)(W >> 16);
*CurBufferPtr++ = (unsigned char)(W >> 24);
*CurBufferPtr++ = (unsigned char)(W >> 32);
*CurBufferPtr++ = (unsigned char)(W >> 40);
*CurBufferPtr++ = (unsigned char)(W >> 48);
*CurBufferPtr++ = (unsigned char)(W >> 56);
} else {
CurBufferPtr = BufferEnd;
}
@ -152,14 +152,14 @@ public:
///
void emitDWordBE(uint64_t W) {
if (8 <= BufferEnd-CurBufferPtr) {
*CurBufferPtr++ = (uint8_t)(W >> 56);
*CurBufferPtr++ = (uint8_t)(W >> 48);
*CurBufferPtr++ = (uint8_t)(W >> 40);
*CurBufferPtr++ = (uint8_t)(W >> 32);
*CurBufferPtr++ = (uint8_t)(W >> 24);
*CurBufferPtr++ = (uint8_t)(W >> 16);
*CurBufferPtr++ = (uint8_t)(W >> 8);
*CurBufferPtr++ = (uint8_t)(W >> 0);
*CurBufferPtr++ = (unsigned char)(W >> 56);
*CurBufferPtr++ = (unsigned char)(W >> 48);
*CurBufferPtr++ = (unsigned char)(W >> 40);
*CurBufferPtr++ = (unsigned char)(W >> 32);
*CurBufferPtr++ = (unsigned char)(W >> 24);
*CurBufferPtr++ = (unsigned char)(W >> 16);
*CurBufferPtr++ = (unsigned char)(W >> 8);
*CurBufferPtr++ = (unsigned char)(W >> 0);
} else {
CurBufferPtr = BufferEnd;
}
@ -173,8 +173,8 @@ public:
if(Alignment <= (uintptr_t)(BufferEnd-CurBufferPtr)) {
// Move the current buffer ptr up to the specified alignment.
CurBufferPtr =
(uint8_t*)(((uintptr_t)CurBufferPtr+Alignment-1) &
~(uintptr_t)(Alignment-1));
(unsigned char*)(((uintptr_t)CurBufferPtr+Alignment-1) &
~(uintptr_t)(Alignment-1));
} else {
CurBufferPtr = BufferEnd;
}
@ -185,7 +185,7 @@ public:
/// written to the output stream.
void emitULEB128Bytes(unsigned Value) {
do {
uint8_t Byte = Value & 0x7f;
unsigned char Byte = Value & 0x7f;
Value >>= 7;
if (Value) Byte |= 0x80;
emitByte(Byte);
@ -194,12 +194,12 @@ public:
/// emitSLEB128Bytes - This callback is invoked when a SLEB128 needs to be
/// written to the output stream.
void emitSLEB128Bytes(int32_t Value) {
int32_t Sign = Value >> (8 * sizeof(Value) - 1);
void emitSLEB128Bytes(int Value) {
int Sign = Value >> (8 * sizeof(Value) - 1);
bool IsMore;
do {
uint8_t Byte = Value & 0x7f;
unsigned char Byte = Value & 0x7f;
Value >>= 7;
IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;
if (IsMore) Byte |= 0x80;
@ -212,14 +212,14 @@ public:
void emitString(const std::string &String) {
for (unsigned i = 0, N = static_cast<unsigned>(String.size());
i < N; ++i) {
uint8_t C = String[i];
unsigned char C = String[i];
emitByte(C);
}
emitByte(0);
}
/// emitInt32 - Emit a int32 directive.
void emitInt32(int32_t Value) {
void emitInt32(int Value) {
if (4 <= BufferEnd-CurBufferPtr) {
*((uint32_t*)CurBufferPtr) = Value;
CurBufferPtr += 4;

View File

@ -60,7 +60,7 @@ public:
/// getGOTBase - If this is managing a Global Offset Table, this method should
/// return a pointer to its base.
virtual uint8_t *getGOTBase() const = 0;
virtual unsigned char *getGOTBase() const = 0;
/// SetDlsymTable - If the JIT must be able to relocate stubs after they have
/// been emitted, potentially because they are being copied to a process
@ -89,8 +89,8 @@ public:
/// emit the function, so it doesn't pass in the size. Instead, this method
/// is required to pass back a "valid size". The JIT will be careful to not
/// write more than the returned ActualSize bytes of memory.
virtual uint8_t *startFunctionBody(const Function *F,
uintptr_t &ActualSize) = 0;
virtual unsigned char *startFunctionBody(const Function *F,
uintptr_t &ActualSize) = 0;
/// allocateStub - This method is called by the JIT to allocate space for a
/// function stub (used to handle limited branch displacements) while it is
@ -100,8 +100,9 @@ public:
/// thunk for it. The stub should be "close" to the current function body,
/// but should not be included in the 'actualsize' returned by
/// startFunctionBody.
virtual uint8_t *allocateStub(const GlobalValue* F, unsigned StubSize,
unsigned Alignment) = 0;
virtual unsigned char *allocateStub(const GlobalValue* F, unsigned StubSize,
unsigned Alignment) =0;
/// endFunctionBody - This method is called when the JIT is done codegen'ing
/// the specified function. At this point we know the size of the JIT
@ -109,11 +110,11 @@ public:
/// the startFunctionBody method) and FunctionEnd which is a pointer to the
/// actual end of the function. This method should mark the space allocated
/// and remember where it is in case the client wants to deallocate it.
virtual void endFunctionBody(const Function *F, uint8_t *FunctionStart,
uint8_t *FunctionEnd) = 0;
virtual void endFunctionBody(const Function *F, unsigned char *FunctionStart,
unsigned char *FunctionEnd) = 0;
/// allocateSpace - Allocate a memory block of the given size.
virtual uint8_t *allocateSpace(intptr_t Size, unsigned Alignment) = 0;
virtual unsigned char *allocateSpace(intptr_t Size, unsigned Alignment) = 0;
/// deallocateMemForFunction - Free JIT memory for the specified function.
/// This is never called when the JIT is currently emitting a function.
@ -121,13 +122,14 @@ public:
/// startExceptionTable - When we finished JITing the function, if exception
/// handling is set, we emit the exception table.
virtual uint8_t* startExceptionTable(const Function* F,
uintptr_t &ActualSize) = 0;
virtual unsigned char* startExceptionTable(const Function* F,
uintptr_t &ActualSize) = 0;
/// endExceptionTable - This method is called when the JIT is done emitting
/// the exception table.
virtual void endExceptionTable(const Function *F, uint8_t *TableStart,
uint8_t *TableEnd, uint8_t* FrameRegister) = 0;
virtual void endExceptionTable(const Function *F, unsigned char *TableStart,
unsigned char *TableEnd,
unsigned char* FrameRegister) = 0;
};
} // end namespace llvm.

View File

@ -551,7 +551,7 @@ namespace {
// When outputting a function stub in the context of some other function, we
// save BufferBegin/BufferEnd/CurBufferPtr here.
uint8_t *SavedBufferBegin, *SavedBufferEnd, *SavedCurBufferPtr;
unsigned char *SavedBufferBegin, *SavedBufferEnd, *SavedCurBufferPtr;
/// Relocations - These are the relocations that the function needs, as
/// emitted.
@ -1056,11 +1056,11 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
// FnStart is the start of the text, not the start of the constant pool and
// other per-function data.
uint8_t *FnStart =
(uint8_t *)TheJIT->getPointerToGlobalIfAvailable(F.getFunction());
unsigned char *FnStart =
(unsigned char *)TheJIT->getPointerToGlobalIfAvailable(F.getFunction());
// FnEnd is the end of the function's machine code.
uint8_t *FnEnd = CurBufferPtr;
unsigned char *FnEnd = CurBufferPtr;
if (!Relocations.empty()) {
CurFn = F.getFunction();
@ -1183,7 +1183,7 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
} else {
DOUT << "JIT: Binary code:\n";
DOUT << std::hex;
uint8_t* q = FnStart;
unsigned char* q = FnStart;
for (int i = 0; q < FnEnd; q += 4, ++i) {
if (i == 4)
i = 0;
@ -1221,7 +1221,7 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
BufferBegin = CurBufferPtr = MemMgr->startExceptionTable(F.getFunction(),
ActualSize);
BufferEnd = BufferBegin+ActualSize;
uint8_t* FrameRegister = DE->EmitDwarfTable(F, *this, FnStart, FnEnd);
unsigned char* FrameRegister = DE->EmitDwarfTable(F, *this, FnStart, FnEnd);
MemMgr->endExceptionTable(F.getFunction(), BufferBegin, CurBufferPtr,
FrameRegister);
BufferBegin = SavedBufferBegin;
@ -1416,7 +1416,7 @@ void JITEmitter::startGVStub(const GlobalValue* GV, void *Buffer,
SavedBufferEnd = BufferEnd;
SavedCurBufferPtr = CurBufferPtr;
BufferBegin = CurBufferPtr = (uint8_t *)Buffer;
BufferBegin = CurBufferPtr = (unsigned char *)Buffer;
BufferEnd = BufferBegin+StubSize+1;
}

View File

@ -257,9 +257,9 @@ namespace {
// When emitting code into a memory block, this is the block.
MemoryRangeHeader *CurBlock;
uint8_t *CurStubPtr, *StubBase;
uint8_t *GOTBase; // Target Specific reserved memory
void *DlsymTable; // Stub external symbol information
unsigned char *CurStubPtr, *StubBase;
unsigned char *GOTBase; // Target Specific reserved memory
void *DlsymTable; // Stub external symbol information
// Centralize memory block allocation.
sys::MemoryBlock getNewMemoryBlock(unsigned size);
@ -273,12 +273,12 @@ namespace {
void AllocateGOT();
void SetDlsymTable(void *);
uint8_t *allocateStub(const GlobalValue* F, unsigned StubSize,
unsigned Alignment);
unsigned char *allocateStub(const GlobalValue* F, unsigned StubSize,
unsigned Alignment);
/// startFunctionBody - When a function starts, allocate a block of free
/// executable memory, returning a pointer to it and its actual size.
uint8_t *startFunctionBody(const Function *F, uintptr_t &ActualSize) {
unsigned char *startFunctionBody(const Function *F, uintptr_t &ActualSize) {
FreeRangeHeader* candidateBlock = FreeMemoryList;
FreeRangeHeader* head = FreeMemoryList;
@ -301,18 +301,18 @@ namespace {
// Allocate the entire memory block.
FreeMemoryList = candidateBlock->AllocateBlock();
ActualSize = CurBlock->BlockSize-sizeof(MemoryRangeHeader);
return (uint8_t *)(CurBlock+1);
return (unsigned char *)(CurBlock+1);
}
/// endFunctionBody - The function F is now allocated, and takes the memory
/// in the range [FunctionStart,FunctionEnd).
void endFunctionBody(const Function *F, uint8_t *FunctionStart,
uint8_t *FunctionEnd) {
void endFunctionBody(const Function *F, unsigned char *FunctionStart,
unsigned char *FunctionEnd) {
assert(FunctionEnd > FunctionStart);
assert(FunctionStart == (uint8_t *)(CurBlock+1) &&
assert(FunctionStart == (unsigned char *)(CurBlock+1) &&
"Mismatched function start/end!");
uintptr_t BlockSize = FunctionEnd - (uint8_t *)CurBlock;
uintptr_t BlockSize = FunctionEnd - (unsigned char *)CurBlock;
FunctionBlocks[F] = CurBlock;
// Release the memory at the end of this block that isn't needed.
@ -320,17 +320,17 @@ namespace {
}
/// allocateSpace - Allocate a memory block of the given size.
uint8_t *allocateSpace(intptr_t Size, unsigned Alignment) {
unsigned char *allocateSpace(intptr_t Size, unsigned Alignment) {
CurBlock = FreeMemoryList;
FreeMemoryList = FreeMemoryList->AllocateBlock();
uint8_t *result = (uint8_t *)CurBlock+1;
unsigned char *result = (unsigned char *)CurBlock+1;
if (Alignment == 0) Alignment = 1;
result = (uint8_t*)(((intptr_t)result+Alignment-1) &
result = (unsigned char*)(((intptr_t)result+Alignment-1) &
~(intptr_t)(Alignment-1));
uintptr_t BlockSize = result + Size - (uint8_t *)CurBlock;
uintptr_t BlockSize = result + Size - (unsigned char *)CurBlock;
FreeMemoryList =CurBlock->TrimAllocationToSize(FreeMemoryList, BlockSize);
return result;
@ -338,26 +338,28 @@ namespace {
/// startExceptionTable - Use startFunctionBody to allocate memory for the
/// function's exception table.
uint8_t* startExceptionTable(const Function* F, uintptr_t &ActualSize) {
unsigned char* startExceptionTable(const Function* F,
uintptr_t &ActualSize) {
return startFunctionBody(F, ActualSize);
}
/// endExceptionTable - The exception table of F is now allocated,
/// and takes the memory in the range [TableStart,TableEnd).
void endExceptionTable(const Function *F, uint8_t *TableStart,
uint8_t *TableEnd, uint8_t* FrameRegister) {
void endExceptionTable(const Function *F, unsigned char *TableStart,
unsigned char *TableEnd,
unsigned char* FrameRegister) {
assert(TableEnd > TableStart);
assert(TableStart == (uint8_t *)(CurBlock+1) &&
assert(TableStart == (unsigned char *)(CurBlock+1) &&
"Mismatched table start/end!");
uintptr_t BlockSize = TableEnd - (uint8_t *)CurBlock;
uintptr_t BlockSize = TableEnd - (unsigned char *)CurBlock;
TableBlocks[F] = CurBlock;
// Release the memory at the end of this block that isn't needed.
FreeMemoryList =CurBlock->TrimAllocationToSize(FreeMemoryList, BlockSize);
}
uint8_t *getGOTBase() const {
unsigned char *getGOTBase() const {
return GOTBase;
}
@ -431,7 +433,7 @@ DefaultJITMemoryManager::DefaultJITMemoryManager() {
sys::MemoryBlock MemBlock = getNewMemoryBlock(16 << 20);
#endif
uint8_t *MemBase = static_cast<uint8_t*>(MemBlock.base());
unsigned char *MemBase = static_cast<unsigned char*>(MemBlock.base());
// Allocate stubs backwards from the base, allocate functions forward
// from the base.
@ -490,7 +492,7 @@ DefaultJITMemoryManager::DefaultJITMemoryManager() {
void DefaultJITMemoryManager::AllocateGOT() {
assert(GOTBase == 0 && "Cannot allocate the got multiple times");
GOTBase = new uint8_t[sizeof(void*) * 8192];
GOTBase = new unsigned char[sizeof(void*) * 8192];
HasGOT = true;
}
@ -506,12 +508,12 @@ DefaultJITMemoryManager::~DefaultJITMemoryManager() {
Blocks.clear();
}
uint8_t *DefaultJITMemoryManager::allocateStub(const GlobalValue* F,
unsigned char *DefaultJITMemoryManager::allocateStub(const GlobalValue* F,
unsigned StubSize,
unsigned Alignment) {
CurStubPtr -= StubSize;
CurStubPtr = (uint8_t*)(((intptr_t)CurStubPtr) &
~(intptr_t)(Alignment-1));
CurStubPtr = (unsigned char*)(((intptr_t)CurStubPtr) &
~(intptr_t)(Alignment-1));
if (CurStubPtr < StubBase) {
// FIXME: allocate a new block
fprintf(stderr, "JIT ran out of memory for function stubs!\n");