Commit Graph

855 Commits

Author SHA1 Message Date
Lang Hames
ac3709e19f [RuntimeDyld] Decouple RuntimeDyldChecker from RuntimeDyld.
This will allow RuntimeDyldChecker (and rtdyld-check tests) to test a new JIT
linker: JITLink (https://reviews.llvm.org/D58704).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357947 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-08 21:50:48 +00:00
Fangrui Song
aae528ec39 Fix misspelled filenames in file headers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353408 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-07 14:38:25 +00:00
David Blaikie
eae2f5e5e0 Orc: Simplify RPC naming system by using function-local statics
The existing scheme of class template static members for Name and
NameMutex is a bit verbose, involves global ctors (even if they're cheap
for string and mutex, still not entirely free), and (importantly/my
immediate motivation here) trips over a bug in LLVM's modules
implementation that's a bit involved (hmm, sounds like Mr. Smith has a
fix for the modules thing - but I'm still inclined to commit this patch
as general goodness).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353241 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 23:38:55 +00:00
Chandler Carruth
6b547686c5 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 08:50:56 +00:00
Chandler Carruth
8d2b514a33 Cleanup non-UTF8 characters and some types I found in these files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351630 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 06:02:27 +00:00
Lang Hames
c32dca7916 Revert r351138 "[ORC] Move ORC Core symbol map and set types into their own
header: CoreTypes.h."

This commit broke some bots. Reverting while I investigate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351195 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-15 15:21:13 +00:00
Lang Hames
0ac160f4a6 [ORC] Move ORC Core symbol map and set types into their own header: CoreTypes.h.
This will allow other utilities (including a future RuntimeDyld replacement) to
use these types without pulling in the major Core types (JITDylib, etc.).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351138 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-14 23:49:13 +00:00
Simon Atanasyan
06ac862fa6 [ORC][MIPS] Setup t9 register and call function through this register
MIPS ABI states that every function must be called through jalr $t9. In
other words, a function expect that t9 register points to the beginning
of its code. A function uses this register to calculate offset to the
Global Offset Table and save it to the `gp` register.
```
lui   $gp, %hi(_gp_disp)
addiu $gp, %lo(_gp_disp)
addu  $gp, $gp, $t9
```

If `t9` and as a result `$gp` point to the wrong place the following code
loads incorrect value from GOT and passes control to invalid code.
```
lw    $v0,%call16(foo)($gp)
jalr  $t9
```

OrcMips32 and OrcMips64 writeResolverCode methods pass control to the
resolved address, but do not setup `$t9` before the call. The `t9` holds
value of the beginning of `resolver` code so any attempts to call
routines via GOT failed.

This change fixes the problem. The `OrcLazy/hidden-visibility.ll` test
starts to pass correctly. Before the change it fails on MIPS because the
`exitOnLazyCallThroughFailure` called from the resolver code could not
call libc routine `exit` via GOT.

Differential Revision: http://reviews.llvm.org/D56058

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351000 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-12 11:12:04 +00:00
Sanjoy Das
ec5ab87c76 Avoid use-after-free in ~LegacyRTDyldObjectLinkingLayer
Reviewers: lhames

Subscribers: mcrosier, jlebar, bixia, llvm-commits

Differential Revision: https://reviews.llvm.org/D56521

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350886 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-10 20:12:09 +00:00
Simon Atanasyan
a698e231ae [ORC] Remove redundant instruction from MIPS resolver code. NFC
It's redundant to restore the `$a3` register twice.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350021 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-23 12:04:55 +00:00
Lang Hames
0ad7fb416a [ExecutionEngine] Change NotifyObjectEmitted/NotifyObjectFreed API.
This patch renames both methods (NotifyObjectEmitted -> notifyObjectLoaded, and
NotifyObjectFreed -> notifyObjectFreed), adds an abstract "ObjectKey" (uint64_t)
parameter to notifyObjectLoaded, and replaces the ObjectFile parameter for
notifyObjectFreed with an ObjectKey. Using an ObjectKey to track identify
events, rather than a reference to the ObjectFile, allows us to free the
ObjectFile after notifyObjectLoaded is called, saving memory.

https://reviews.llvm.org/D53773

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348223 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-04 00:55:15 +00:00
Lang Hames
d71ec72114 [ORC] Fix hex printing of uint64_t values.
A plain "%x" format string will drop the high 32-bits. Use the PRIx64 macro
instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345696 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-31 05:16:14 +00:00
Lang Hames
e7543196c9 [ExecutionEngine] Remove some dead code from JITEventListener.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345195 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-24 20:37:40 +00:00
Lang Hames
8b9cbda1b3 [ORC] Re-apply r345077 with fixes to remove ambiguity in lookup calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345098 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-23 23:01:39 +00:00
Reid Kleckner
1989ce13fd Revert r345077 "[ORC] Change how non-exported symbols are matched during lookup."
Doesn't build on Windows. The call to 'lookup' is ambiguous. Clang and
MSVC agree, anyway.

