summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-03-28 08:53:08 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-03-28 08:53:08 +0000
commitec90ab499d42cdb24bcb9c4a425c2d3789e077bc (patch)
tree2ffcb12ae208734007152bca017798aadedf2763 /lib/ExecutionEngine/JIT/JITMemoryManager.cpp
parent2559cde2e88ea9ee8303e74469910677fb8f39c5 (diff)
downloadllvm-ec90ab499d42cdb24bcb9c4a425c2d3789e077bc.tar.gz
llvm-ec90ab499d42cdb24bcb9c4a425c2d3789e077bc.tar.bz2
llvm-ec90ab499d42cdb24bcb9c4a425c2d3789e077bc.tar.xz
[cleanup] Hoist the initialization and constants for slab sizes to the
top of the default jit memory manager. This will allow them to be used as template parameters rather than runtime parameters in a subsequent commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204992 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/JIT/JITMemoryManager.cpp')
-rw-r--r--lib/ExecutionEngine/JIT/JITMemoryManager.cpp37
1 files changed, 17 insertions, 20 deletions
diff --git a/lib/ExecutionEngine/JIT/JITMemoryManager.cpp b/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
index 6ae738373c..1cfed2803b 100644
--- a/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
+++ b/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
@@ -285,7 +285,21 @@ namespace {
/// middle of emitting a function, and we don't know how large the function we
/// are emitting is.
class DefaultJITMemoryManager : public JITMemoryManager {
+ public:
+ /// DefaultCodeSlabSize - When we have to go map more memory, we allocate at
+ /// least this much unless more is requested. Currently, in 512k slabs.
+ static const size_t DefaultCodeSlabSize = 512 * 1024;
+
+ /// DefaultSlabSize - Allocate globals and stubs into slabs of 64K (probably
+ /// 16 pages) unless we get an allocation above SizeThreshold.
+ static const size_t DefaultSlabSize = 64 * 1024;
+ /// DefaultSizeThreshold - For any allocation larger than 16K (probably
+ /// 4 pages), we should allocate a separate slab to avoid wasted space at
+ /// the end of a normal slab.
+ static const size_t DefaultSizeThreshold = 16 * 1024;
+
+ private:
// Whether to poison freed memory.
bool PoisonMemory;
@@ -318,18 +332,6 @@ namespace {
/// last slab it allocated, so that subsequent allocations follow it.
sys::MemoryBlock allocateNewSlab(size_t size);
- /// DefaultCodeSlabSize - When we have to go map more memory, we allocate at
- /// least this much unless more is requested.
- static const size_t DefaultCodeSlabSize;
-
- /// DefaultSlabSize - Allocate data into slabs of this size unless we get
- /// an allocation above SizeThreshold.
- static const size_t DefaultSlabSize;
-
- /// DefaultSizeThreshold - For any allocation larger than this threshold, we
- /// should allocate a separate slab.
- static const size_t DefaultSizeThreshold;
-
/// getPointerToNamedFunction - This method returns the address of the
/// specified function by using the dlsym function call.
void *getPointerToNamedFunction(const std::string &Name,
@@ -902,11 +904,6 @@ JITMemoryManager *JITMemoryManager::CreateDefaultMemManager() {
return new DefaultJITMemoryManager();
}
-// Allocate memory for code in 512K slabs.
-const size_t DefaultJITMemoryManager::DefaultCodeSlabSize = 512 * 1024;
-
-// Allocate globals and stubs in slabs of 64K. (probably 16 pages)
-const size_t DefaultJITMemoryManager::DefaultSlabSize = 64 * 1024;
-
-// Waste at most 16K at the end of each bump slab. (probably 4 pages)
-const size_t DefaultJITMemoryManager::DefaultSizeThreshold = 16 * 1024;
+const size_t DefaultJITMemoryManager::DefaultCodeSlabSize;
+const size_t DefaultJITMemoryManager::DefaultSlabSize;
+const size_t DefaultJITMemoryManager::DefaultSizeThreshold;