Change AllocateRWX/DeallocateRWX do not throw an exception.
authorChris Lattner <sabre@nondot.org>
Fri, 7 Jul 2006 17:31:41 +0000 (17:31 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 7 Jul 2006 17:31:41 +0000 (17:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29057 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/JIT/JITEmitter.cpp

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