[LLVMdev] Problem with the OCaml garbage collector interface and gcroot

Colin Benner benner.colin at googlemail.com
Fri Feb 10 13:25:24 PST 2012

Hi all,

As part of my bachelor's thesis I'm trying to implement a new
LLVM-based back end for the OCaml compiler.  Currently I have a
problem with LLVM's interface to the OCaml garbage collector.  When I
try to compile the attached program using llc I get the following
stack dump:

0  llc             0x00000000016611de
1  llc             0x00000000016616aa
2  libpthread.so.0 0x00007f90105fa270
3  llc             0x0000000000adb030 llvm::MachineFrameInfo::getObjectOffset(int) const + 32
4  llc             0x0000000000e73f1a llvm::X86FrameLowering::getFrameIndexOffset(llvm::MachineFunction const&, int) const + 74
5  llc             0x000000000119bed1
6  llc             0x000000000119bd1e
7  llc             0x00000000011e0dce llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 110
8  llc             0x000000000158e363 llvm::FPPassManager::runOnFunction(llvm::Function&) + 467
9  llc             0x000000000158e6ed llvm::FPPassManager::runOnModule(llvm::Module&) + 125
10 llc             0x000000000158e940 llvm::MPPassManager::runOnModule(llvm::Module&) + 496
11 llc             0x000000000158eefc llvm::PassManagerImpl::run(llvm::Module&) + 172
12 llc             0x000000000158f2f1 llvm::PassManager::run(llvm::Module&) + 33
13 llc             0x0000000000a32322 main + 3010
14 libc.so.6       0x00007f900f85738d __libc_start_main + 237
15 llc             0x0000000000a30c39
Stack dump:
0.      Program arguments: llc testcase.ll
1.      Running pass 'Function Pass Manager' on module 'testcase.ll'.
2.      Running pass 'Analyze Machine Code For Garbage Collection' on function '@foo'

However, the problem goes away when I change the code in a few minor
details.  For instance, changing the 15 in line 36 to pretty much
everything except -16, -8, 1, 2, 3, 4, 8, 16 and 23 makes the problem
disappear, as does switching lines 41 and 42 or changing just about
any other literal in the code.

I'm using LLVM 3.0.  The host and target architecture is x86_64 but
the same problem occures when targetting sparc and sparcv9, but none
of the other architectures.

Any help would be appreciated.

Colin Benner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testcase.ll
Type: application/octet-stream
Size: 982 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120210/59bcee18/attachment.obj>

More information about the llvm-dev mailing list