sammine-lang
|
Public Member Functions | |
ShadowGarbageCollector (LLVMRes &resPtr) | |
virtual std::string | llvmStrategy () |
llvm::GlobalVariable * | getFrameMapForCallee (FuncDefAST *) |
Insert a FrameMap in the beginning of each function. | |
void | applyStrategy (llvm::Function *f) |
void | setStackEntry (FuncDefAST *callee, llvm::Function *llvm_callee) |
void | relieveStackEntry () |
void | initGlobalRootChain () |
void | initGCFunc () |
llvm::GlobalVariable * sammine_lang::AST::ShadowGarbageCollector::getFrameMapForCallee | ( | FuncDefAST * | callee | ) |
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. INFO: from Jasmine: Ok, this is set up so that it scales into a future where we not only stores the NumRoots but also the meta data for each root.
INFO: Right now, we only have NumRoots so it might seem wasteful but in a far future, this will be more efficient. I just don't want to incorporate NumRoots straight into stack entry now so later i have to rewrite all this
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::setStackEntry | ( | FuncDefAST * | callee, |
llvm::Function * | llvm_callee ) |
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