New libunwind implementation in libc++abi
Today we are happy to announce that the LLVM family of C++ support libraries is more complete than ever. To enable clang++ to port to platforms that do not have a system unwinder, Apple has contributed their unwinder implementation to LLVM. It is now dual licensed under LLVM and MIT license which is the same license as the rest of LLVM’s runtime support libraries.
The new unwinder has been added to the libcxxabi.llvm.org project. The unwinder has two levels of API. The high level APIs are the Unwind* functions which the cxa_* exception functions in libcxxabi require. The low level APIs are the unw_* functions which are an interface defined by the the old HP libunwind project (which shares no code with this libunwind).
Most architectures now use “zero cost” exceptions for C++. The zero cost means there are no extra instructions executed if no exceptions are thrown. But if an exception is thrown, the runtime must consult side tables and figure out how to restore registers and “unwind” from the current stack frame to the catch clause. That ability to modify the stack frames and cause the thread to resume in a catch clause with all registers restored properly is the main purpose of libunwind.
The new unwinder sources are known to build on Darwin, but will need some #defines configured to build on other platforms (patches welcome!). The low level libunwind API was designed to work either in-process (aka local) or to operate on another process (aka remote), but only the local path has been completed, as that is all that C++ exceptions require.
-Nick Kledzik
Posted by Nick Kledzik at 11:26 AM
Labels: C++, new-in-llvm-3.4
LLVM家族的C++支持库现已更加完善。为使Clang++能够移植到没有系统级异常处理程序的平台,Apple向LLVM贡献了其异常处理实现。此实现在LLVM和MIT许可下双授权,与LLVM的其他运行时支持库一致。新的异常处理程序已添加到libc++abi项目中,提供高低两个级别的API。大多数架构现采用“零成本”异常,意味着若无异常抛出则不执行额外指令。当抛出异常时,运行时必须咨询侧边表并确定如何从当前堆栈帧回退至catch子句。
973

被折叠的 条评论
为什么被折叠?



