Can you point out to me where in the VMKit code I should be looking?<div><br></div><div>I spent some additional time reading the docs, and I have some specific questions:</div><div><br></div><div>1) I'm trying to figure out the relationship between the __cxa_throw function, and the _Unwind_RaiseException function mentioned in the ABI doc. My guess is that _Unwind_RaiseException is the language-neutral implementation of stack unwinding, and __cxa_throw is the C++ exception semantics that are implemented on top of it. If that is the case, should I be calling _Unwind_RaiseException since my exceptions are more like Java than C++ exceptions?</div>
<div><br></div><div>2) How portable is _Unwind_RaiseException and similar functions? In particular, if I call those functions, will I be limiting myself to a subset of the platforms that LLVM supports? (The same question can be asked of __cxa_throw).</div>
<div><br></div><div>Although _Unwind_RaiseException is mentioned as part of the Itanium ABI, it is apparently used on many more platform types than just that one processor. A code search shows that it is in fact part of the standard gcc-provided runtime libs (see <a href="http://www.google.com/codesearch/p?hl=en#47R7EH5FbNk/trunk/gcc/gcc/unwind-generic.h&q=_Unwind_RaiseException%20lang:c">http://www.google.com/codesearch/p?hl=en#47R7EH5FbNk/trunk/gcc/gcc/unwind-generic.h&q=_Unwind_RaiseException%20lang:c</a>). There is also a mention of "libunwind". Is libunwind a portable implementation of the Itanium unwinding ABI?</div>
<div><br></div><div>3) I really like the "invoke/unwind" abstraction that LLVM provides, as it divorces the mechanism of unwinding from the creation of an exception object. However, looking at the Itanium unwinding API, I don't see how you can implement LLVM invoke/unwind on top of it, since the API functions take an exception object as a parameter. (I suppose you could use a dummy exception to satisfy the ABI, and then implement your own, separate exception object, but this destroys some of the efficiency of the unwinding implementation.)</div>
<div><br></div><div>Also, the Itanium ABI appears to offer some interesting features that aren't exposed by the invoke/unwind mechanism which would be useful. For example, the fact that the stack frames are traversed in two passes seems like it might make it possible to implement human-readable stack dumps, which would be difficult with invoke/unwind.</div>
<div><br></div><div>All this suggests to me that, as nice as the invoke/unwind abstraction is, it might not be a good fit for the capabilities that are actually available. Of course, I'm talking out of total ignorance here...</div>
<div><br></div><div>Thanks in advance, and expect more questions after this :)</div><div><br></div><div>-- Talin</div><div><br></div><br><div class="gmail_quote">On Fri, Dec 19, 2008 at 12:21 AM, Nicolas Geoffray <span dir="ltr"><<a href="mailto:nicolas.geoffray@lip6.fr">nicolas.geoffray@lip6.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Talin,<br>
<div class="Ih2E3d"><br>
Talin wrote:<br>
> After much delay, I have finally reached the point in my work where I<br>
> need to implement some kind of exception handling. I understand that<br>
> "unwind" is currently unimplemented and will remain so for the<br>
> forseeable future.<br>
><br>
> In the mean time, are there any examples available for implementing Java<br>
> or Python-style exceptions using __cxa_throw or something similar? I've<br>
> read and re-read the various docs on exception handling and I'm not<br>
> attaining understanding.<br>
><br>
><br>
<br>
</div>VMKit's your friend! Unfortunately, there's no documentation. Note that<br>
the unwinding part is done by libgcc, like llvm-gcc.<br>
Also, VMKit uses the same scheme than llvm-gcc for exceptions, so I'm<br>
not sure what more info you need apart from the docs and what llvm-gcc<br>
provides. The dwarf output makes it all work magically :)<br>
<br>
Nicolas<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>-- Talin<br>