http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/787
C:\b\slave\clang-x64-windows-msvc\build\llvm.src\unittests\ExecutionEngine\Orc\CoreAPIsTest.cpp(315): error C2668: 'llvm::orc::ExecutionSession::lookup': ambiguous call to overloaded function
C:\b\slave\clang-x64-windows-msvc\build\llvm.src\include\llvm/ExecutionEngine/Orc/Core.h(823): note: could be 'llvm::Expected<llvm::JITEvaluatedSymbol> llvm::orc::ExecutionSession::lookup(llvm::ArrayRef<llvm::orc::JITDylib *>,llvm::orc::SymbolStringPtr)'
C:\b\slave\clang-x64-windows-msvc\build\llvm.src\include\llvm/ExecutionEngine/Orc/Core.h(817): note: or       'llvm::Expected<llvm::JITEvaluatedSymbol> llvm::orc::ExecutionSession::lookup(const llvm::orc::JITDylibSearchList &,llvm::orc::SymbolStringPtr)'
C:\b\slave\clang-x64-windows-msvc\build\llvm.src\unittests\ExecutionEngine\Orc\CoreAPIsTest.cpp(315): note: while trying to match the argument list '(initializer list, llvm::orc::SymbolStringPtr)'

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345078 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-23 20:54:43 +00:00
Lang Hames
e4c9c3925c [ORC] Change how non-exported symbols are matched during lookup.
In the new scheme the client passes a list of (JITDylib&, bool) pairs, rather
than a list of JITDylibs. For each JITDylib the boolean indicates whether or not
to match against non-exported symbols (true means that they should be found,
false means that they should not). The MatchNonExportedInJD and MatchNonExported
parameters on lookup are removed.

The new scheme is more flexible, and easier to understand.

This patch also updates JITDylib search orders to be lists of (JITDylib&, bool)
pairs to match the new lookup scheme. Error handling is also plumbed through
the LLJIT class to allow regression tests to fail predictably when a lookup from
a lazy call-through fails.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345077 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-23 20:20:22 +00:00
Lang Hames
356cab04d8 [ORC] Add a createJITDylib method to LLJIT.
Because I'm about to get on stage at the dev meeting and claim that it exists.

This method creates a JITDylib instance with the given name and returns a
reference to it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344763 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-18 22:42:32 +00:00
Lang Hames
e87aaa1093 [ORC] Make the VModuleKey optional, propagate it via MaterializationUnit and
MaterializationResponsibility.

VModuleKeys are intended to enable selective removal of modules from a JIT
session, however for a wide variety of use cases selective removal is not
needed and introduces unnecessary overhead. As of this commit, the default
constructed VModuleKey value is reserved as a "do not track" value, and
becomes the default when adding a new module to the JIT.

This commit also changes the propagation of VModuleKeys. They were passed
alongside the MaterializationResponsibity instance in XXLayer::emit methods,
but are now propagated as part of the MaterializationResponsibility instance
itself (and as part of MaterializationUnit when stored in a JITDylib).
Associating VModuleKeys with MaterializationUnits in this way should allow
for a thread-safe module removal mechanism in the future, even when a module
is in the process of being compiled, by having the
MaterializationResponsibility object check in on its VModuleKey's state
before commiting its results to the JITDylib.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344643 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-16 20:13:06 +00:00
Lang Hames
582b119624 [ORC] Rename ORC layers to make the "new" ORC layers the default.
This commit adds a 'Legacy' prefix to old ORC layers and utilities, and removes
the '2' suffix from the new ORC layers. If you wish to continue using the old
ORC layers you will need to add a 'Legacy' prefix to your classes. If you were
already using the new ORC layers you will need to drop the '2' suffix.

The legacy layers will remain in-tree until the new layers reach feature
parity with them. This will involve adding support for removing code from the
new layers, and ensuring that performance is comperable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344572 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 22:56:10 +00:00
Lang Hames
4812114f29 [ORC] Rename MultiThreadedSimpleCompiler to ConcurrentIRCompiler.
The new name is a better fit: This class does not actually spawn any new
threads for compilation, it is just safe to call from multiple threads
concurrently.

