PkgCacheInspector

Documentation for PkgCacheInspector.

Tip

See the README for a usage demo.

This documentation provides reference information which may be useful for understanding more about the information returned by info_cachefile.

PkgCacheInspector.info_cachefileFunction
info_cachefile(pkgname::AbstractString) → cf
info_cachefile(pkgid::Base.PkgId) → cf
info_cachefile(pkgid::Base.PkgId, ji_cachefilename) → cf

Return a snapshot cf of a package cache file. Displaying cf prints a summary of the contents, but the fields of cf can be inspected to get further information (see PkgCacheInfo).

After calling info_cachefile("MyPkg") you can also execute using MyPkg to make the image loaded by info_cachefile available for use. This can allow you to load cfs for multiple packages into the same session for deeper analysis.

Warn

Your session may be corrupted if you run info_cachefile for a package that had already been loaded into your session. Restarting with a clean session and using info_cachefile before otherwise loading the package is recommended.

source
PkgCacheInspector.PkgCacheInfoType
struct PkgCacheInfo

Objects stored the pkgimage. The main contents are the modules themselves, but some additional objects are stored external to the modules. It also contains the data used to perform invalidation-checks.

  • cachefile: The filename of the cache.
  • modules: The list of modules stored in the package image. The final one is the "top" package module.
  • init_order: The list of modules with an __init__ function, in the order in which they should be called.
  • external_methods: The list of methods added to external modules. E.g., Base.push!(v::MyNewVector, x).
  • new_specializations: The list of novel specializations of external methods that were created during package precompilation. E.g., get(::Dict{String,Float16}, ::String, ::Nothing): Base owns the method and all the types in this specialization, but might not have precompiled it until it was needed by a package.
  • new_method_roots: New GC roots added to external methods. These are an important but internal detail of how type-inferred code is compressed for serialization.
  • external_targets: The list of already-inferred MethodInstances that get called by items stored in this cachefile. If any of these are no longer valid (or no longer the method that would be chosen by dispatch), then some compiled code in this package image must be invalidated and recompiled.
  • edges: A lookup table of external_targets dependencies: [mi1, indxs1, mi2, indxs2...] means that mi1 (cached in this pkgimage) depends on external_targets[idxs1]; mi2 depends on external_targets[idxs2], and so on.
  • filesize: The total size of the cache file.
  • image_targets: The image targets that were cloned into the pkgimage, if used.
source
PkgCacheInspector.PkgCacheSizesType
struct PkgCacheSizes

Stores the sizes of different "sections" of the pkgimage. The main section is the package image itself. However, reconstructing a pkgimage for use requires auxillary data, like the addresses of internal pointers that need to be modified to account for the actual base address into which the pkgimage was loaded. Each form of auxillary data gets stored in distinct sections.

  • sysdata: Size of the image. This is the portion of the file that gets returns by info_cachefile.
  • isbitsdata: Size of the const internal data section (storing things not visible from Julia, like datatype layouts).
  • symboldata: Size of the symbol section, for Symbols stored in the image.
  • tagslist: Size of the GC tags section, holding references to objects that require special re-initialization for GC.
  • reloclist: Size of the relocation-list section, holding references to within-image pointers that need to be offset by the actual base pointer upon reloading.
  • gvarlist: Size of the "gvar" (global variable) list of LLVM-encoded objects.
  • fptrlist: Size of the function-pointer list, referencing native code.
source