Orc] Drop PageSize member from Orc architecture support class in favour of
authorLang Hames <lhames@gmail.com>
Mon, 11 Jan 2016 02:41:17 +0000 (02:41 +0000)
committerLang Hames <lhames@gmail.com>
Mon, 11 Jan 2016 02:41:17 +0000 (02:41 +0000)
Process::getPageSize() - the former is redundant.

NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257310 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
include/llvm/ExecutionEngine/Orc/OrcArchitectureSupport.h
include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h

index 900fe1a..e17630f 100644 (file)
@@ -22,6 +22,7 @@
 #include "llvm/IR/Mangler.h"
 #include "llvm/IR/Module.h"
 #include "llvm/Transforms/Utils/ValueMapper.h"
+#include "llvm/Support/Process.h"
 #include <sstream>
 
 namespace llvm {
@@ -179,14 +180,15 @@ private:
     std::error_code EC;
     auto TrampolineBlock =
       sys::OwningMemoryBlock(
-        sys::Memory::allocateMappedMemory(TargetT::PageSize, nullptr,
+        sys::Memory::allocateMappedMemory(sys::Process::getPageSize(), nullptr,
                                           sys::Memory::MF_READ |
                                           sys::Memory::MF_WRITE, EC));
     assert(!EC && "Failed to allocate trampoline block");
 
 
     unsigned NumTrampolines =
-      (TargetT::PageSize - TargetT::PointerSize) / TargetT::TrampolineSize;
+      (sys::Process::getPageSize() - TargetT::PointerSize) /
+        TargetT::TrampolineSize;
 
     uint8_t *TrampolineMem = static_cast<uint8_t*>(TrampolineBlock.base());
     TargetT::writeTrampolines(TrampolineMem, ResolverBlock.base(),
index ec27b4c..cd93421 100644 (file)
 
 #include "IndirectionUtils.h"
 #include "llvm/Support/Memory.h"
+#include "llvm/Support/Process.h"
 
 namespace llvm {
 namespace orc {
 
 class OrcX86_64 {
 public:
-  static const unsigned PageSize = 4096;
   static const unsigned PointerSize = 8;
   static const unsigned TrampolineSize = 8;
   static const unsigned ResolverCodeSize = 0x78;
@@ -51,7 +51,6 @@ public:
     friend class OrcX86_64;
   public:
     const static unsigned StubSize = 8;
-    const static unsigned PtrSize = 8;
 
     IndirectStubsInfo() : NumStubs(0) {}
     IndirectStubsInfo(IndirectStubsInfo &&Other)
index 4b4ecfc..af4eb8e 100644 (file)
@@ -325,13 +325,14 @@ private:
 
     auto TrampolineBlock =
         sys::OwningMemoryBlock(sys::Memory::allocateMappedMemory(
-            TargetT::PageSize, nullptr,
+            sys::Process::getPageSize(), nullptr,
             sys::Memory::MF_READ | sys::Memory::MF_WRITE, EC));
     if (EC)
       return EC;
 
     unsigned NumTrampolines =
-        (TargetT::PageSize - TargetT::PointerSize) / TargetT::TrampolineSize;
+        (sys::Process::getPageSize() - TargetT::PointerSize) /
+        TargetT::TrampolineSize;
 
     uint8_t *TrampolineMem = static_cast<uint8_t *>(TrampolineBlock.base());
     TargetT::writeTrampolines(TrampolineMem, ResolverBlock.base(),