[llvm-dev] ORC JIT Weekly #12

Lang Hames via llvm-dev llvm-dev at lists.llvm.org
Sun Apr 19 22:36:50 PDT 2020

Hi All,

There was only one interesting ORC-specific commit this week: A new example
showing how to initialize and de-initialize JITDylibs has been added in

The Extensible RTTI system (https://reviews.llvm.org/D39111) that I posted
a while back has landed. While this is not ORC specific, I expect it to be
used in upcoming patches to allow ORC clients to check the dynamic type of
MaterializationUnits. This can be used during dispatch to prioritize work
by type, e.g. prioritizing stubs and other trivial-to-materialize symbols.

Finally, I hope to spend next week working on support for removable code in
OrcV2, which is one of the big missing features from OrcV1. I expect the
API to end up looking something like this:

using ResourceKey = const class ResourceTracker*;
class ResourceTracker {
  // Return the key for this tracker (just its address)
  ResourceKey getKey() { return this; }

  // Emit all not-yet-emitted symbols covered by this tracker.
  Expected<SymbolMap> emit();

  // Remove all symbols covered by this tracker and
  // release resources.
  Error remove();

  // Transfer tracking of all symbols / resources to the
  // containing JITDylib's tracker.
  void detach();

I'm hoping that usage will look like:

LLJIT J = LLJITBuilder().create();

// No tracker specified. Resources tracked by the containing
// JITDylib's tracker, and freed when the JITDylib is
// deinitialized.

// Explicitly specify tracker. Module symbols can be
//  - materialized by calling T->emit();
//  - removed by calling T->remove();
//  - transfered to the JITDylib by calling T->release();
auto T = std::make_unique<ResourceTracker>();
ExitOnErr(J.addIRModule(TrackedModule, T->getKey()));

Early feedback on this API sketch is welcome. Otherwise I hope to have
early reviews / discussion ready in time for next week.

-- Lang.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200419/3468f029/attachment.html>

More information about the llvm-dev mailing list