[llvm] d9152a8 - [llvm-jitlink] Sink getPageSize call in Session::Create.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 2 11:29:45 PDT 2021


Author: Lang Hames
Date: 2021-10-02T11:28:14-07:00
New Revision: d9152a85712ab1a05edc84acbc7623fd3915c5d6

URL: https://github.com/llvm/llvm-project/commit/d9152a85712ab1a05edc84acbc7623fd3915c5d6
DIFF: https://github.com/llvm/llvm-project/commit/d9152a85712ab1a05edc84acbc7623fd3915c5d6.diff

LOG: [llvm-jitlink] Sink getPageSize call in Session::Create.

The page size for the host process is only needed in the in-process use case.

Added: 
    

Modified: 
    llvm/tools/llvm-jitlink/llvm-jitlink.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index b521b89901a3d..ce97cc96e4531 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -813,10 +813,6 @@ class PhonyExternalsGenerator : public DefinitionGenerator {
 
 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());


        


More information about the llvm-commits mailing list