[llvm] 22f8276 - [llvm-jitlink] Add more information about allocation failures.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 27 18:02:21 PDT 2021


Author: Lang Hames
Date: 2021-09-27T18:02:06-07:00
New Revision: 22f8276fe429765cefadc236f4bc91cb26211935

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

LOG: [llvm-jitlink] Add more information about allocation failures.

Slab allocator failures will now report requested size and remaining capacity.

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 37870b3ec42b..5a4898c3d598 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -437,7 +437,12 @@ class JITLinkSlabAllocator final : public JITLinkMemoryManager {
       uint64_t SlabRemainingSize = SlabRemaining.allocatedSize();
 
       if (SegmentSize > SlabRemainingSize)
-        return make_error<StringError>("Slab allocator out of memory",
+        return make_error<StringError>("Slab allocator out of memory: "
+                                       "request for " +
+                                       formatv("{0:x}", SegmentSize) +
+                                       " bytes exceeds remaining capacity of " +
+                                       formatv("{0:x}", SlabRemainingSize) +
+                                       " bytes",
                                        inconvertibleErrorCode());
 
       sys::MemoryBlock SegMem(SlabBase, SegmentSize);


        


More information about the llvm-commits mailing list