LLVM  10.0.0svn
Core.h
Go to the documentation of this file.
1 //===------ Core.h -- Core ORC APIs (Layer, JITDylib, etc.) -----*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Contains core ORC APIs.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_EXECUTIONENGINE_ORC_CORE_H
14 #define LLVM_EXECUTIONENGINE_ORC_CORE_H
15 
16 #include "llvm/ADT/BitmaskEnum.h"
21 #include "llvm/IR/Module.h"
22 #include "llvm/Support/Debug.h"
23 
24 #include <memory>
25 #include <vector>
26 
27 #define DEBUG_TYPE "orc"
28 
29 namespace llvm {
30 namespace orc {
31 
32 // Forward declare some classes.
33 class AsynchronousSymbolQuery;
34 class ExecutionSession;
35 class MaterializationUnit;
36 class MaterializationResponsibility;
37 class JITDylib;
38 enum class SymbolState : uint8_t;
39 
40 /// VModuleKey provides a unique identifier (allocated and managed by
41 /// ExecutionSessions) for a module added to the JIT.
42 using VModuleKey = uint64_t;
43 
44 /// A set of symbol names (represented by SymbolStringPtrs for
45 // efficiency).
46 using SymbolNameSet = DenseSet<SymbolStringPtr>;
47 
48 /// A map from symbol names (as SymbolStringPtrs) to JITSymbols
49 /// (address/flags pairs).
50 using SymbolMap = DenseMap<SymbolStringPtr, JITEvaluatedSymbol>;
51 
52 /// A map from symbol names (as SymbolStringPtrs) to JITSymbolFlags.
53 using SymbolFlagsMap = DenseMap<SymbolStringPtr, JITSymbolFlags>;
54 
55 /// A map from JITDylibs to sets of symbols.
56 using SymbolDependenceMap = DenseMap<JITDylib *, SymbolNameSet>;
57 
58 /// A list of (JITDylib*, bool) pairs.
59 using JITDylibSearchList = std::vector<std::pair<JITDylib *, bool>>;
60 
62  SymbolAliasMapEntry() = default;
64  : Aliasee(std::move(Aliasee)), AliasFlags(AliasFlags) {}
65 
68 };
69 
70 /// A map of Symbols to (Symbol, Flags) pairs.
72 
73 /// Render a SymbolStringPtr.
75 
76 /// Render a SymbolNameSet.
77 raw_ostream &operator<<(raw_ostream &OS, const SymbolNameSet &Symbols);
78 
79 /// Render a SymbolFlagsMap entry.
81 
82 /// Render a SymbolMap entry.
84 
85 /// Render a SymbolFlagsMap.
87 
88 /// Render a SymbolMap.
89 raw_ostream &operator<<(raw_ostream &OS, const SymbolMap &Symbols);
90 
91 /// Render a SymbolDependenceMap entry.
94 
95 /// Render a SymbolDependendeMap.
97 
98 /// Render a MaterializationUnit.
100 
101 /// Render a JITDylibSearchList.
103 
104 /// Render a SymbolAliasMap.
105 raw_ostream &operator<<(raw_ostream &OS, const SymbolAliasMap &Aliases);
106 
107 /// Render a SymbolState.
109 
110 /// Callback to notify client that symbols have been resolved.
112 
113 /// Callback to register the dependencies for a given query.
115  std::function<void(const SymbolDependenceMap &)>;
116 
117 /// This can be used as the value for a RegisterDependenciesFunction if there
118 /// are no dependants to register with.
120 
121 /// Used to notify a JITDylib that the given set of symbols failed to
122 /// materialize.
123 class FailedToMaterialize : public ErrorInfo<FailedToMaterialize> {
124 public:
125  static char ID;
126 
127  FailedToMaterialize(std::shared_ptr<SymbolDependenceMap> Symbols);
128  std::error_code convertToErrorCode() const override;
129  void log(raw_ostream &OS) const override;
130  const SymbolDependenceMap &getSymbols() const { return *Symbols; }
131 
132 private:
133  std::shared_ptr<SymbolDependenceMap> Symbols;
134 };
135 
136 /// Used to notify clients when symbols can not be found during a lookup.
137 class SymbolsNotFound : public ErrorInfo<SymbolsNotFound> {
138 public:
139  static char ID;
140 
142  std::error_code convertToErrorCode() const override;
143  void log(raw_ostream &OS) const override;
144  const SymbolNameSet &getSymbols() const { return Symbols; }
145 
146 private:
147  SymbolNameSet Symbols;
148 };
149 
150 /// Used to notify clients that a set of symbols could not be removed.
151 class SymbolsCouldNotBeRemoved : public ErrorInfo<SymbolsCouldNotBeRemoved> {
152 public:
153  static char ID;
154 
156  std::error_code convertToErrorCode() const override;
157  void log(raw_ostream &OS) const override;
158  const SymbolNameSet &getSymbols() const { return Symbols; }
159 
160 private:
161  SymbolNameSet Symbols;
162 };
163 
164 /// Tracks responsibility for materialization, and mediates interactions between
165 /// MaterializationUnits and JDs.
166 ///
167 /// An instance of this class is passed to MaterializationUnits when their
168 /// materialize method is called. It allows MaterializationUnits to resolve and
169 /// emit symbols, or abandon materialization by notifying any unmaterialized
170 /// symbols of an error.
172  friend class MaterializationUnit;
173 public:
176  operator=(MaterializationResponsibility &&) = delete;
177 
178  /// Destruct a MaterializationResponsibility instance. In debug mode
179  /// this asserts that all symbols being tracked have been either
180  /// emitted or notified of an error.
182 
183  /// Returns the target JITDylib that these symbols are being materialized
184  /// into.
185  JITDylib &getTargetJITDylib() const { return JD; }
186 
187  /// Returns the VModuleKey for this instance.
188  VModuleKey getVModuleKey() const { return K; }
189 
190  /// Returns the symbol flags map for this responsibility instance.
191  /// Note: The returned flags may have transient flags (Lazy, Materializing)
192  /// set. These should be stripped with JITSymbolFlags::stripTransientFlags
193  /// before using.
194  const SymbolFlagsMap &getSymbols() const { return SymbolFlags; }
195 
196  /// Returns the names of any symbols covered by this
197  /// MaterializationResponsibility object that have queries pending. This
198  /// information can be used to return responsibility for unrequested symbols
199  /// back to the JITDylib via the delegate method.
200  SymbolNameSet getRequestedSymbols() const;
201 
202  /// Notifies the target JITDylib that the given symbols have been resolved.
203  /// This will update the given symbols' addresses in the JITDylib, and notify
204  /// any pending queries on the given symbols of their resolution. The given
205  /// symbols must be ones covered by this MaterializationResponsibility
206  /// instance. Individual calls to this method may resolve a subset of the
207  /// symbols, but all symbols must have been resolved prior to calling emit.
208  ///
209  /// This method will return an error if any symbols being resolved have been
210  /// moved to the error state due to the failure of a dependency. If this
211  /// method returns an error then clients should log it and call
212  /// failMaterialize. If no dependencies have been registered for the
213  /// symbols covered by this MaterializationResponsibiility then this method
214  /// is guaranteed to return Error::success() and can be wrapped with cantFail.
215  Error notifyResolved(const SymbolMap &Symbols);
216 
217  /// Notifies the target JITDylib (and any pending queries on that JITDylib)
218  /// that all symbols covered by this MaterializationResponsibility instance
219  /// have been emitted.
220  ///
221  /// This method will return an error if any symbols being resolved have been
222  /// moved to the error state due to the failure of a dependency. If this
223  /// method returns an error then clients should log it and call
224  /// failMaterialize. If no dependencies have been registered for the
225  /// symbols covered by this MaterializationResponsibiility then this method
226  /// is guaranteed to return Error::success() and can be wrapped with cantFail.
227  Error notifyEmitted();
228 
229  /// Adds new symbols to the JITDylib and this responsibility instance.
230  /// JITDylib entries start out in the materializing state.
231  ///
232  /// This method can be used by materialization units that want to add
233  /// additional symbols at materialization time (e.g. stubs, compile
234  /// callbacks, metadata).
235  Error defineMaterializing(const SymbolFlagsMap &SymbolFlags);
236 
237  /// Notify all not-yet-emitted covered by this MaterializationResponsibility
238  /// instance that an error has occurred.
239  /// This will remove all symbols covered by this MaterializationResponsibilty
240  /// from the target JITDylib, and send an error to any queries waiting on
241  /// these symbols.
242  void failMaterialization();
243 
244  /// Transfers responsibility to the given MaterializationUnit for all
245  /// symbols defined by that MaterializationUnit. This allows
246  /// materializers to break up work based on run-time information (e.g.
247  /// by introspecting which symbols have actually been looked up and
248  /// materializing only those).
249  void replace(std::unique_ptr<MaterializationUnit> MU);
250 
251  /// Delegates responsibility for the given symbols to the returned
252  /// materialization responsibility. Useful for breaking up work between
253  /// threads, or different kinds of materialization processes.
254  MaterializationResponsibility delegate(const SymbolNameSet &Symbols,
255  VModuleKey NewKey = VModuleKey());
256 
257  void addDependencies(const SymbolStringPtr &Name,
258  const SymbolDependenceMap &Dependencies);
259 
260  /// Add dependencies that apply to all symbols covered by this instance.
261  void addDependenciesForAll(const SymbolDependenceMap &Dependencies);
262 
263 private:
264  /// Create a MaterializationResponsibility for the given JITDylib and
265  /// initial symbols.
267  VModuleKey K);
268 
269  JITDylib &JD;
271  VModuleKey K;
272 };
273 
274 /// A MaterializationUnit represents a set of symbol definitions that can
275 /// be materialized as a group, or individually discarded (when
276 /// overriding definitions are encountered).
277 ///
278 /// MaterializationUnits are used when providing lazy definitions of symbols to
279 /// JITDylibs. The JITDylib will call materialize when the address of a symbol
280 /// is requested via the lookup method. The JITDylib will call discard if a
281 /// stronger definition is added or already present.
283 public:
285  : SymbolFlags(std::move(InitalSymbolFlags)), K(std::move(K)) {}
286 
287  virtual ~MaterializationUnit() {}
288 
289  /// Return the name of this materialization unit. Useful for debugging
290  /// output.
291  virtual StringRef getName() const = 0;
292 
293  /// Return the set of symbols that this source provides.
294  const SymbolFlagsMap &getSymbols() const { return SymbolFlags; }
295 
296  /// Called by materialization dispatchers (see
297  /// ExecutionSession::DispatchMaterializationFunction) to trigger
298  /// materialization of this MaterializationUnit.
300  materialize(MaterializationResponsibility(JD, std::move(SymbolFlags),
301  std::move(K)));
302  }
303 
304  /// Called by JITDylibs to notify MaterializationUnits that the given symbol
305  /// has been overridden.
306  void doDiscard(const JITDylib &JD, const SymbolStringPtr &Name) {
307  SymbolFlags.erase(Name);
308  discard(JD, std::move(Name));
309  }
310 
311 protected:
314 
315 private:
316  virtual void anchor();
317 
318  /// Implementations of this method should materialize all symbols
319  /// in the materialzation unit, except for those that have been
320  /// previously discarded.
321  virtual void materialize(MaterializationResponsibility R) = 0;
322 
323  /// Implementations of this method should discard the given symbol
324  /// from the source (e.g. if the source is an LLVM IR Module and the
325  /// symbol is a function, delete the function body or mark it available
326  /// externally).
327  virtual void discard(const JITDylib &JD, const SymbolStringPtr &Name) = 0;
328 };
329 
331  std::vector<std::unique_ptr<MaterializationUnit>>;
332 
333 /// A MaterializationUnit implementation for pre-existing absolute symbols.
334 ///
335 /// All symbols will be resolved and marked ready as soon as the unit is
336 /// materialized.
338 public:
340 
341  StringRef getName() const override;
342 
343 private:
344  void materialize(MaterializationResponsibility R) override;
345  void discard(const JITDylib &JD, const SymbolStringPtr &Name) override;
346  static SymbolFlagsMap extractFlags(const SymbolMap &Symbols);
347 
348  SymbolMap Symbols;
349 };
350 
351 /// Create an AbsoluteSymbolsMaterializationUnit with the given symbols.
352 /// Useful for inserting absolute symbols into a JITDylib. E.g.:
353 /// \code{.cpp}
354 /// JITDylib &JD = ...;
355 /// SymbolStringPtr Foo = ...;
356 /// JITEvaluatedSymbol FooSym = ...;
357 /// if (auto Err = JD.define(absoluteSymbols({{Foo, FooSym}})))
358 /// return Err;
359 /// \endcode
360 ///
361 inline std::unique_ptr<AbsoluteSymbolsMaterializationUnit>
363  return std::make_unique<AbsoluteSymbolsMaterializationUnit>(
364  std::move(Symbols), std::move(K));
365 }
366 
367 /// A materialization unit for symbol aliases. Allows existing symbols to be
368 /// aliased with alternate flags.
370 public:
371  /// SourceJD is allowed to be nullptr, in which case the source JITDylib is
372  /// taken to be whatever JITDylib these definitions are materialized in (and
373  /// MatchNonExported has no effect). This is useful for defining aliases
374  /// within a JITDylib.
375  ///
376  /// Note: Care must be taken that no sets of aliases form a cycle, as such
377  /// a cycle will result in a deadlock when any symbol in the cycle is
378  /// resolved.
379  ReExportsMaterializationUnit(JITDylib *SourceJD, bool MatchNonExported,
380  SymbolAliasMap Aliases, VModuleKey K);
381 
382  StringRef getName() const override;
383 
384 private:
385  void materialize(MaterializationResponsibility R) override;
386  void discard(const JITDylib &JD, const SymbolStringPtr &Name) override;
387  static SymbolFlagsMap extractFlags(const SymbolAliasMap &Aliases);
388 
389  JITDylib *SourceJD = nullptr;
390  bool MatchNonExported = false;
391  SymbolAliasMap Aliases;
392 };
393 
394 /// Create a ReExportsMaterializationUnit with the given aliases.
395 /// Useful for defining symbol aliases.: E.g., given a JITDylib JD containing
396 /// symbols "foo" and "bar", we can define aliases "baz" (for "foo") and "qux"
397 /// (for "bar") with: \code{.cpp}
398 /// SymbolStringPtr Baz = ...;
399 /// SymbolStringPtr Qux = ...;
400 /// if (auto Err = JD.define(symbolAliases({
401 /// {Baz, { Foo, JITSymbolFlags::Exported }},
402 /// {Qux, { Bar, JITSymbolFlags::Weak }}}))
403 /// return Err;
404 /// \endcode
405 inline std::unique_ptr<ReExportsMaterializationUnit>
407  return std::make_unique<ReExportsMaterializationUnit>(
408  nullptr, true, std::move(Aliases), std::move(K));
409 }
410 
411 /// Create a materialization unit for re-exporting symbols from another JITDylib
412 /// with alternative names/flags.
413 /// If MatchNonExported is true then non-exported symbols from SourceJD can be
414 /// re-exported. If it is false, attempts to re-export a non-exported symbol
415 /// will result in a "symbol not found" error.
416 inline std::unique_ptr<ReExportsMaterializationUnit>
417 reexports(JITDylib &SourceJD, SymbolAliasMap Aliases,
418  bool MatchNonExported = false, VModuleKey K = VModuleKey()) {
419  return std::make_unique<ReExportsMaterializationUnit>(
420  &SourceJD, MatchNonExported, std::move(Aliases), std::move(K));
421 }
422 
423 /// Build a SymbolAliasMap for the common case where you want to re-export
424 /// symbols from another JITDylib with the same linkage/flags.
426 buildSimpleReexportsAliasMap(JITDylib &SourceJD, const SymbolNameSet &Symbols);
427 
428 /// Represents the state that a symbol has reached during materialization.
429 enum class SymbolState : uint8_t {
430  Invalid, /// No symbol should be in this state.
431  NeverSearched, /// Added to the symbol table, never queried.
432  Materializing, /// Queried, materialization begun.
433  Resolved, /// Assigned address, still materializing.
434  Emitted, /// Emitted to memory, but waiting on transitive dependencies.
435  Ready = 0x3f /// Ready and safe for clients to access.
436 };
437 
438 /// A symbol query that returns results via a callback when results are
439 /// ready.
440 ///
441 /// makes a callback when all symbols are available.
443  friend class ExecutionSession;
444  friend class JITDylib;
446 
447 public:
448  /// Create a query for the given symbols. The NotifyComplete
449  /// callback will be called once all queried symbols reach the given
450  /// minimum state.
451  AsynchronousSymbolQuery(const SymbolNameSet &Symbols,
452  SymbolState RequiredState,
453  SymbolsResolvedCallback NotifyComplete);
454 
455  /// Notify the query that a requested symbol has reached the required state.
456  void notifySymbolMetRequiredState(const SymbolStringPtr &Name,
457  JITEvaluatedSymbol Sym);
458 
459  /// Returns true if all symbols covered by this query have been
460  /// resolved.
461  bool isComplete() const { return OutstandingSymbolsCount == 0; }
462 
463  /// Call the NotifyComplete callback.
464  ///
465  /// This should only be called if all symbols covered by the query have
466  /// reached the specified state.
467  void handleComplete();
468 
469 private:
470  SymbolState getRequiredState() { return RequiredState; }
471 
472  void addQueryDependence(JITDylib &JD, SymbolStringPtr Name);
473 
474  void removeQueryDependence(JITDylib &JD, const SymbolStringPtr &Name);
475 
476  bool canStillFail();
477 
478  void handleFailed(Error Err);
479 
480  void detach();
481 
482  SymbolsResolvedCallback NotifyComplete;
483  SymbolDependenceMap QueryRegistrations;
484  SymbolMap ResolvedSymbols;
485  size_t OutstandingSymbolsCount;
486  SymbolState RequiredState;
487 };
488 
489 /// A symbol table that supports asynchoronous symbol queries.
490 ///
491 /// Represents a virtual shared object. Instances can not be copied or moved, so
492 /// their addresses may be used as keys for resource management.
493 /// JITDylib state changes must be made via an ExecutionSession to guarantee
494 /// that they are synchronized with respect to other JITDylib operations.
495 class JITDylib {
497  friend class ExecutionSession;
499 public:
501  public:
502  virtual ~DefinitionGenerator();
504  tryToGenerate(JITDylib &Parent, const SymbolNameSet &Names) = 0;
505  };
506 
508  std::set<std::shared_ptr<AsynchronousSymbolQuery>>;
509 
510  JITDylib(const JITDylib &) = delete;
511  JITDylib &operator=(const JITDylib &) = delete;
512  JITDylib(JITDylib &&) = delete;
513  JITDylib &operator=(JITDylib &&) = delete;
514 
515  /// Get the name for this JITDylib.
516  const std::string &getName() const { return JITDylibName; }
517 
518  /// Get a reference to the ExecutionSession for this JITDylib.
519  ExecutionSession &getExecutionSession() const { return ES; }
520 
521  /// Adds a definition generator to this JITDylib and returns a referenece to
522  /// it.
523  ///
524  /// When JITDylibs are searched during lookup, if no existing definition of
525  /// a symbol is found, then any generators that have been added are run (in
526  /// the order that they were added) to potentially generate a definition.
527  template <typename GeneratorT>
528  GeneratorT &addGenerator(std::unique_ptr<GeneratorT> DefGenerator);
529 
530  /// Remove a definition generator from this JITDylib.
531  ///
532  /// The given generator must exist in this JITDylib's generators list (i.e.
533  /// have been added and not yet removed).
534  void removeGenerator(DefinitionGenerator &G);
535 
536  /// Set the search order to be used when fixing up definitions in JITDylib.
537  /// This will replace the previous search order, and apply to any symbol
538  /// resolutions made for definitions in this JITDylib after the call to
539  /// setSearchOrder (even if the definition itself was added before the
540  /// call).
541  ///
542  /// If SearchThisJITDylibFirst is set, which by default it is, then this
543  /// JITDylib will add itself to the beginning of the SearchOrder (Clients
544  /// should *not* put this JITDylib in the list in this case, to avoid
545  /// redundant lookups).
546  ///
547  /// If SearchThisJITDylibFirst is false then the search order will be used as
548  /// given. The main motivation for this feature is to support deliberate
549  /// shadowing of symbols in this JITDylib by a facade JITDylib. For example,
550  /// the facade may resolve function names to stubs, and the stubs may compile
551  /// lazily by looking up symbols in this dylib. Adding the facade dylib
552  /// as the first in the search order (instead of this dylib) ensures that
553  /// definitions within this dylib resolve to the lazy-compiling stubs,
554  /// rather than immediately materializing the definitions in this dylib.
555  void setSearchOrder(JITDylibSearchList NewSearchOrder,
556  bool SearchThisJITDylibFirst = true,
557  bool MatchNonExportedInThisDylib = true);
558 
559  /// Add the given JITDylib to the search order for definitions in this
560  /// JITDylib.
561  void addToSearchOrder(JITDylib &JD, bool MatcNonExported = false);
562 
563  /// Replace OldJD with NewJD in the search order if OldJD is present.
564  /// Otherwise this operation is a no-op.
565  void replaceInSearchOrder(JITDylib &OldJD, JITDylib &NewJD,
566  bool MatchNonExported = false);
567 
568  /// Remove the given JITDylib from the search order for this JITDylib if it is
569  /// present. Otherwise this operation is a no-op.
570  void removeFromSearchOrder(JITDylib &JD);
571 
572  /// Do something with the search order (run under the session lock).
573  template <typename Func>
574  auto withSearchOrderDo(Func &&F)
575  -> decltype(F(std::declval<const JITDylibSearchList &>()));
576 
577  /// Define all symbols provided by the materialization unit to be part of this
578  /// JITDylib.
579  ///
580  /// This overload always takes ownership of the MaterializationUnit. If any
581  /// errors occur, the MaterializationUnit consumed.
582  template <typename MaterializationUnitType>
583  Error define(std::unique_ptr<MaterializationUnitType> &&MU);
584 
585  /// Define all symbols provided by the materialization unit to be part of this
586  /// JITDylib.
587  ///
588  /// This overload only takes ownership of the MaterializationUnit no error is
589  /// generated. If an error occurs, ownership remains with the caller. This
590  /// may allow the caller to modify the MaterializationUnit to correct the
591  /// issue, then re-call define.
592  template <typename MaterializationUnitType>
593  Error define(std::unique_ptr<MaterializationUnitType> &MU);
594 
595  /// Tries to remove the given symbols.
596  ///
597  /// If any symbols are not defined in this JITDylib this method will return
598  /// a SymbolsNotFound error covering the missing symbols.
599  ///
600  /// If all symbols are found but some symbols are in the process of being
601  /// materialized this method will return a SymbolsCouldNotBeRemoved error.
602  ///
603  /// On success, all symbols are removed. On failure, the JITDylib state is
604  /// left unmodified (no symbols are removed).
605  Error remove(const SymbolNameSet &Names);
606 
607  /// Search the given JITDylib for the symbols in Symbols. If found, store
608  /// the flags for each symbol in Flags. Returns any unresolved symbols.
609  Expected<SymbolFlagsMap> lookupFlags(const SymbolNameSet &Names);
610 
611  /// Dump current JITDylib state to OS.
612  void dump(raw_ostream &OS);
613 
614  /// FIXME: Remove this when we remove the old ORC layers.
615  /// Search the given JITDylibs in order for the symbols in Symbols. Results
616  /// (once they become available) will be returned via the given Query.
617  ///
618  /// If any symbol is not found then the unresolved symbols will be returned,
619  /// and the query will not be applied. The Query is not failed and can be
620  /// re-used in a subsequent lookup once the symbols have been added, or
621  /// manually failed.
623  legacyLookup(std::shared_ptr<AsynchronousSymbolQuery> Q, SymbolNameSet Names);
624 
625 private:
626  using AsynchronousSymbolQueryList =
627  std::vector<std::shared_ptr<AsynchronousSymbolQuery>>;
628 
629  struct UnmaterializedInfo {
630  UnmaterializedInfo(std::unique_ptr<MaterializationUnit> MU)
631  : MU(std::move(MU)) {}
632 
633  std::unique_ptr<MaterializationUnit> MU;
634  };
635 
636  using UnmaterializedInfosMap =
638 
639  struct MaterializingInfo {
640  SymbolDependenceMap Dependants;
641  SymbolDependenceMap UnemittedDependencies;
642 
643  void addQuery(std::shared_ptr<AsynchronousSymbolQuery> Q);
644  void removeQuery(const AsynchronousSymbolQuery &Q);
645  AsynchronousSymbolQueryList takeQueriesMeeting(SymbolState RequiredState);
646  AsynchronousSymbolQueryList takeAllPendingQueries() {
647  return std::move(PendingQueries);
648  }
649  bool hasQueriesPending() const { return !PendingQueries.empty(); }
650  const AsynchronousSymbolQueryList &pendingQueries() const {
651  return PendingQueries;
652  }
653  private:
654  AsynchronousSymbolQueryList PendingQueries;
655  };
656 
658 
659  class SymbolTableEntry {
660  public:
661  SymbolTableEntry() = default;
662  SymbolTableEntry(JITSymbolFlags Flags)
663  : Flags(Flags), State(static_cast<uint8_t>(SymbolState::NeverSearched)),
664  MaterializerAttached(false), PendingRemoval(false) {}
665 
666  JITTargetAddress getAddress() const { return Addr; }
667  JITSymbolFlags getFlags() const { return Flags; }
668  SymbolState getState() const { return static_cast<SymbolState>(State); }
669 
670  bool isInMaterializationPhase() const {
671  return getState() == SymbolState::Materializing ||
672  getState() == SymbolState::Resolved;
673  }
674 
675  bool hasMaterializerAttached() const { return MaterializerAttached; }
676  bool isPendingRemoval() const { return PendingRemoval; }
677 
678  void setAddress(JITTargetAddress Addr) { this->Addr = Addr; }
679  void setFlags(JITSymbolFlags Flags) { this->Flags = Flags; }
680  void setState(SymbolState State) {
681  assert(static_cast<uint8_t>(State) < (1 << 6) &&
682  "State does not fit in bitfield");
683  this->State = static_cast<uint8_t>(State);
684  }
685 
686  void setMaterializerAttached(bool MaterializerAttached) {
687  this->MaterializerAttached = MaterializerAttached;
688  }
689 
690  void setPendingRemoval(bool PendingRemoval) {
691  this->PendingRemoval = PendingRemoval;
692  }
693 
694  JITEvaluatedSymbol getSymbol() const {
695  return JITEvaluatedSymbol(Addr, Flags);
696  }
697 
698  private:
699  JITTargetAddress Addr = 0;
700  JITSymbolFlags Flags;
701  uint8_t State : 6;
702  uint8_t MaterializerAttached : 1;
703  uint8_t PendingRemoval : 1;
704  };
705 
707 
708  JITDylib(ExecutionSession &ES, std::string Name);
709 
710  Error defineImpl(MaterializationUnit &MU);
711 
712  Expected<SymbolNameSet> lookupFlagsImpl(SymbolFlagsMap &Flags,
713  const SymbolNameSet &Names);
714 
715  Error lodgeQuery(std::shared_ptr<AsynchronousSymbolQuery> &Q,
716  SymbolNameSet &Unresolved, bool MatchNonExported,
718 
719  Error lodgeQueryImpl(std::shared_ptr<AsynchronousSymbolQuery> &Q,
720  SymbolNameSet &Unresolved, bool MatchNonExported,
722 
723  bool lookupImpl(std::shared_ptr<AsynchronousSymbolQuery> &Q,
724  std::vector<std::unique_ptr<MaterializationUnit>> &MUs,
725  SymbolNameSet &Unresolved);
726 
727  void detachQueryHelper(AsynchronousSymbolQuery &Q,
728  const SymbolNameSet &QuerySymbols);
729 
730  void transferEmittedNodeDependencies(MaterializingInfo &DependantMI,
731  const SymbolStringPtr &DependantName,
732  MaterializingInfo &EmittedMI);
733 
734  Error defineMaterializing(const SymbolFlagsMap &SymbolFlags);
735 
736  void replace(std::unique_ptr<MaterializationUnit> MU);
737 
738  SymbolNameSet getRequestedSymbols(const SymbolFlagsMap &SymbolFlags) const;
739 
740  void addDependencies(const SymbolStringPtr &Name,
741  const SymbolDependenceMap &Dependants);
742 
743  Error resolve(const SymbolMap &Resolved);
744 
745  Error emit(const SymbolFlagsMap &Emitted);
746 
747  using FailedSymbolsWorklist =
748  std::vector<std::pair<JITDylib *, SymbolStringPtr>>;
749  static void notifyFailed(FailedSymbolsWorklist FailedSymbols);
750 
751  ExecutionSession &ES;
752  std::string JITDylibName;
753  SymbolTable Symbols;
754  UnmaterializedInfosMap UnmaterializedInfos;
755  MaterializingInfosMap MaterializingInfos;
756  std::vector<std::unique_ptr<DefinitionGenerator>> DefGenerators;
757  JITDylibSearchList SearchOrder;
758 };
759 
760 /// An ExecutionSession represents a running JIT program.
762  // FIXME: Remove this when we remove the old ORC layers.
763  friend class JITDylib;
764 
765 public:
766  /// For reporting errors.
767  using ErrorReporter = std::function<void(Error)>;
768 
769  /// For dispatching MaterializationUnit::materialize calls.
771  JITDylib &JD, std::unique_ptr<MaterializationUnit> MU)>;
772 
773  /// Construct an ExecutionSession.
774  ///
775  /// SymbolStringPools may be shared between ExecutionSessions.
776  ExecutionSession(std::shared_ptr<SymbolStringPool> SSP = nullptr);
777 
778  /// Add a symbol name to the SymbolStringPool and return a pointer to it.
779  SymbolStringPtr intern(StringRef SymName) { return SSP->intern(SymName); }
780 
781  /// Returns a shared_ptr to the SymbolStringPool for this ExecutionSession.
782  std::shared_ptr<SymbolStringPool> getSymbolStringPool() const { return SSP; }
783 
784  /// Run the given lambda with the session mutex locked.
785  template <typename Func> auto runSessionLocked(Func &&F) -> decltype(F()) {
786  std::lock_guard<std::recursive_mutex> Lock(SessionMutex);
787  return F();
788  }
789 
790  /// Get the "main" JITDylib, which is created automatically on construction of
791  /// the ExecutionSession.
792  JITDylib &getMainJITDylib();
793 
794  /// Return a pointer to the "name" JITDylib.
795  /// Ownership of JITDylib remains within Execution Session
796  JITDylib *getJITDylibByName(StringRef Name);
797 
798  /// Add a new JITDylib to this ExecutionSession.
799  ///
800  /// The JITDylib Name is required to be unique. Clients should verify that
801  /// names are not being re-used (e.g. by calling getJITDylibByName) if names
802  /// are based on user input.
803  JITDylib &createJITDylib(std::string Name,
804  bool AddToMainDylibSearchOrder = true);
805 
806  /// Allocate a module key for a new module to add to the JIT.
808  return runSessionLocked([this]() { return ++LastKey; });
809  }
810 
811  /// Return a module key to the ExecutionSession so that it can be
812  /// re-used. This should only be done once all resources associated
813  /// with the original key have been released.
814  void releaseVModule(VModuleKey Key) { /* FIXME: Recycle keys */
815  }
816 
817  /// Set the error reporter function.
819  this->ReportError = std::move(ReportError);
820  return *this;
821  }
822 
823  /// Report a error for this execution session.
824  ///
825  /// Unhandled errors can be sent here to log them.
826  void reportError(Error Err) { ReportError(std::move(Err)); }
827 
828  /// Set the materialization dispatch function.
830  DispatchMaterializationFunction DispatchMaterialization) {
831  this->DispatchMaterialization = std::move(DispatchMaterialization);
832  return *this;
833  }
834 
835  void legacyFailQuery(AsynchronousSymbolQuery &Q, Error Err);
836 
838  std::shared_ptr<AsynchronousSymbolQuery> Q, SymbolNameSet Names)>;
839 
840  /// A legacy lookup function for JITSymbolResolverAdapter.
841  /// Do not use -- this will be removed soon.
843  legacyLookup(LegacyAsyncLookupFunction AsyncLookup, SymbolNameSet Names,
844  SymbolState RequiredState,
845  RegisterDependenciesFunction RegisterDependencies);
846 
847  /// Search the given JITDylib list for the given symbols.
848  ///
849  /// SearchOrder lists the JITDylibs to search. For each dylib, the associated
850  /// boolean indicates whether the search should match against non-exported
851  /// (hidden visibility) symbols in that dylib (true means match against
852  /// non-exported symbols, false means do not match).
853  ///
854  /// The NotifyComplete callback will be called once all requested symbols
855  /// reach the required state.
856  ///
857  /// If all symbols are found, the RegisterDependencies function will be called
858  /// while the session lock is held. This gives clients a chance to register
859  /// dependencies for on the queried symbols for any symbols they are
860  /// materializing (if a MaterializationResponsibility instance is present,
861  /// this can be implemented by calling
862  /// MaterializationResponsibility::addDependencies). If there are no
863  /// dependenant symbols for this query (e.g. it is being made by a top level
864  /// client to get an address to call) then the value NoDependenciesToRegister
865  /// can be used.
866  void lookup(const JITDylibSearchList &SearchOrder, SymbolNameSet Symbols,
867  SymbolState RequiredState, SymbolsResolvedCallback NotifyComplete,
868  RegisterDependenciesFunction RegisterDependencies);
869 
870  /// Blocking version of lookup above. Returns the resolved symbol map.
871  /// If WaitUntilReady is true (the default), will not return until all
872  /// requested symbols are ready (or an error occurs). If WaitUntilReady is
873  /// false, will return as soon as all requested symbols are resolved,
874  /// or an error occurs. If WaitUntilReady is false and an error occurs
875  /// after resolution, the function will return a success value, but the
876  /// error will be reported via reportErrors.
877  Expected<SymbolMap> lookup(const JITDylibSearchList &SearchOrder,
878  const SymbolNameSet &Symbols,
879  SymbolState RequiredState = SymbolState::Ready,
880  RegisterDependenciesFunction RegisterDependencies =
881  NoDependenciesToRegister);
882 
883  /// Convenience version of blocking lookup.
884  /// Searches each of the JITDylibs in the search order in turn for the given
885  /// symbol.
888 
889  /// Convenience version of blocking lookup.
890  /// Searches each of the JITDylibs in the search order in turn for the given
891  /// symbol. The search will not find non-exported symbols.
894 
895  /// Convenience version of blocking lookup.
896  /// Searches each of the JITDylibs in the search order in turn for the given
897  /// symbol. The search will not find non-exported symbols.
899  StringRef Symbol);
900 
901  /// Materialize the given unit.
903  std::unique_ptr<MaterializationUnit> MU) {
904  LLVM_DEBUG({
905  runSessionLocked([&]() {
906  dbgs() << "Dispatching " << *MU << " for " << JD.getName() << "\n";
907  });
908  });
909  DispatchMaterialization(JD, std::move(MU));
910  }
911 
912  /// Dump the state of all the JITDylibs in this session.
913  void dump(raw_ostream &OS);
914 
915 private:
916  static void logErrorsToStdErr(Error Err) {
917  logAllUnhandledErrors(std::move(Err), errs(), "JIT session error: ");
918  }
919 
920  static void
921  materializeOnCurrentThread(JITDylib &JD,
922  std::unique_ptr<MaterializationUnit> MU) {
923  MU->doMaterialize(JD);
924  }
925 
926  void runOutstandingMUs();
927 
928  mutable std::recursive_mutex SessionMutex;
929  std::shared_ptr<SymbolStringPool> SSP;
930  VModuleKey LastKey = 0;
931  ErrorReporter ReportError = logErrorsToStdErr;
932  DispatchMaterializationFunction DispatchMaterialization =
933  materializeOnCurrentThread;
934 
935  std::vector<std::unique_ptr<JITDylib>> JDs;
936 
937  // FIXME: Remove this (and runOutstandingMUs) once the linking layer works
938  // with callbacks from asynchronous queries.
939  mutable std::recursive_mutex OutstandingMUsMutex;
940  std::vector<std::pair<JITDylib *, std::unique_ptr<MaterializationUnit>>>
941  OutstandingMUs;
942 };
943 
944 template <typename GeneratorT>
945 GeneratorT &JITDylib::addGenerator(std::unique_ptr<GeneratorT> DefGenerator) {
946  auto &G = *DefGenerator;
947  ES.runSessionLocked(
948  [&]() { DefGenerators.push_back(std::move(DefGenerator)); });
949  return G;
950 }
951 
952 template <typename Func>
954  -> decltype(F(std::declval<const JITDylibSearchList &>())) {
955  return ES.runSessionLocked([&]() { return F(SearchOrder); });
956 }
957 
958 template <typename MaterializationUnitType>
959 Error JITDylib::define(std::unique_ptr<MaterializationUnitType> &&MU) {
960  assert(MU && "Can not define with a null MU");
961  return ES.runSessionLocked([&, this]() -> Error {
962  if (auto Err = defineImpl(*MU))
963  return Err;
964 
965  /// defineImpl succeeded.
966  auto UMI = std::make_shared<UnmaterializedInfo>(std::move(MU));
967  for (auto &KV : UMI->MU->getSymbols())
968  UnmaterializedInfos[KV.first] = UMI;
969 
970  return Error::success();
971  });
972 }
973 
974 template <typename MaterializationUnitType>
975 Error JITDylib::define(std::unique_ptr<MaterializationUnitType> &MU) {
976  assert(MU && "Can not define with a null MU");
977 
978  return ES.runSessionLocked([&, this]() -> Error {
979  if (auto Err = defineImpl(*MU))
980  return Err;
981 
982  /// defineImpl succeeded.
983  auto UMI = std::make_shared<UnmaterializedInfo>(std::move(MU));
984  for (auto &KV : UMI->MU->getSymbols())
985  UnmaterializedInfos[KV.first] = UMI;
986 
987  return Error::success();
988  });
989 }
990 
991 /// ReexportsGenerator can be used with JITDylib::setGenerator to automatically
992 /// re-export a subset of the source JITDylib's symbols in the target.
994 public:
995  using SymbolPredicate = std::function<bool(SymbolStringPtr)>;
996 
997  /// Create a reexports generator. If an Allow predicate is passed, only
998  /// symbols for which the predicate returns true will be reexported. If no
999  /// Allow predicate is passed, all symbols will be exported.
1000  ReexportsGenerator(JITDylib &SourceJD, bool MatchNonExported = false,
1001  SymbolPredicate Allow = SymbolPredicate());
1002 
1003  Expected<SymbolNameSet> tryToGenerate(JITDylib &JD,
1004  const SymbolNameSet &Names) override;
1005 
1006 private:
1007  JITDylib &SourceJD;
1008  bool MatchNonExported = false;
1009  SymbolPredicate Allow;
1010 };
1011 
1012 /// Mangles symbol names then uniques them in the context of an
1013 /// ExecutionSession.
1015 public:
1017  SymbolStringPtr operator()(StringRef Name);
1018 
1019 private:
1020  ExecutionSession &ES;
1021  const DataLayout &DL;
1022 };
1023 
1024 } // End namespace orc
1025 } // End namespace llvm
1026 
1027 #undef DEBUG_TYPE // "orc"
1028 
1029 #endif // LLVM_EXECUTIONENGINE_ORC_CORE_H
JITSymbolFlags AliasFlags
Definition: Core.h:67
Queried, materialization begun.
A parsed version of the target data layout string in and methods for querying it. ...
Definition: DataLayout.h:111
std::shared_ptr< SymbolStringPool > getSymbolStringPool() const
Returns a shared_ptr to the SymbolStringPool for this ExecutionSession.
Definition: Core.h:782
ExecutionSession & setDispatchMaterialization(DispatchMaterializationFunction DispatchMaterialization)
Set the materialization dispatch function.
Definition: Core.h:829
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Added to the symbol table, never queried.
This class represents lattice values for constants.
Definition: AllocatorList.h:23
void dispatchMaterialization(JITDylib &JD, std::unique_ptr< MaterializationUnit > MU)
Materialize the given unit.
Definition: Core.h:902
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
Implements a dense probed hash-table based set.
Definition: DenseSet.h:249
std::function< void(const SymbolDependenceMap &)> RegisterDependenciesFunction
Callback to register the dependencies for a given query.
Definition: Core.h:115
void doDiscard(const JITDylib &JD, const SymbolStringPtr &Name)
Called by JITDylibs to notify MaterializationUnits that the given symbol has been overridden...
Definition: Core.h:306
bool isComplete() const
Returns true if all symbols covered by this query have been resolved.
Definition: Core.h:461
SymbolState
Represents the state that a symbol has reached during materialization.
Definition: Core.h:429
void replace(Container &Cont, typename Container::iterator ContIt, typename Container::iterator ContEnd, RandomAccessIterator ValIt, RandomAccessIterator ValEnd)
Given a sequence container Cont, replace the range [ContIt, ContEnd) with the range [ValIt...
Definition: STLExtras.h:1339
static sys::Mutex Lock
F(f)
GeneratorT & addGenerator(std::unique_ptr< GeneratorT > DefGenerator)
Adds a definition generator to this JITDylib and returns a referenece to it.
Definition: Core.h:945
Used to notify a JITDylib that the given set of symbols failed to materialize.
Definition: Core.h:123
std::function< bool(SymbolStringPtr)> SymbolPredicate
Definition: Core.h:995
std::unique_ptr< AbsoluteSymbolsMaterializationUnit > absoluteSymbols(SymbolMap Symbols, VModuleKey K=VModuleKey())
Create an AbsoluteSymbolsMaterializationUnit with the given symbols.
Definition: Core.h:362
void doMaterialize(JITDylib &JD)
Called by materialization dispatchers (see ExecutionSession::DispatchMaterializationFunction) to trig...
Definition: Core.h:299
Definition: BitVector.h:937
SymbolStringPtr intern(StringRef SymName)
Add a symbol name to the SymbolStringPool and return a pointer to it.
Definition: Core.h:779
std::vector< std::pair< JITDylib *, bool > > JITDylibSearchList
A list of (JITDylib*, bool) pairs.
Definition: Core.h:59
SymbolFlagsMap SymbolFlags
Definition: Core.h:312
Error define(std::unique_ptr< MaterializationUnitType > &&MU)
Define all symbols provided by the materialization unit to be part of this JITDylib.
Definition: Core.h:959
SymbolFlags
Symbol flags.
Definition: Symbol.h:24
Mangles symbol names then uniques them in the context of an ExecutionSession.
Definition: Core.h:1014
static StringRef getName(Value *V)
raw_ostream & operator<<(raw_ostream &OS, const SymbolStringPtr &Sym)
Render a SymbolStringPtr.
Definition: Core.cpp:145
Tagged union holding either a T or a Error.
Definition: yaml2obj.h:21
std::function< SymbolNameSet(std::shared_ptr< AsynchronousSymbolQuery > Q, SymbolNameSet Names)> LegacyAsyncLookupFunction
Definition: Core.h:838
static const uint16_t * lookup(unsigned opcode, unsigned domain, ArrayRef< uint16_t[3]> Table)
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition: Core.h:171
virtual ~MaterializationUnit()
Definition: Core.h:287
void releaseVModule(VModuleKey Key)
Return a module key to the ExecutionSession so that it can be re-used.
Definition: Core.h:814
Key
PAL metadata keys.
auto withSearchOrderDo(Func &&F) -> decltype(F(std::declval< const JITDylibSearchList &>()))
Do something with the search order (run under the session lock).
Definition: Core.h:953
std::set< std::shared_ptr< AsynchronousSymbolQuery > > AsynchronousSymbolQuerySet
Definition: Core.h:508
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:32
Legacy adapter. Remove once we kill off the old ORC layers.
Definition: Legacy.h:93
JITDylib & getTargetJITDylib() const
Returns the target JITDylib that these symbols are being materialized into.
Definition: Core.h:185
uint64_t JITTargetAddress
Represents an address in the target process&#39;s address space.
Definition: JITSymbol.h:41
ExecutionSession & getExecutionSession() const
Get a reference to the ExecutionSession for this JITDylib.
Definition: Core.h:519
std::unique_ptr< ReExportsMaterializationUnit > reexports(JITDylib &SourceJD, SymbolAliasMap Aliases, bool MatchNonExported=false, VModuleKey K=VModuleKey())
Create a materialization unit for re-exporting symbols from another JITDylib with alternative names/f...
Definition: Core.h:417
Expected< SymbolAliasMap > buildSimpleReexportsAliasMap(JITDylib &SourceJD, const SymbolNameSet &Symbols)
Build a SymbolAliasMap for the common case where you want to re-export symbols from another JITDylib ...
Definition: Core.cpp:686
std::unique_ptr< ReExportsMaterializationUnit > symbolAliases(SymbolAliasMap Aliases, VModuleKey K=VModuleKey())
Create a ReExportsMaterializationUnit with the given aliases.
Definition: Core.h:406
Pointer to a pooled string representing a symbol name.
DenseSet< SymbolStringPtr > SymbolNameSet
A set of symbol names (represented by SymbolStringPtrs for.
Definition: Core.h:46
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
VModuleKey getVModuleKey() const
Returns the VModuleKey for this instance.
Definition: Core.h:188
A materialization unit for symbol aliases.
Definition: Core.h:369
static void LLVM_ATTRIBUTE_NORETURN ReportError(uint64_t StartOffset, const char *ErrorMsg)
const SymbolNameSet & getSymbols() const
Definition: Core.h:158
VModuleKey allocateVModule()
Allocate a module key for a new module to add to the JIT.
Definition: Core.h:807
Flags for symbols in the JIT.
Definition: JITSymbol.h:56
Used to notify clients when symbols can not be found during a lookup.
Definition: Core.h:137
const SymbolDependenceMap & getSymbols() const
Definition: Core.h:130
void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner={})
Log all errors (if any) in E to OS.
Definition: Error.cpp:61
No symbol should be in this state.
A MaterializationUnit represents a set of symbol definitions that can be materialized as a group...
Definition: Core.h:282
static ErrorSuccess success()
Create a success value.
Definition: Error.h:326
Module.h This file contains the declarations for the Module class.
Emitted to memory, but waiting on transitive dependencies.
const DataFlowGraph & G
Definition: RDFGraph.cpp:202
static uint32_t getFlags(const Symbol *Sym)
Definition: TapiFile.cpp:28
SymbolStringPtr Aliasee
Definition: Core.h:66
An ExecutionSession represents a running JIT program.
Definition: Core.h:761
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:132
const SymbolFlagsMap & getSymbols() const
Returns the symbol flags map for this responsibility instance.
Definition: Core.h:194
Represents a symbol that has been evaluated to an address already.
Definition: JITSymbol.h:190
Base class for user error types.
Definition: Error.h:344
A symbol query that returns results via a callback when results are ready.
Definition: Core.h:442
std::vector< std::unique_ptr< MaterializationUnit > > MaterializationUnitList
Definition: Core.h:331
uint8_t uint64_t VModuleKey
VModuleKey provides a unique identifier (allocated and managed by ExecutionSessions) for a module add...
Definition: Core.h:42
const SymbolFlagsMap & getSymbols() const
Return the set of symbols that this source provides.
Definition: Core.h:294
void reportError(Error Err)
Report a error for this execution session.
Definition: Core.h:826
auto runSessionLocked(Func &&F) -> decltype(F())
Run the given lambda with the session mutex locked.
Definition: Core.h:785
A MaterializationUnit implementation for pre-existing absolute symbols.
Definition: Core.h:337
const std::string & getName() const
Get the name for this JITDylib.
Definition: Core.h:516
ExecutionSession & setErrorReporter(ErrorReporter ReportError)
Set the error reporter function.
Definition: Core.h:818
const SymbolNameSet & getSymbols() const
Definition: Core.h:144
MaterializationUnit(SymbolFlagsMap InitalSymbolFlags, VModuleKey K)
Definition: Core.h:284
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file provides a collection of function (or more generally, callable) type erasure utilities supp...
Assigned address, still materializing.
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
Used to notify clients that a set of symbols could not be removed.
Definition: Core.h:151
std::function< void(Error)> ErrorReporter
For reporting errors.
Definition: Core.h:767
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
print Print MemDeps of function
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
RegisterDependenciesFunction NoDependenciesToRegister
This can be used as the value for a RegisterDependenciesFunction if there are no dependants to regist...
Definition: Core.cpp:140
SymbolAliasMapEntry(SymbolStringPtr Aliasee, JITSymbolFlags AliasFlags)
Definition: Core.h:63
#define LLVM_DEBUG(X)
Definition: Debug.h:122
std::function< void(JITDylib &JD, std::unique_ptr< MaterializationUnit > MU)> DispatchMaterializationFunction
For dispatching MaterializationUnit::materialize calls.
Definition: Core.h:771
A symbol table that supports asynchoronous symbol queries.
Definition: Core.h:495
ReexportsGenerator can be used with JITDylib::setGenerator to automatically re-export a subset of the...
Definition: Core.h:993