;
25 if(Chunk && Chunk->Next)
26std::free(Chunk->Next);
37assert(NewSize <=
size());
38 size_tToShrink =
size() - NewSize;
43assert(
size() == NewSize);
46void*InterpStack::grow(
size_tSize) {
47assert(Size < ChunkSize -
sizeof(StackChunk) &&
"Object too large");
49 if(!Chunk ||
sizeof(StackChunk) + Chunk->size() + Size > ChunkSize) {
50 if(Chunk && Chunk->Next) {
53StackChunk *Next =
new(std::malloc(ChunkSize)) StackChunk(Chunk);
60 auto*
Object=
reinterpret_cast<void*
>(Chunk->End);
66void*InterpStack::peekData(
size_tSize)
const{
67assert(Chunk &&
"Stack is empty!");
69StackChunk *Ptr = Chunk;
70 while(Size > Ptr->size()) {
73assert(Ptr &&
"Offset too large");
76 return reinterpret_cast<void*
>(Ptr->End -
Size);
79voidInterpStack::shrink(
size_tSize) {
80assert(Chunk &&
"Chunk is empty!");
82 while(Size > Chunk->size()) {
83 Size-= Chunk->size();
85std::free(Chunk->Next);
86Chunk->Next =
nullptr;
88Chunk->End = Chunk->start();
90assert(Chunk &&
"Offset too large");
101 size_tStackSize =
size();
102 while(TypesSize > StackSize) {
104TypesSize -= aligned_size<T>();
105ItemTypes.pop_back();
108assert(TypesSize == StackSize);
114llvm::errs() <<
"Items: "<< ItemTypes.size() <<
". Size: "<<
size() <<
'\n';
115 if(ItemTypes.empty())
123 for(
autoTyIt = ItemTypes.rbegin(); TyIt != ItemTypes.rend(); ++TyIt) {
126llvm::errs() << Index <<
'/'<< Offset <<
": ";
128 const T&
V= peek<T>(Offset);
131llvm::errs() <<
'\n';
#define TYPE_SWITCH(Expr, B)
void clearTo(size_t NewSize)
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.
PrimType
Enumeration of the primitive types of the VM.
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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4