[PATCH] D134774: [llvm-jitlink] Only use delta-mapper when needed, always onor slab-size.

Lang Hames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 27 16:53:38 PDT 2022


lhames created this revision.
lhames added a reviewer: argentite.
Herald added a subscriber: StephenFan.
Herald added a project: All.
lhames requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The delta mapper should only be needed in -no-exec mode if the slab address or slab page size are set. Otherwise we can use the regular in-process mapper, just passing in the requested slab size (or a default).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134774

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


Index: llvm/tools/llvm-jitlink/llvm-jitlink.cpp
===================================================================
--- llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -801,23 +801,24 @@
 }
 
 static std::unique_ptr<JITLinkMemoryManager> createInProcessMemoryManager() {
-  if (!SlabAllocateSizeString.empty()) {
-    auto SlabSize = ExitOnErr(getSlabAllocSize(SlabAllocateSizeString));
 
+#ifdef _WIN32
+  size_t SlabSize = 1024 * 1024;
+#else
+  size_t SlabSize = 1024 * 1024 * 1024;
+#endif
+
+  if (!SlabAllocateSizeString.empty())
+    SlabSize = ExitOnErr(getSlabAllocSize(SlabAllocateSizeString));
+
+  if (NoExec && (SlabAddress || SlabPageSize))
     return ExitOnErr(
         MapperJITLinkMemoryManager::CreateWithMapper<InProcessDeltaMapper>(
             SlabSize));
-  }
 
-#ifdef _WIN32
   return ExitOnErr(
       MapperJITLinkMemoryManager::CreateWithMapper<InProcessMemoryMapper>(
-          1024 * 1024));
-#else
-  return ExitOnErr(
-      MapperJITLinkMemoryManager::CreateWithMapper<InProcessMemoryMapper>(
-          1024 * 1024 * 1024));
-#endif
+          SlabSize));
 }
 
 Expected<std::unique_ptr<jitlink::JITLinkMemoryManager>>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134774.463367.patch
Type: text/x-patch
Size: 1197 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220927/79587ebe/attachment.bin>


More information about the llvm-commits mailing list