Implement support for object caching through pkgimages (#47184)
This implements caching native code in "package images" (pkgimages).
We now write two serialization files, one ending in `*.ji` and the other with
the platform dynamic library extension (e.g., `*.so`). The `*.ji` contains
"extended" header information (include the source-code dump for Revise),
whereas the dynamic library includes the Julia objects, including LLVM-generated
native code.
Native code is compiled once during precompilation and then a second time
to build a "clean" module. When we find an edge to an external function (already
cached in anloaded pkgimage), we emit a global variable which we will patch during
loading with the address of the function to call. This allows us to leverage the
standard multiversioning capabilities.
Co-authored-by: Tim Holy <tim.holy@gmail.com>
Co-authored-by: Kristoffer Carlsson <kristoffer.carlsson@chalmers.se>
Co-authored-by: Mosè Giordano <giordano@users.noreply.github.com>
Co-authored-by: Ian Butterworth <i.r.butterworth@gmail.com>
Co-authored-by: Max Horn <max@quendi.de>
Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>
Co-authored-by: Alex Ames <alexander.m.ames@gmail.com>