[llvm-jitlink] Sink getPageSize call in Session::Create.
authorLang Hames <lhames@gmail.com>
Sat, 2 Oct 2021 18:28:14 +0000 (11:28 -0700)
committerLang Hames <lhames@gmail.com>
Sat, 2 Oct 2021 18:28:14 +0000 (11:28 -0700)
The page size for the host process is only needed in the in-process use case.

llvm/tools/llvm-jitlink/llvm-jitlink.cpp

index b521b89901a3d9e71a277e166837da38bc9545a9..ce97cc96e4531478f5dbbe04f90a41a154e523a8 100644 (file)
@@ -813,10 +813,6 @@ public:
 
 Expected<std::unique_ptr<Session>> Session::Create(Triple TT) {
 
-  auto PageSize = sys::Process::getPageSize();
-  if (!PageSize)
-    return PageSize.takeError();
-
   std::unique_ptr<ExecutorProcessControl> EPC;
   if (OutOfProcessExecutor.getNumOccurrences()) {
     /// If -oop-executor is passed then launch the executor.
@@ -832,6 +828,9 @@ Expected<std::unique_ptr<Session>> Session::Create(Triple TT) {
       return REPC.takeError();
   } else {
     /// Otherwise use SelfExecutorProcessControl to target the current process.
+    auto PageSize = sys::Process::getPageSize();
+    if (!PageSize)
+      return PageSize.takeError();
     EPC = std::make_unique<SelfExecutorProcessControl>(
         std::make_shared<SymbolStringPool>(), std::move(TT), *PageSize,
         createMemoryManager());