24 if (Chunk && Chunk->Next)
25 std::free(Chunk->Next);
35void *InterpStack::grow(
size_t Size) {
36 assert(Size < ChunkSize -
sizeof(StackChunk) &&
"Object too large");
38 if (!Chunk ||
sizeof(StackChunk) + Chunk->size() + Size > ChunkSize) {
39 if (Chunk && Chunk->Next) {
42 StackChunk *Next =
new (std::malloc(ChunkSize)) StackChunk(Chunk);
49 auto *
Object =
reinterpret_cast<void *
>(Chunk->End);
55void *InterpStack::peekData(
size_t Size)
const {
56 assert(Chunk &&
"Stack is empty!");
58 StackChunk *Ptr = Chunk;
59 while (Size > Ptr->size()) {
62 assert(Ptr &&
"Offset too large");
65 return reinterpret_cast<void *
>(Ptr->End -
Size);
68void InterpStack::shrink(
size_t Size) {
69 assert(Chunk &&
"Chunk is empty!");
71 while (Size > Chunk->size()) {
72 Size -= Chunk->size();
74 std::free(Chunk->Next);
75 Chunk->Next =
nullptr;
77 Chunk->End = Chunk->start();
79 assert(Chunk &&
"Offset too large");
88 llvm::errs() <<
"Items: " << ItemTypes.size() <<
". Size: " <<
size() <<
'\n';
89 if (ItemTypes.empty())
97 for (
auto TyIt = ItemTypes.rbegin(); TyIt != ItemTypes.rend(); ++TyIt) {
100 llvm::errs() << Index <<
'/' << Offset <<
": ";
102 const T &
V = peek<T>(Offset);
105 llvm::errs() <<
'\n';
#define TYPE_SWITCH(Expr, B)
void dump() const
dump the stack contents to stderr.
void clear()
Clears the stack without calling any destructors.
size_t size() const
Returns the size of the stack in bytes.
~InterpStack()
Destroys the stack, freeing up storage.
constexpr size_t align(size_t Size)
Aligns a size to the pointer alignment.
size_t primSize(PrimType Type)
Returns the size of a primitive type in bytes.
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T