[LLVMdev] Getting started with GC
Chris Lattner
sabre at nondot.org
Tue Oct 26 21:17:00 PDT 2004
On Tue, 26 Oct 2004, Tom Brown wrote:
> I'm in a group tasked with improving the GC of LLVM for a 421 project.
> We are having trouble getting started with the given SemiSpace
> collector.
>
> We found the string llvm_gc_initialize called from a single source file
> ./test/Regression/CodeGen/Generic/GC/alloc_loop.ll
> which we tried with the following... (showing LLVM checked out from cvs a few days ago, similar
> output with release 1.3)
>
> $ llvm-as alloc_loop.ll
> $ lli alloc_loop.bc
> lli: Globals.cpp:81: llvm::GlobalVariable::GlobalVariable(const llvm::Type*, bool, llvm::GlobalValue::LinkageTypes, llvm::Constant*, const std::string&, llvm::Module*): Assertion `Initializer->getType() == Ty && "Initializer should be the same type as the GlobalVariable!"' failed.
> lli((anonymous namespace)::PrintStackTrace()+0x1a)[0x857f21a]
> lli((anonymous namespace)::SignalHandler(int)+0xcb)[0x857f48d]
> [0xffffe420]
> How should we get this to run?
Sorry about that, patch for this problem here:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20041025/019891.html
> Also the code in runtime/GC/SemiSpace/semispace.c doesn't seem to do
> anything other than call process_pointer for every gcroot pointer.
>
> static void process_pointer(void **Root, void *Meta) {
> printf("process_root[0x%p] = 0x%p\n", (void*) Root, (void*) *Root);
> }
Correct. The semispace collector hasn't been implemented all of the way.
The code generator and runtime interfaces provide you with all of the
hooks that you need to implement a garbage collector though.
> Are there any examples of LLVM performing active garbage collection? In
> the dev archives
> (http://mail.cs.uiuc.edu/pipermail/llvmdev/2004-July/001527.html) Chris
> said there are no frontends with GC support, but it might get into Java
> first. Where is llvm-java? Google didn't find it in top 10, there is no
> llvm-java module in cvs, find -iname java offered no hope.
LLVM-Java is still in development unfortunately. I believe that array
support is currently being added by Alkis and that he hasn't hooked it up
with the GC yet.
> Do you recommend we stick to llvm assembly for testing GC?
Unfortunately, yes that's really the only way to go for now.
-Chris
--
http://llvm.org/
http://nondot.org/sabre/
More information about the llvm-dev
mailing list