diff options
author | MartinNowack <martin.nowack@gmail.com> | 2016-07-09 00:37:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-09 00:37:31 +0200 |
commit | e87e5bd478d8dad5a7c164197b9e39da3873442d (patch) | |
tree | 871185f3c85fcdf3f626cb39db642534308c5a6f /lib/Core/MemoryManager.h | |
parent | f4363713c97769f392b7d85c4782f6e1aeb1a137 (diff) | |
parent | 05a0962a50fede85aae254667d5dac1586744eb3 (diff) | |
download | klee-e87e5bd478d8dad5a7c164197b9e39da3873442d.tar.gz |
Merge pull request #363 from MartinNowack/feat_determ_allocator
Add support for deterministic allocation
Diffstat (limited to 'lib/Core/MemoryManager.h')
-rw-r--r-- | lib/Core/MemoryManager.h | 57 |
1 files changed, 35 insertions, 22 deletions
diff --git a/lib/Core/MemoryManager.h b/lib/Core/MemoryManager.h index 01683443..fc77b476 100644 --- a/lib/Core/MemoryManager.h +++ b/lib/Core/MemoryManager.h @@ -14,31 +14,44 @@ #include <stdint.h> namespace llvm { - class Value; +class Value; } namespace klee { - class MemoryObject; - class ArrayCache; - - class MemoryManager { - private: - typedef std::set<MemoryObject*> objects_ty; - objects_ty objects; - ArrayCache *const arrayCache; - - public: - MemoryManager(ArrayCache *arrayCache) : arrayCache(arrayCache) {} - ~MemoryManager(); - - MemoryObject *allocate(uint64_t size, bool isLocal, bool isGlobal, - const llvm::Value *allocSite); - MemoryObject *allocateFixed(uint64_t address, uint64_t size, - const llvm::Value *allocSite); - void deallocate(const MemoryObject *mo); - void markFreed(MemoryObject *mo); - ArrayCache *getArrayCache() const { return arrayCache; } - }; +class MemoryObject; +class ArrayCache; + +class MemoryManager { +private: + typedef std::set<MemoryObject *> objects_ty; + objects_ty objects; + ArrayCache *const arrayCache; + + char *deterministicSpace; + char *nextFreeSlot; + size_t spaceSize; + +public: + MemoryManager(ArrayCache *arrayCache); + ~MemoryManager(); + + /** + * Returns memory object which contains a handle to real virtual process + * memory. + */ + MemoryObject *allocate(uint64_t size, bool isLocal, bool isGlobal, + const llvm::Value *allocSite, size_t alignment = 8); + MemoryObject *allocateFixed(uint64_t address, uint64_t size, + const llvm::Value *allocSite); + void deallocate(const MemoryObject *mo); + void markFreed(MemoryObject *mo); + ArrayCache *getArrayCache() const { return arrayCache; } + + /* + * Returns the size used by deterministic allocation in bytes + */ + size_t getUsedDeterministicSize(); +}; } // End klee namespace |