itanium-cxx-abi / cxx-abi

C++ ABI Summary
488 stars 89 forks source link

Proposal: document or somehow notice __cxa_init_primary_exception #173

Open itrofimow opened 9 months ago

itrofimow commented 9 months ago

Hi!

This comes from std::make_exception_ptr: instead of doing throw + catch dance it is possible to initialize the exception object directly, and gcc does that via ABI-extension for almost a decade: https://github.com/gcc-mirror/gcc/blob/8b9d0e8cf482287b6c37b5a268d0eb2d0a964561/libstdc%2B%2B-v3/libsupc%2B%2B/cxxabi_init_exception.h#L70

I've recently landed the same ABI-extension into libcxxrt (https://github.com/libcxxrt/libcxxrt/blob/03c83f5a57be8c5b1a29a68de5638744f17d28ba/src/cxxabi.h#L211) and right now I'm in the process of implementing exactly the same std::make_exception_ptr optimization in LLVM, which implies adding __cxa_init_primary_exception into libcxxabi.

So i though it would make sense to document this function as some kind of auxiliary API, since 3 major implementation are all (hopefully) about to have this as an extension.

Does that sound reasonable?

itrofimow commented 8 months ago

Related: libcxxrt: https://github.com/libcxxrt/libcxxrt/pull/23 libcxxabi: https://github.com/llvm/llvm-project/pull/65534

rjmccall commented 8 months ago

Yeah, I think if you want to write up a patch for this, it'd be a totally welcome addition to the ABI specification.

itrofimow commented 7 months ago

I'm planing to give this another try, but for now i'm a bit too busy, unfortunately.