blob: c8ef8016c0cdc2313e6ee0cccf3e97ee9ab0b0a3 (
plain) (
blame)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
 | //===-- MemoryManager.h -----------------------------------------*- C++ -*-===//
//
//                     The KLEE Symbolic Virtual Machine
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef KLEE_MEMORYMANAGER_H
#define KLEE_MEMORYMANAGER_H
#include "klee/KDAlloc/kdalloc.h"
#include <cstddef>
#include <set>
#include <cstdint>
namespace llvm {
class Value;
}
namespace klee {
class ArrayCache;
class ExecutionState;
class MemoryObject;
class MemoryManager {
private:
  typedef std::set<MemoryObject *> objects_ty;
  objects_ty objects;
  ArrayCache *const arrayCache;
  kdalloc::AllocatorFactory globalsFactory;
  kdalloc::Allocator globalsAllocator;
  kdalloc::AllocatorFactory constantsFactory;
  kdalloc::Allocator constantsAllocator;
public:
  explicit MemoryManager(ArrayCache *arrayCache);
  ~MemoryManager();
  kdalloc::AllocatorFactory heapFactory;
  kdalloc::StackAllocatorFactory stackFactory;
  static std::uint32_t quarantine;
  static std::size_t pageSize;
  static bool isDeterministic;
  /**
   * Returns memory object which contains a handle to real virtual process
   * memory.
   */
  MemoryObject *allocate(uint64_t size, bool isLocal, bool isGlobal,
                         ExecutionState *state, const llvm::Value *allocSite,
                         size_t alignment);
  MemoryObject *allocateFixed(uint64_t address, uint64_t size,
                              const llvm::Value *allocSite);
  void markFreed(MemoryObject *mo);
  bool markMappingsAsUnneeded();
  ArrayCache *getArrayCache() const { return arrayCache; }
  /*
   * Returns the size used by deterministic allocation in bytes
   */
  size_t getUsedDeterministicSize();
};
} // End klee namespace
#endif /* KLEE_MEMORYMANAGER_H */
 |