PostgreSQL's JIT implementation can inline the bodies of functions of types
internal, as well as operators based on such functions. To do so for functions in extensions, the definitions of those functions need to be made available. When using PGXS to build an extension against a server that has been compiled with LLVM JIT support, the relevant files will be built and installed automatically.
The relevant files have to be installed into
$pkglibdir/bitcode/$extension/and a summary of them into
$pkglibdiris the directory returned by
$extensionis the base name of the extension's shared library.
For functions built into PostgreSQL itself, the bitcode is installed into
PostgreSQL provides a JIT implementation based on LLVM. The interface to the JIT provider is pluggable and the provider can be changed without recompiling (although currently, the build process only provides inlining support data for LLVM). The active provider is chosen via the setting jit_provider.
A JIT provider is loaded by dynamically loading the named shared library. The normal library search path is used to locate the library. To provide the required JIT provider callbacks and to indicate that the library is actually a JIT provider, it needs to provide a C function named
_PG_jit_provider_init. This function is passed a struct that needs to be filled with the callback function pointers for individual actions:
extern void _PG_jit_provider_init(JitProviderCallbacks *cb);