sammine-lang
|
Public Member Functions | |
ShadowGarbageCollector (llvm::Module &module, llvm::LLVMContext &context, llvm::IRBuilder<> &builder) | |
virtual std::string | llvmStrategy () |
void | createFrameMapForCallee (FuncDefAST *) |
Insert a FrameMap in the beginning of each function. | |
void | setStackEntryFromCaller (FuncDefAST *) |
void | initGlobalRootChain () |
void | initGCFunc () |
void sammine_lang::AST::ShadowGarbageCollector::createFrameMapForCallee | ( | FuncDefAST * | f | ) |
Insert a FrameMap in the beginning of each function.
The map for a single function's stack frame. One of these is compiled as constant data into the executable for each function.
Storage of metadata values is elided if the metadata parameter to @llvm.gcroot is null.
void sammine_lang::AST::ShadowGarbageCollector::initGCFunc | ( | ) |
Calls Visitor(root, meta) for each GC root on the stack. root and meta are exactly the values passed to @llvm.gcroot.
Visitor could be a function to recursively mark live objects. Or it might copy them to another heap or generation.
Visitor | A function to invoke for every GC root on the stack. |
void sammine_lang::AST::ShadowGarbageCollector::initGlobalRootChain | ( | ) |
The head of the singly-linked list of StackEntries. Functions push and pop onto this in their prologue and epilogue.
Since there is only a global list, this technique is not threadsafe.
void sammine_lang::AST::ShadowGarbageCollector::setStackEntryFromCaller | ( | FuncDefAST * | f | ) |
INFO: We'll set the global curr_stack_entry->next to be the caller, We'll also set the curr_stack_entry->frame_map to be the callee's frame map
INFO: this will require us to keep a map of string to FrameMap in the ShadowGarbageCollector class. For more details, see createFrameMap
A link in the dynamic shadow stack. One of these is embedded in the stack frame of each function on the call stack.