The "Simple" part of the name did not convey much either, so it was
dropped.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344567 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 22:36:22 +00:00
Lang Hames
52ff03cff9 [ORC] Switch to DenseMap/DenseSet for ORC symbol map/set types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344565 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 22:27:02 +00:00
Lang Hames
aa8c49dafa [ORC] Simplify naming for JITDylib definition generators.
Renames:
  JITDylib's setFallbackDefinitionGenerator method to setGenerator.
  DynamicLibraryFallbackGenerator class to DynamicLibrarySearchGenerator.
  ReexportsFallbackDefinitionGenerator to ReexportsGenerator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344489 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 05:07:54 +00:00
Lang Hames
c8309b5ac3 [ORC] Remove XXLayer::add methods that default to using the main JITDylib.
They're not currently used and may complicate upcoming changes to add's
signature and behavior.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344478 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-14 16:09:59 +00:00
Lang Hames
54d4881c35 [ORC] During lookup, do not match against hidden symbols in other JITDylibs.
This adds two arguments to the main ExecutionSession::lookup method:
MatchNonExportedInJD, and MatchNonExported. These control whether and where
hidden symbols should be matched when searching a list of JITDylibs.

A similar effect could have been achieved by filtering search results, but
this would have involved materializing symbol definitions (since materialization
is triggered on lookup) only to throw the results away, among other issues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344467 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-13 21:53:40 +00:00
Lang Hames
5148047f08 [ORC] Promote and rename private symbols inside the CompileOnDemand layer,
rather than require them to have been promoted before being passed in.

Dropping this precondition is better for layer composition (CompileOnDemandLayer
was the only one that placed pre-conditions on the modules that could be added).
It also means that the promoted private symbols do not show up in the target
JITDylib's symbol table. Instead, they are confined to the hidden implementation
dylib that contains the actual definitions.

For the 403.gcc testcase this cut down the public symbol table size from ~15,000
symbols to ~4000, substantially reducing symbol dependence tracking costs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344078 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-09 20:44:32 +00:00
Lang Hames
ee5c35b1a7 [ORC] Add a 'remove' method to JITDylib to remove symbols.
Symbols can be removed provided that all are present in the JITDylib and none
are currently in the materializing state. On success all requested symbols are
removed. On failure an error is returned and no symbols are removed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343928 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-06 23:03:59 +00:00
Lang Hames
c8d6c1623d [ORC] Pass symbol name to discard by const reference.
This saves some unnecessary atomic ref-counting operations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343927 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-06 23:02:06 +00:00
Lang Hames
eaf1a19dc4 [ORC] Pass Symbols to ExecutionSession::lookup by value, potentially saving a
copy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343442 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-01 04:59:10 +00:00
Lang Hames
2887f2e594 [ORC] Add convenience methods for creating DynamicLibraryFallbackGenerators for
libraries on disk, and for the current process.

Avoids more boilerplate during JIT construction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343430 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-01 00:59:28 +00:00
Lang Hames
4e8d0ef849 [ORC] Add a method to JITTargetMachineBuilder to get the default data layout
for the target machine.

This simplifies usage during setup of concurrent JIT stacks where the client
needs a DataLayout, but not a TargetMachine (TargetMachines are created on
the fly by the compile threads later).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343429 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-01 00:59:26 +00:00
Lang Hames
0e735f0b53 [ORC] Add an 'intern' method to ExecutionEngine for interning symbol names.
This cuts down on boilerplate by reducing 'ES.getSymbolStringPool().intern(...)'
to 'ES.intern(...)'.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343427 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-30 23:18:24 +00:00
Lang Hames
04756ee526 [ORC] Extract and tidy up JITTargetMachineBuilder, add unit test.
(1) Adds comments for the API.

(2) Removes the setArch method: This is redundant: the setArchStr method on the
    triple should be used instead.

(3) Turns EmulatedTLS on by default. This matches EngineBuilder's behavior.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343423 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-30 19:12:23 +00:00
Lang Hames
90c3271e8e [ORC] Add partitioning support to CompileOnDemandLayer2.
CompileOnDemandLayer2 now supports user-supplied partition functions (the
original CompileOnDemandLayer already supported these).

Partition functions are called with the list of requested global values
(i.e. global values that currently have queries waiting on them) and have an
opportunity to select extra global values to materialize at the same time.

