[LLVMdev] x86 unwind support[MESSAGE NOT SCANNED]

Kenneth Uildriks kennethuil at gmail.com
Mon Jul 20 08:42:23 PDT 2009


On Mon, Jul 20, 2009 at 10:33 AM, Mark Shannon<marks at dcs.gla.ac.uk> wrote:
> You are confusing stopping the unwinding at *some* levels or at *all*
> levels.
> Eg.
> invoke
>  call
>   call
>    invoke
>     call
>      call
>       unwind
>
> Requires a two unwinding steps for Java/Python and six steps for C++.
> Only languages with stack-allocated objects must stop unwinding for calls.

C++ doesn't need you to stop unwinding at every level.  Only at levels
where stack-allocated objects with non-trivial destructors exist.  At
those levels, the code generator can turn all calls into invokes.
Other levels can be skipped, since stack-allocated objects without
non-trivial destructors can simply be abandoned as the stack pointer
is bumped past them.

So a function with stack-allocated objects having non-trivial
destructors is pretty much the equivalent of a function with a
finalizer, and can be code-generated as such using invokes instead of
calls.  Calls can still be skipped.  The difference is that many C++
programs will tend to wind up with more invokes.

>
>>
>>> I take it you have never used Python ;)
>>> (Python uses exceptions to terminate loops, so it helps if they aren't
>>> too slow)
>>
>> I have used python, and it is slow (sorry).  In fact, python
>
> Python: write program 1 day, run program 10mins = 1day + 10mins
> C++: write program 1 month, run program 30 seconds = 1month + 30 secs
> It depends on how you look at it, but we are getting off topic here :)
>
>> Exceptions are implemented in python as a second return value, thus
> Only in one particular Python implementation, there are several.
> Its not in the language spec.
>
>> EVERY function, even those which don't throw exceptions, must pay the
>> price.  And just because the python community does it, doesn't mean
>> it's good programming practice.
> The same could be said of C++. Both languages have their place, and llvm
> should support compilers for both (and lots of other languages as well).
>>
>>> Please try and get out of the C++ mindset, llvm may be implemented *in*
>>> C++, but its not implemented just *for* C++ (at least I hope it isn't).
>>
>> That is exactly my argument.  Multi-level unwinds are required by MANY
>> languages.
>>
> Not in the same way as C++, see above.
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list