[Gc] Creating stack-like memory containing GC roots
Christian Schafmeister <[email protected]> Wed, 23 Sep 2015 15:52:11 -0400
| Newsgroups | gmane.comp.programming.garbage-collection.boehmgc |
|---|---|
| Message-ID | <[email protected]> |
I’ve written a Common Lisp compiler that uses LLVM as the backend and that interoperates with C++. I’m using the Boehm garbage collector and I need to create a stack alongside the regular C++ stack that holds GC roots. Is there any way using the Boehm garbage collector to identify a region of memory that will contain this stack and continuously update the top of the stack so that Boehm only examines the region that can contain pointers? I need to push a frame containing GC roots onto the stack and then later pop the frame. Ideally I would just need to provide Boehm a pointer that points to the end of the current frame and everything from that address up to and including the first frame would be scanned for roots. I have seen the GC_add_roots function but that lets me define a region once. I need some way to continuously update the end of the stack. Currently I’m using GC_malloc and GC_free to allocate and free frames - but I feel that for something like a stack this has more overhead than I need. I’ve tried doing this all on the main C++ stack - but I have to use non-standard features like __builtin_alloca or variable length arrays and they have caused me a lot of grief. Best, Christian Schafmeister Professor, Chemistry Department Temple University _______________________________________________ bdwgc mailing list [email protected] https://lists.opendylan.org/mailman/listinfo/bdwgc