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

Bill Wendling
Mon, 13 Feb 2012 04:51:04 -0000

Hi Colin,

I wasn't able to reproduce the failure with top-of-tree. You might want to
try that instead of llvm 3.0.

-bw

On Feb 10, 2012, at 1:25 PM, Colin Benner wrote:

> 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.
>
> Thanks,
> Colin
Benner<testcase.ll>_______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev