[all-commits] [llvm/llvm-project] 817268: [ORC] Add errors for missing and extraneous symbol...

lhames via All-commits all-commits at lists.llvm.org
Sat Feb 22 13:11:31 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 81726894d3c8af556eb86007c8c26d7e2d9639f3
      https://github.com/llvm/llvm-project/commit/81726894d3c8af556eb86007c8c26d7e2d9639f3
  Author: Lang Hames <lhames at gmail.com>
  Date:   2020-02-22 (Sat, 22 Feb 2020)

  Changed paths:
    M llvm/include/llvm/ExecutionEngine/Orc/Core.h
    M llvm/include/llvm/ExecutionEngine/Orc/OrcError.h
    M llvm/lib/ExecutionEngine/Orc/Core.cpp
    M llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
    M llvm/lib/ExecutionEngine/OrcError/OrcError.cpp

  Log Message:
  -----------
  [ORC] Add errors for missing and extraneous symbol definitions.

This patch adds new errors and error checking to the ObjectLinkingLayer to
catch cases where a compiled or loaded object either:
(1) Contains definitions not covered by its responsibility set, or
(2) Is missing definitions that are covered by its responsibility set.

Proir to this patch providing the correct set of definitions was treated as
an API contract requirement, however this requires that the client be confident
in the correctness of the whole compiler / object-cache pipeline and results
in difficult-to-debug assertions upon failure. Treating this as a recoverable
error results in clearer diagnostics.

The performance overhead of this check is one comparison of densemap keys
(symbol string pointers) per linking object, which is minimal. If this overhead
ever becomes a problem we can add the check under a flag that can be turned off
if the client fully trusts the rest of the pipeline.


  Commit: 1df947ab403a9ec3bb1bf4cd83610a997dc4f3bc
      https://github.com/llvm/llvm-project/commit/1df947ab403a9ec3bb1bf4cd83610a997dc4f3bc
  Author: Lang Hames <lhames at gmail.com>
  Date:   2020-02-22 (Sat, 22 Feb 2020)

  Changed paths:
    M llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
    M llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
    A llvm/test/ExecutionEngine/OrcLazy/static-initializers-in-objectfiles.ll
    M llvm/tools/lli/lli.cpp

  Log Message:
  -----------
  [ORC] Update LLJIT to automatically run specially named initializer functions.

The GenericLLVMIRPlatformSupport class runs a transform on all LLVM IR added to
the LLJIT instance to replace instances of llvm.global_ctors with a specially
named function that runs the corresponing static initializers (See
(GlobalCtorDtorScraper from lib/ExecutionEngine/Orc/LLJIT.cpp). This patch
updates the GenericIRPlatform class to check for this specially named function
in other materialization units that are added to the JIT and, if found, add
the function to the initializer work queue. Doing this allows object files
that were compiled from IR and cached to be reloaded in subsequent JIT sessions
without their initializers being skipped.

To enable testing this patch also updates the lli tool's -jit-kind=orc-lazy mode
to respect the -enable-cache-manager and -object-cache-dir options, and modifies
the CompileOnDemandLayer to rename extracted submodules to include a hash of the
names of their symbol definitions. This allows a simple object caching scheme
based on module names (which was already implemented in lli) to work with the
lazy JIT.


Compare: https://github.com/llvm/llvm-project/compare/56eb15a1c710...1df947ab403a


More information about the All-commits mailing list