Legacy ABI compatibility and interoperability

The legacy ABI compatibility and interoperability.

Due to the nature of interfaces such as setjmp(), longjmp(), sigsetjmp(), siglongjmp(), _setjmp(), _longjmp(), getcontext(), setcontext(), makecontext(), and swapcontext(), which must save and restore non-volatile machine state, there is risk introduced when considering dependencies between legacy and vector extended ABI modules. To complicate matters, the setjmp family of functions in libc reside in a static member of libc, which means every existing AIX® binary has a statically bound copy of the setjmp and others that existed with the version of AIX® it was linked against. Furthermore, existing AIX® binaries have jmpbufs and ucontext data structure definitions that are insufficient to house any additional non-volatile vector register state.

Any cases where previous versions of modules and new modules interleave calls, or call-backs, where a previous version of a module could perform a longjmp() or setcontext() bypassing normal linkage convention of a vector extended module, there is risk of compromising non-volatile VR state.

For this reason, while the AIX® ABI defines non-volatile VRs, the default compilation mode when using vectors (AltiVec) in AIX® compilers will be to not use any of the non-volatile VRs. This results in a default compilation environment that safely allows exploitation of vectors (AltiVec) while introducing no risk with respect to interoperability with previous-version binaries.

For applications where interoperability and module dependence is completely known, an additional compilation option can be enabled that allows the use of non-volatile VRs. This mode should only be used when all dependent previous-version modules and behaviors are fully known and understood as either having no dependence on functions such as setjmp(), sigsetjmp(), _setjmp(), or getcontext(), or ensuring that all module transitions are performed through normal subroutine linkage convention, and that no call-backs to an upstream previous-version module are used.

This approach allows for a completely safe mode of exploitation of vectors (AltiVec), which is the default mode, while also allowing for explicit tuning and further optimization with use of non-volatile registers in cases where the risks are known. It also provides a flexible ABI and architecture for the future.

The default AltiVec compilation environment predefines __VEC__, as described in the AltiVec Programming Interface Manual.

When the option to use non-volatile VRs is enabled, the compilation environment must also predefine __EXTABI__. This should also be defined when you are compiling or recompiling non-vector enabled modules that will interact with vector-enabled modules that are enabled to utilize non-volatile VRs.