23 for (
auto &
Iter : AllocationSites) {
24 auto &AllocSite =
Iter.second;
25 for (
auto &
Alloc : AllocSite.Allocations) {
30 Pointer *Next = B->Pointers->Next;
31 B->Pointers->PointeeStorage.
BS.
Pointee =
nullptr;
34 B->Pointers =
nullptr;
39 AllocationSites.clear();
43 size_t NumElements,
unsigned EvalID) {
54 size_t NumElements,
unsigned EvalID) {
68 std::make_unique<std::byte[]>(
sizeof(
Block) +
D->getAllocSize());
69 auto *B =
new (Memory.get())
Block(EvalID,
D,
false);
77 ID->IsFieldMutable =
false;
79 ID->IsInitialized =
false;
83 if (
auto It = AllocationSites.find(
D->asExpr()); It != AllocationSites.end())
84 It->second.Allocations.emplace_back(std::move(Memory));
86 AllocationSites.insert(
87 {
D->asExpr(), AllocationSite(std::move(Memory),
D->isArray())});
93 auto It = AllocationSites.find(Source);
94 if (It == AllocationSites.end())
97 auto &Site = It->second;
98 assert(Site.size() > 0);
101 auto AllocIt = llvm::find_if(Site.Allocations, [&](
const Allocation &A) {
102 const Block *B = reinterpret_cast<const Block *>(A.Memory.get());
103 return BlockToDelete == B;
106 assert(AllocIt != Site.Allocations.end());
108 Block *B =
reinterpret_cast<Block *
>(AllocIt->Memory.get());
112 Site.Allocations.erase(AllocIt);
114 if (Site.size() == 0)
115 AllocationSites.erase(It);
This represents one expression.
A memory block, either on the stack or in the heap.
void invokeDtor()
Invokes the Destructor.
void invokeCtor()
Invokes the constructor.
bool hasPointers() const
Checks if the block has any live pointers.
bool deallocate(const Expr *Source, const Block *BlockToDelete, InterpState &S)
Deallocate the given source+block combination.
Block * allocate(const Descriptor *D, unsigned EvalID)
Allocate ONE element of the given descriptor.
A pointer to a memory block, live or dead.
PrimType
Enumeration of the primitive types of the VM.
bool Alloc(InterpState &S, CodePtr OpPC, const Descriptor *Desc)
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
Block * Pointee
The block the pointer is pointing to.
Describes a memory block created by an allocation site.
static constexpr MetadataSize InlineDescMD
const Expr * asExpr() const
Inline descriptor embedded in structures and arrays.