Also adds testing infrastructure for the new feature to lli.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343396 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-29 23:49:57 +00:00
Vitaly Buka
05252670a6 [cxx2a] Fix warning triggered by r343285
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343369 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-29 02:17:12 +00:00
Lang Hames
94cc8ba720 [ORC] Make MaterializationResponsibility::getRequestedSymbols() const.
This makes it available for use in IRTransformLayer2::TransformFunction
instances (since a const MaterializationResponsibility& parameter was
added in r343365).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343367 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-28 22:03:17 +00:00
Lang Hames
7373792b4a [ORC] Add more utilities to aid debugging output.
(1) A const accessor for the LLVMContext held by a ThreadSafeContext.

(2) A const accessor for the ThreadSafeModules held by an IRMaterializationUnit.

(3) A const MaterializationResponsibility reference to IRTransformLayer2's
    transform function. This makes IRTransformLayer2 useful for JIT debugging
    (since it can inspect JIT state through the responsibility argument) as well
    as program transformations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343365 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-28 21:49:53 +00:00
Lang Hames
a6f5223feb [ORC] Improve debugging output for ORC.
(1) Print debugging output under a session lock to avoid garbled messages when
compiling on multiple threads.

(2) Name MaterializationUnits, add an ostream operator for them, and so they can
be easily referenced in debugging output, and have that ostream operator
optionally print code/data/hidden symbols provided by that materialization unit
based on command line options.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343323 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-28 15:03:11 +00:00
Lang Hames
217504b6a8 [ORC] clang-format the ThreadSafeModule code.
Evidently I forgot to do this before committing r343055.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343288 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-28 01:41:33 +00:00
Lang Hames
7ea842c013 [ORC] Add a const version of ThreadSafeModule::getModule().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343287 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-28 01:41:33 +00:00
Lang Hames
2c78ea3621 [ORC] Lock ThreadSafeContext during module destruction in ThreadSafeModule's
move constructor.

This is basically the same fix as r343261, but applied to the move constructor:
Failure to lock the context during module destruction can lead to data races if
other threads are operating on the context.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343286 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-28 01:41:29 +00:00
Lang Hames
1d6ef08467 [ORC] Add definition for IRLayer::setCloneToNewContextOnEmit, use it to set the
flag to true in LLJIT when running in multithreaded mode.

The IRLayer::setCloneToNewContextOnEmit method sets a flag within the IRLayer
that causes modules added to that layer to be moved to a new context (by
serializing to/from a memory buffer) when they are emitted. This allows modules
that were all loaded on the same context to be compiled in parallel.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343266 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 21:13:07 +00:00
Lang Hames
5fb9129f80 [ORC] Make LocalIndirectStubsManager's operations thread-safe.
Locks stub management operations and switches to atomic update for stub
pointers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343262 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 20:36:10 +00:00
Lang Hames
3a5e132bb3 [ORC] Lock ThreadSafeContext during Module destructing in ThreadSafeModule.
Failure to lock the context can lead to data races if other threads are
operating on other ThreadSafeModules that share the same context.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343261 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 20:36:08 +00:00
Lang Hames
4bcdd90284 [ORC] Coalesce all of ORC's symbol renaming / linkage-promotion utilities into
one SymbolLinkagePromoter utility.

SymbolLinkagePromoter renames anonymous and private symbols, and bumps all
linkages to at least global/hidden-visibility. Modules whose symbols have been
promoted by this utility can be decomposed into sub-modules without introducing
link errors. This is used by the CompileOnDemandLayer to extract single-function
modules for lazy compilation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343257 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 19:27:20 +00:00
Lang Hames
73ff7f8fad [ORC] LastKey needs to be protected to prevent data races.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343256 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 19:27:20 +00:00
Lang Hames
d177f9e9bf Revert "Re-revert r343129."
This reverts commit 4e2557dbc7.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343161 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 02:09:36 +00:00
Lang Hames
4e2557dbc7 Re-revert r343129.
Apparently the fixes in r343149 did not cover all the issues. Re-reverting
while I investigate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343151 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 23:32:53 +00:00
Lang Hames
1f88aa3059 Reapply r343129 with fix.
Explicitly defines ThreadSafeModule's move-assignment operator to move fields in
reverse order. This is required to ensure that the context field outlives the
module field.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343149 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 22:34:33 +00:00
Lang Hames
bdab5ef14b Revert r343129 "[ORC] Change the field order of ThreadSafeModule to ensure the "
It broke several bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343133 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 19:36:30 +00:00
Lang Hames
665fc45e84 [ORC] Change the field order of ThreadSafeModule to ensure the Module is
destroyed before its ThreadSharedContext.

Destroying the context first is an error if this ThreadSafeModule is the only
owner of its underlying context.

Add a unit test for ThreadSafeModule/ThreadSafeContext to catch this and other
basic usage issues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343129 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-26 18:50:01 +00:00