<br><br><div class="gmail_quote">2010/1/22 Garrison Venn <span dir="ltr"><<a href="mailto:gvenn.cfe.dev@gmail.com">gvenn.cfe.dev@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="word-wrap: break-word;"><div>Hi James,</div><div><br></div>Note that the wiki example is a manual JIT example that works directly with the C++ APIs. As you know, no LLVM tools are used, <div>just LLVM libraries. I say this to point out, that in the example, the exception mechanism is under the complete control of the </div>
<div>developer moded by the LLVM libraries. In my mind a different example/different doc. would be needed to explain how</div><div>a bit code driven JIT exception mechanism works. Sure the semantics and syntax of the unwind mechanism would be the</div>
<div>same, but how/where the dwarf is emitted could be different. I do know that different classes are used to emit dwarf code</div><div>for non-JIT projects vs what classes are used in the wiki JIT example. I know you understand this already,  but I just wanted to </div>
<div>make it clear for the readers of this list.</div></div></blockquote><div><br>In principle though what I'm trying to do ought to work though - I don't see anything fundamentally different about my bitcode test that lli loads from a file versus what the wiki JIT exception example generates at runtime. Both should result in similar IR in memory driving the JIT to generate the required unwind information from inkove instructions and the llvm.eh intrinsics - there's no other magic going on in the JIT example (is there?)<br>
<br>Anyway, I now have LLVM trunk from svn compiled with debug information, which makes it easier to see what's going on. Assuming I get to the bottom of it I'll post an update here.<br><br>-- James<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="word-wrap: break-word;"><div><br></div><font color="#888888"><div>Garrison</div></font><div><br></div><div>PS: I would find if extremely useful, if you would post your results once you've figured out the issues.<div>
<div></div><div class="h5"><br><div><br></div><div><div><div>On Jan 22, 2010, at 10:31, James Williams wrote:</div><br><blockquote type="cite"><br><br><div class="gmail_quote">2010/1/22 James Williams <span dir="ltr"><<a href="mailto:junk@giantblob.com" target="_blank">junk@giantblob.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><br><div class="gmail_quote"><div>2010/1/22 Duncan Sands <span dir="ltr"><<a href="mailto:baldrick@free.fr" target="_blank">baldrick@free.fr</a>></span><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


Hi James,<div><div></div><div><div><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
    want to send us your testcase code?  Then we can give it a whirl.<br>
<br>
<br>
Test code is at <a href="http://giantblob.com/ehtest.tar.gz" target="_blank">http://giantblob.com/ehtest.tar.gz</a><br>
<br>
Thanks for the help. I apologize in advance if it turns out I'm doing something stupid!<br>
</blockquote>
<br></div>
I hope you realise that by running llvm-ld without -native you are actually<br>
executing your program from the JIT.  I did a native compilation as follows:<br>
used llvm-link to link all of the bitcode into "total.bc"; ran llc on total.bc,<br>
producing "total.s"; did "g++ -o total total.s"; ran ./total.  It seems to work:<br>
<br>
$ ./total<br>
__l_personality called$<br>
<br>
Of course it is probably supposed to work from the JIT too (I don't know<br>
anything about the JIT), but it clearly doesn't: when I tried I got:<br>
<br>
lli: lib/ExecutionEngine/JIT/JIT.cpp:624: void llvm::JIT::runJITOnFunctionUnlocked(llvm::Function*, const llvm::MutexGuard&): Assertion `!isAlreadyCodeGenerating && "Error: Recursive compilation detected!"' failed.<br>



...<br>
6  lli       0x0000000000d3f5e2 llvm::JIT::runJITOnFunctionUnlocked(llvm::Function*, llvm::MutexGuard const&) + 62<br>
7  lli       0x0000000000d3f9c6 llvm::JIT::getPointerToFunction(llvm::Function*) + 686<br>
8  lli       0x0000000000d67c86 llvm::ExecutionEngine::getPointerToGlobal(llvm::GlobalValue const*) + 70<br>
9  lli       0x0000000000d62805 llvm::JITDwarfEmitter::EmitCommonEHFrame(llvm::Function const*) const + 613<br>
10 lli       0x0000000000d60ac3 llvm::JITDwarfEmitter::EmitDwarfTable(llvm::MachineFunction&, llvm::JITCodeEmitter&, unsigned char*, unsigned char*, unsigned char*&) + 335<br>
...<br></div></div></blockquote><div>Thanks for looking at this. <br><br>Yes, I realise this will link to bitcode and that the result is a script that runs lli. I kind of just expected JIT to work, particularly since the example code on the wiki uses JIT.<br>



<br>The JIT is what my project will eventually target (goal is an out of process compiler will incrementally generate bitcode on disk combined with an application server that will run resulting bitcode via JIT) and hence I've only been testing on the JIT.<br>


<br>I'll see if I can work around the recursive compilation problem.<br><br>-- James<br></div></div></blockquote><div><br>Sorry - t's only just sunk in that the JIT must use a completely different mechanism to load the eh tables versus having  as + ld and the ELF loader do it and that posting the assembler when I was seeing the JIT fail was probably unhelpful. I apologise for the confusion.<br>

<br>-- James<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="gmail_quote"><div><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">



<br>
Ciao,<br><font color="#888888">
<br>
Duncan.<br>
<br>
</font></blockquote></div><br>
</blockquote></div><br>
</blockquote></div><br></div></div></div></div></div></blockquote></div><br>