[llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/Emitter.cpp

Reid Spencer reid at x10sys.com
Fri Sep 10 21:31:14 PDT 2004



Changes in directory llvm/lib/ExecutionEngine/JIT:

Emitter.cpp updated: 1.43 -> 1.44
---
Log message:

Convert the Emitter to use the lib/System "Memory" interface instead of the
old SystemUtils.h interface to allocate RWX blocks of memory.


---
Diffs of the changes:  (+5 -2)

Index: llvm/lib/ExecutionEngine/JIT/Emitter.cpp
diff -u llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.43 llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.44
--- llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.43	Wed Sep  1 17:55:35 2004
+++ llvm/lib/ExecutionEngine/JIT/Emitter.cpp	Fri Sep 10 23:31:03 2004
@@ -22,7 +22,8 @@
 #include "llvm/Target/TargetData.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/ADT/Statistic.h"
-#include "llvm/Support/SystemUtils.h"
+#include "llvm/System/Memory.h"
+
 using namespace llvm;
 
 namespace {
@@ -37,6 +38,7 @@
   /// are emitting is.  This never bothers to release the memory, because when
   /// we are ready to destroy the JIT, the program exits.
   class JITMemoryManager {
+    sys::Memory  MemBlock;       // Virtual memory block allocated RWX
     unsigned char *MemBase;      // Base of block of memory, start of stub mem
     unsigned char *FunctionBase; // Start of the function body area
     unsigned char *CurStubPtr, *CurFunctionPtr;
@@ -51,7 +53,8 @@
 
 JITMemoryManager::JITMemoryManager() {
   // Allocate a 16M block of memory...
-  MemBase = (unsigned char*)AllocateRWXMemory(16 << 20);
+  sys::Memory::AllocateRWX(MemBlock,(16 << 20));
+  MemBase = reinterpret_cast<unsigned char*>(MemBlock.base());
   FunctionBase = MemBase + 512*1024; // Use 512k for stubs
 
   // Allocate stubs backwards from the function base, allocate functions forward






More information about the llvm-commits mailing list