Change AllocateRWX/DeallocateRWX do not throw an exception.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29057 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2006-07-07 17:31:41 +00:00
parent a5c04d6806
commit c1780d2a0a

View File

@ -414,17 +414,17 @@ unsigned char *JITMemoryManager::allocateStub(unsigned StubSize) {
} }
sys::MemoryBlock JITMemoryManager::getNewMemoryBlock(unsigned size) { sys::MemoryBlock JITMemoryManager::getNewMemoryBlock(unsigned size) {
try { // Allocate a new block close to the last one.
// Allocate a new block close to the last one. const sys::MemoryBlock *BOld = Blocks.empty() ? 0 : &Blocks.front();
const sys::MemoryBlock *BOld = Blocks.empty() ? 0 : &Blocks.front(); std::string ErrMsg;
sys::MemoryBlock B = sys::Memory::AllocateRWX(size, BOld); sys::MemoryBlock B = sys::Memory::AllocateRWX(size, BOld, &ErrMsg);
Blocks.push_back(B); if (B.base() == 0) {
return B;
} catch (std::string &err) {
std::cerr << "Allocation failed when allocating new memory in the JIT\n"; std::cerr << "Allocation failed when allocating new memory in the JIT\n";
std::cerr << err << "\n"; std::cerr << ErrMsg << "\n";
abort(); abort();
} }
Blocks.push_back(B);
return B;
} }
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//