summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/Orc
Commit message (Collapse)AuthorAgeFilesLines
...
* [ORC] Only notify queries that they are resolved/ready when the query stateLang Hames2018-06-171-8/+30
| | | | | | | | changes. This guards against redundant notifications. llvm-svn: 334916
* [ORC] Suppress an unused variable warning for a debug-mode only use.Lang Hames2018-06-171-0/+1
| | | | llvm-svn: 334911
* [ORC] Erase empty dependence sets when adding new symbol dependencies.Lang Hames2018-06-171-0/+3
| | | | llvm-svn: 334910
* [ORC] In MaterializationResponsibility, only maintain the Materializing flag onLang Hames2018-06-171-2/+12
| | | | | | | | | | | symbols in debug mode. The MaterializationResponsibility class hijacks the Materializing flag to track symbols that have not yet been resolved in order to guard against redundant resolution. Since this is an API contract check and only enforced in debug mode there is no reason to maintain the flag state in release mode. llvm-svn: 334909
* [ORC] Strip weak flags from a symbol once it is selected for materialization.Lang Hames2018-06-141-3/+4
| | | | | | | | | Once a symbol has been selected for materialization it can no longer be overridden. Stripping the weak flag guarantees this (override attempts will then be treated as duplicate definitions and result in a DuplicateDefinition error). llvm-svn: 334771
* [ORC] Filter out self-dependencies in VSO::addDependencies.Lang Hames2018-06-141-1/+1
| | | | llvm-svn: 334724
* [ORC] Assert that the query argument to VSO::lookup must be non-null.Lang Hames2018-06-141-0/+2
| | | | llvm-svn: 334723
* [ORC] Add a WaitUntilReady argument to blockingLookup.Lang Hames2018-06-142-24/+44
| | | | | | | | | | | If WaitUntilReady is set to true then blockingLookup will return once all requested symbols are ready. If WaitUntilReady is set to false then blockingLookup will return as soon as all requested symbols have been resolved. In the latter case, if any error occurs in finalizing the symbols it will be reported to the ExecutionSession, rather than returned by blockingLookup. llvm-svn: 334722
* [ORC] Strip the Materializing flag off finalized symbols in VSOs.Lang Hames2018-06-141-3/+6
| | | | | | Finalized symbols are no longer in the materializing state. llvm-svn: 334721
* Fix -DLLVM_ENABLE_THREADS=OFF build after r334537Hans Wennborg2018-06-131-1/+1
| | | | llvm-svn: 334582
* [ORC] Add a fallback definition generator for VSOs.Lang Hames2018-06-121-66/+100
| | | | | | | | | | | | If a VSO has a fallback definition generator attached it will be called during lookup (and lookupFlags) for any unresolved symbols. The definition generator can add new definitions to the VSO for any unresolved symbol. This allows VSOs to generate new definitions on demand. The immediate use case for this code is supporting VSOs that can import definitions found via dlsym on demand. llvm-svn: 334538
* [ORC] Refactor blocking lookup logic into the blockingLookup function, andLang Hames2018-06-124-60/+61
| | | | | | | implement existing blocking lookups (the lookup function) and JITSymbolResolverAdapter on top of that. llvm-svn: 334537
* [ORC] Add a constructor to create an IRMaterializationUnit from a module andLang Hames2018-06-031-0/+6
| | | | | | | | | | pre-existing SymbolFlags and SymbolToDefinition maps. This constructor is useful when delegating work from an existing IRMaterialiaztionUnit to a new one, as it avoids the cost of re-computing these maps. llvm-svn: 333852
* [ORC] Add a getRequestedSymbols method to MaterializationResponsibility.Lang Hames2018-05-311-7/+37
| | | | | | | | | | | This method returns the set of symbols in the target VSO that have queries waiting on them. This can be used to make decisions about which symbols to delegate to another MaterializationUnit (typically this will involve delegating all symbols that have *not* been requested to another MaterializationUnit so that materialization of those symbols can be deferred until they are requested). llvm-svn: 333684
* [ORC] Rename IRMaterializationUnit's Discardable member to SymbolToDefinition,Lang Hames2018-05-311-4/+6
| | | | | | | | | | and make it protected rather than private. The new name reflects the actual information in the map, and this information can be useful to derived classes (for example, to quickly look up the IR definition of a requested symbol). llvm-svn: 333683
* [ORC] Fix an ambiguous make_unique call.Lang Hames2018-05-301-2/+2
| | | | llvm-svn: 333492
* [ORC] Update JITCompileCallbackManager to support multi-threaded code.Lang Hames2018-05-304-27/+110
| | | | | | | | | Previously JITCompileCallbackManager only supported single threaded code. This patch embeds a VSO (see include/llvm/ExecutionEngine/Orc/Core.h) in the callback manager. The VSO ensures that the compile callback is only executed once and that the resulting address cached for use by subsequent re-entries. llvm-svn: 333490
* [ORC][C-API] Expose LLVMOrc{Unr,R}egisterJITEventListener().Andres Freund2018-05-241-0/+11
| | | | | | | | Reviewed By: lhames Differential Revision: https://reviews.llvm.org/D44890 llvm-svn: 333229
* [ORC] Add ability [un]register JITEventListener on Orc C stack.Andres Freund2018-05-241-1/+40
| | | | | | | | Reviewed By: lhames Differential Revision: https://reviews.llvm.org/D44890 llvm-svn: 333228
* [ORC] Extend object layer callbacks so JITEventListener can be supported.Andres Freund2018-05-241-1/+4
| | | | | | | | | | | | | | | | | | | | | | Currently RTDyldObjectLinkingLayer makes it hard to support JITEventListeners. Which in turn means debugging and profiling JIT generated code hard. Supporting JITEventListeners at minimum requries a freed callback (added). As listeners expect the ObjectFile to be passed as well, an adaptor between RTDyldObjectLinkingLayer and JITEventListeners would currently need to also maintain ObjectFiles for all loaded modules. To make that less awkward, extend the callbacks to pass the ObjectFile to both Finalized and Freed callbacks. That requires extending the lifetime of the object file when callbacks are present. Reviewed By: lhames Differential Revision: https://reviews.llvm.org/D44890 llvm-svn: 333227
* [ORC] Add findSymbolIn() wrapper to C bindings, take #2.Andres Freund2018-05-242-0/+30
| | | | | | | | | | | | | | | | Re-appply r333147, reverted in r333152 due to a pre-existing bug. As D47308 has been merged in r333206, the OSX issue should now be resolved. In many cases JIT users will know in which module a symbol resides. Avoiding to search other modules can be more efficient. It also allows to handle duplicate symbol names between modules. Reviewed By: lhames Differential Revision: https://reviews.llvm.org/D44889 llvm-svn: 333215
* [ORC] Perform name mangling in findSymbolIn(), as done in findSymbol().Andres Freund2018-05-241-1/+1
| | | | | | | | | | | | | | | | | | | | | The lack of name mangling caused a unittest failure after r333147 (in TestEagerIRCompilation), as OSX prefixes symbol names with '_'. The lack of name mangling therefore leads to a NULL pointer being returned and then called, hence the failure. While it may look like it, this isn't an actual behavioral change, as findSymbolIn() previously was not exposed externally, and essentially dead code. Which explains why nobody noticed the issue previously. Reviewers: lhames Reviewed By: lhames Subscribers: chandlerc, llvm-commits Differential Revision: https://reviews.llvm.org/D47308 llvm-svn: 333206
* Revert r333147 "[ORC] Add findSymbolIn() wrapper to C bindings."Andres Freund2018-05-242-30/+0
| | | | | | | | | | | This reverts r333147 until https://reviews.llvm.org/D47308 is ready to be reviewed. r333147 exposed a behavioural difference between OrcCBindingsStack::findSymbolIn() and OrcCBindingsStack::findSymbol(), where only the latter does name mangling. After r333147 that causes a test failure on OSX, because the new test looks for main using findSymbolIn() but the mangled name is _main. llvm-svn: 333152
* [ORC] Add findSymbolIn() wrapper to C bindings.Andres Freund2018-05-242-0/+30
| | | | | | | | | | | | In many cases JIT users will know in which module a symbol resides. Avoiding to search other modules can be more efficient. It also allows to handle duplicate symbol names between modules. Reviewed By: lhames Differential Revision: https://reviews.llvm.org/D44889 llvm-svn: 333147
* [LKH] Add a new IRTransformLayer.Lang Hames2018-05-232-0/+35
| | | | llvm-svn: 333129
* [LKH] Add ObjectTransformLayer2.Lang Hames2018-05-232-0/+35
| | | | llvm-svn: 333128
* [LKH] Add a new IRCompileLayer.Lang Hames2018-05-233-1/+46
| | | | llvm-svn: 333127
* [ORC] Move symbol-scanning and discard from BasicIRLayerMaterializationUnit inLang Hames2018-05-221-12/+14
| | | | | | | | | to a base class (IRMaterializationUnit). The new class, IRMaterializationUnit, provides a convenient base for any client that wants to write a materializer for LLVM IR. llvm-svn: 332993
* [LKH] Add a replacement RTDyldLayer.Lang Hames2018-05-212-0/+97
| | | | llvm-svn: 332918
* [ORC] Preserve Materializing symbol flag during resolution.Lang Hames2018-05-211-3/+4
| | | | llvm-svn: 332899
* [ORC] Lookup now returns an error if any symbols are not found.Lang Hames2018-05-211-2/+33
| | | | | | | | | | | Also tightens the behavior of ExecutionSession::failQuery. Queries can usually only be failed by marking a symbol as failed-to-materialize, but ExecutionSession::failQuery provides a second route, and both routes may be executed from different threads. In the case that a query has already been failed due to a materialization error, ExecutionSession::failQuery will direct the error to ExecutionSession::reportError instead. llvm-svn: 332898
* [ORC] Remove the optional MaterializationResponsibility argument from lookup.Lang Hames2018-05-211-16/+10
| | | | | | | | The lookup function provides blocking symbol resolution for JIT clients (not layers themselves) so it does not need to track symbol dependencies via a MaterializationResponsibility. llvm-svn: 332897
* [ORC] Add IRLayer and ObjectLayer interfaces and related MaterializationUnits.Lang Hames2018-05-212-0/+111
| | | | llvm-svn: 332896
* [ORC] Consolidate materialization errors, and generate them in VSO'sLang Hames2018-05-171-28/+17
| | | | | | | | | | | notifyFailed method rather than passing in an error generator. VSO::notifyFailed is responsible for notifying queries that they will not succeed due to error. In practice the queries don't care about the details of the failure, just the fact that a failure occurred for some symbols. Having VSO::notifyFailed take care of this simplifies the interface. llvm-svn: 332666
* [ORC] Rewrite the VSO symbol table yet again. Update related utilities.Lang Hames2018-05-164-438/+694
| | | | | | | | | | | | | | | | | | | VSOs now track dependencies for materializing symbols. Each symbol must have its dependencies registered with the VSO prior to finalization. Usually this will involve registering the dependencies returned in AsynchronousSymbolQuery::ResolutionResults for queries made while linking the symbols being materialized. Queries against symbols are notified that a symbol is ready once it and all of its transitive dependencies are finalized, allowing compilation work to be broken up and moved between threads without queries returning until their symbols fully safe to access / execute. Related utilities (VSO, MaterializationUnit, MaterializationResponsibility) are updated to support dependence tracking and more explicitly track responsibility for symbols from the point of definition until they are finalized. llvm-svn: 332541
* Remove @brief commands from doxygen comments, too.Adrian Prantl2018-05-011-1/+1
| | | | | | | | | | | | | | | | | This is a follow-up to r331272. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done https://reviews.llvm.org/D46290 llvm-svn: 331275
* IWYU for llvm-config.h in llvm, additions.Nico Weber2018-04-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See r331124 for how I made a list of files missing the include. I then ran this Python script: for f in open('filelist.txt'): f = f.strip() fl = open(f).readlines() found = False for i in xrange(len(fl)): p = '#include "llvm/' if not fl[i].startswith(p): continue if fl[i][len(p):] > 'Config': fl.insert(i, '#include "llvm/Config/llvm-config.h"\n') found = True break if not found: print 'not found', f else: open(f, 'w').write(''.join(fl)) and then looked through everything with `svn diff | diffstat -l | xargs -n 1000 gvim -p` and tried to fix include ordering and whatnot. No intended behavior change. llvm-svn: 331184
* [ORC] Fix an assertion condition from r329934.Lang Hames2018-04-191-2/+2
| | | | | | Thanks to Alexander Ivchenko for finding the issue! llvm-svn: 330359
* [ORC] Make VSO symbol resolution/finalization operations private.Lang Hames2018-04-191-85/+109
| | | | | | | | This forces these operations to be carried out via a MaterializationResponsibility instance, ensuring responsibility is explicitly tracked. llvm-svn: 330356
* [ORC] Add a MaterializationResponsibility class to track responsibility forLang Hames2018-04-163-58/+125
| | | | | | | | | | | | | | | | | materializing function definitions. MaterializationUnit instances are responsible for resolving and finalizing symbol definitions when their materialize method is called. By contract, the MaterializationUnit must materialize all definitions it is responsible for and no others. If it can not materialize all definitions (because of some error) then it must notify the associated VSO about each definition that could not be materialized. The MaterializationResponsibility class tracks this responsibility, asserting that all required symbols are resolved and finalized, and that no extraneous symbols are resolved or finalized. In the event of an error it provides a convenience method for notifying the VSO about each definition that could not be materialized. llvm-svn: 330142
* [ORC] Merge VSO notifyResolutionFailed and notifyFinalizationFailed in toLang Hames2018-04-161-35/+16
| | | | | | | | | notifyMaterializationFailed. The notifyMaterializationFailed method can determine which error to raise by looking at which queue the pending queries are in (resolution or finalization). llvm-svn: 330141
* [ORC] Use insert rather than emplace.Lang Hames2018-04-121-19/+19
| | | | | | | Hopefully this will fix the build failure at http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/9028 llvm-svn: 329944
* [ORC] Plumb error notifications through the VSO interface.Lang Hames2018-04-124-203/+327
| | | | | | | This allows materializers to notify the VSO that they were unable to resolve or finalize symbols. llvm-svn: 329934
* [ORC] Create a new SymbolStringPool by default in ExecutionSession constructor.Lang Hames2018-04-023-12/+3
| | | | | | This makes the common case of constructing an ExecutionSession tidier. llvm-svn: 329013
* [ORC] Fix ORC on platforms without indirection support.Lang Hames2018-03-281-1/+5
| | | | | | | | | | Previously this crashed because a nullptr (returned by createLocalIndirectStubsManagerBuilder() on platforms without indirection support) functor was unconditionally invoked. Patch by Andres Freund. Thanks Andres! llvm-svn: 328687
* [ORC] Don't fully qualify explicit destructor call -- it confuses some ↵Lang Hames2018-03-201-4/+2
| | | | | | | | | compilers. This should fix the builder failure at http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/19224 llvm-svn: 327955
* [ORC] Rename SymbolSource to MaterializationUnit, and make the materializationLang Hames2018-03-201-111/+167
| | | | | | | | | | | | | | | | | | | operation all-or-nothing, rather than allowing materialization on a per-symbol basis. This addresses a shortcoming of per-symbol materialization: If a MaterializationUnit (/SymbolSource) wants to materialize more symbols than requested (which is likely: most materializers will want to materialize whole modules) then it needs a way to notify the symbol table about the extra symbols being materialized. This process (checking what has been requested against what is being provided and notifying the symbol table about the difference) has to be repeated at every level of the JIT stack. Making materialization all-or-nothing eliminates this issue, simplifying both materializer implementations and the symbol table (VSO class) API. The cost is that per-symbol materialization (e.g. for individual symbols in a module) now requires multiple MaterializationUnits. llvm-svn: 327946
* [ORC] Re-apply r327566 with a fix for test-global-ctors.ll.Lang Hames2018-03-155-47/+69
| | | | | | Also clang-formats the patch, which I should have done the first time around. llvm-svn: 327594
* Revert "[ORC] Switch from shared_ptr to unique_ptr for addModule methods."Reid Kleckner2018-03-144-26/+40
| | | | | | | | | | | | | This reverts commit r327566, it breaks test/ExecutionEngine/OrcMCJIT/test-global-ctors.ll. The test doesn't crash with a stack trace, unfortunately. It merely returns 1 as the exit code. ASan didn't produce a report, and I reproduced this on my Linux machine and Windows box. llvm-svn: 327576
* [ORC] Switch from shared_ptr to unique_ptr for addModule methods.Lang Hames2018-03-144-40/+26
| | | | | | | Layer implementations typically mutate module state, and this is better reflected by having layers own the Module they are operating on. llvm-svn: 327566
OpenPOWER on IntegriCloud