summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/Orc/OrcError.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Break out OrcError and RPCChris Bieneman2019-10-291-115/+0
| | | | | | | | | | | | | | | | | | | Summary: When createing an ORC remote JIT target the current library split forces the target process to link large portions of LLVM (Core, Execution Engine, JITLink, Object, MC, Passes, RuntimeDyld, Support, Target, and TransformUtils). This occurs because the ORC RPC interfaces rely on the static globals the ORC Error types require, which starts a cycle of pulling in more and more. This patch breaks the ORC RPC Error implementations out into an "OrcError" library which only depends on LLVM Support. It also pulls the ORC RPC headers into their own subdirectory. With this patch code can include the Orc/RPC/*.h headers and will only incur link dependencies on LLVMOrcError and LLVMSupport. Reviewers: lhames Reviewed By: lhames Subscribers: mgorny, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68732
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | 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. llvm-svn: 351636
* [ORC] Plumb error notifications through the VSO interface.Lang Hames2018-04-121-0/+2
| | | | | | | This allows materializers to notify the VSO that they were unable to resolve or finalize symbols. llvm-svn: 329934
* [ORC] Re-apply just the AsynchronousSymbolLookup class from r321838 while ILang Hames2018-01-051-2/+21
| | | | | | investigate builder / test failures. llvm-svn: 321910
* [ORC] Re-revert r321838: Tests are still failing.Lang Hames2018-01-051-21/+2
| | | | llvm-svn: 321858
* [ORC] Re-apply r321838 - Addition of new ORC core APIs.Lang Hames2018-01-051-2/+21
| | | | | | | | The original commit broke the builders due to a think-o in an assertion: AsynchronousSymbolQuery's constructor needs to check the callback member variables, not the constructor arguments. llvm-svn: 321853
* Revert r321838 -- It broke some of the builders.Lang Hames2018-01-051-21/+2
| | | | llvm-svn: 321842
* [ORC] Add new core ORC APIs (Core.h/Core.cpp): VSO, AsynchronousSymbolQuery andLang Hames2018-01-051-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SymbolSource. These new APIs are a first stab at tackling some current shortcomings of ORC, especially in performance and threading support. VSO (Virtual Shared Object) is a symbol table representing the symbol definitions of a set of modules that behave as if they had been statically linked together into a shared object or dylib. Symbol definitions, either pre-defined addresses or lazy definitions, can be added and queries for symbol addresses made. The table applies the same linkage strength rules that static linkers do when constructing a dylib or shared object: duplicate definitions result in errors, strong definitions override weak or common ones. This class should improve symbol lookup speed by providing centralized symbol tables (as compared to the findSymbol implementation in the in-tree ORC layers, which maintain one symbol table per object file / module added). AsynchronousSymbolQuery is a query for the addresses of a set of symbols. Query results are returned via a callback once they become available. Querying for a set of symbols, rather than one symbol at a time (as the current lookup scheme does) the JIT has the opportunity to make better use of available resources (e.g. by spawning multiple jobs to materialize the requested symbols if possible). Returning results via a callback makes queries asynchronous, so queries from multiple threads of JIT'd code can proceed simultaneously. SymbolSource represents a source of symbol definitions. It is used when adding lazy symbol definitions to a VSO. Symbol definitions can be materialized when needed or discarded if a stronger definition is found. Materializing on demand via SymbolSources should (eventually) allow us to remove the lazy materializers from JITSymbol, which will in turn allow the removal of many current error checks and reduce the number of RPC round-trips involved in materializing remote symbols. Adding a discard function allows sources to discard symbol definitions (or mark them as available_externally), reducing the amount of redundant code generated by the JIT for ODR symbols. llvm-svn: 321838
* [ORC] Add a pair of ORC layers that forward object-layer operations via RPC.Lang Hames2017-09-051-0/+2
| | | | | | | | | | | | | | | | | This patch introduces RemoteObjectClientLayer and RemoteObjectServerLayer, which can be used to forward ORC object-layer operations from a JIT stack in the client to a JIT stack (consisting only of object-layers) in the server. This is a new way to support remote-JITing in LLVM. The previous approach (supported by OrcRemoteTargetClient and OrcRemoteTargetServer) used a remote-mapping memory manager that sat "beneath" the JIT stack and sent fully-relocated binary blobs to the server. The main advantage of the new approach is that relocatable objects can be cached on the server and re-used (if the code that they represent hasn't changed), whereas fully-relocated blobs can not (since the addresses they have been permanently bound to will change from run to run). llvm-svn: 312511
* [ORC] Errorize the ORC APIs.Lang Hames2017-07-071-0/+21
| | | | | | | | This patch updates the ORC layers and utilities to return and propagate llvm::Errors where appropriate. This is necessary to allow ORC to safely handle error cases in cross-process and remote JITing. llvm-svn: 307350
* [ORC] Add RPC and serialization support for Errors and Expecteds.Lang Hames2017-04-131-0/+3
| | | | | | | | | | | | | | This patch allows Error and Expected types to be passed to and returned from RPC functions. Serializers and deserializers for custom error types (types deriving from the ErrorInfo class template) can be registered with the SerializationTraits for a given channel type (see registerStringError in RPCSerialization.h for an example), allowing a given custom type to be sent/received. Unregistered types will be serialized/deserialized as StringErrors using the custom type's log message as the error string. llvm-svn: 300167
* [ORC] Use native Errors rather than converted std::error_codes for ORC RPC.Lang Hames2017-04-131-19/+4
| | | | llvm-svn: 300155
* [Orc] Make orcError return an error_code rather than Error.Lang Hames2017-04-061-6/+3
| | | | | | | This will allow orcError to be used in convertToErrorCode implementations, which will help in transitioning Orc RPC to Error. llvm-svn: 299610
* [Orc][RPC] Add an RPCFunctionNotSupported error type and return it fromLang Hames2017-01-151-0/+20
| | | | | | | | | | negotiateFunction where appropriate. Replacing the old ECError with a custom type allows us to attach the name of the function that could not be negotiated, enabling better diagnostics for negotiation failures. llvm-svn: 292055
* [Orc][RPC] Add a ParallelCallGroup utility for dispatching and waiting onLang Hames2016-12-251-0/+2
| | | | | | | | | | | | | | | | multiple asynchronous RPC calls. ParallelCallGroup allows multiple asynchronous calls to be dispatched, and provides a wait method that blocks until all asynchronous calls have been executed on the remote and all return value handlers run on the local machine. This will allow, for example, the JIT client to issue memory allocation calls for all sections in parallel, then block until all memory has been allocated on the remote and the allocated addresses registered with the client, at which point the JIT client can proceed to applying relocations. llvm-svn: 290523
* [ORC] Re-apply 286620 with fixes for the ErrorSuccess class.Lang Hames2016-11-111-0/+2
| | | | llvm-svn: 286639
* [ORC] Revert r286620 while I investigate a bot failure.Lang Hames2016-11-111-2/+0
| | | | llvm-svn: 286621
* [ORC] Refactor the ORC RPC utilities to add some new features.Lang Hames2016-11-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (1) Add support for function key negotiation. The previous version of the RPC required both sides to maintain the same enumeration for functions in the API. This means that any version skew between the client and server would result in communication failure. With this version of the patch functions (and serializable types) are defined with string names, and the derived function signature strings are used to negotiate the actual function keys (which are used for efficient call serialization). This allows clients to connect to any server that supports a superset of the API (based on the function signatures it supports). (2) Add a callAsync primitive. The callAsync primitive can be used to install a return value handler that will run as soon as the RPC function's return value is sent back from the remote. (3) Launch policies for RPC function handlers. The new addHandler method, which installs handlers for RPC functions, takes two arguments: (1) the handler itself, and (2) an optional "launch policy". When the RPC function is called, the launch policy (if present) is invoked to actually launch the handler. This allows the handler to be spawned on a background thread, or added to a work list. If no launch policy is used, the handler is run on the server thread itself. This should only be used for short-running handlers, or entirely synchronous RPC APIs. (4) Zero cost cross type serialization. You can now define serialization from any type to a different "wire" type. For example, this allows you to call an RPC function that's defined to take a std::string while passing a StringRef argument. If a serializer from StringRef to std::string has been defined for the channel type this will be used to serialize the argument without having to construct a std::string instance. This allows buffer reference types to be used as arguments to RPC calls without requiring a copy of the buffer to be made. llvm-svn: 286620
* Remove LLVM_NOEXCEPT and replace it with noexceptReid Kleckner2016-10-191-1/+1
| | | | | | | Now that we have dropped MSVC 2013, all supported compilers support noexcept and we can drop this portability macro. llvm-svn: 284672
* Add FIXMEs to all derived classes of std::error_category.Peter Collingbourne2016-05-241-0/+3
| | | | | | | | This helps make clear that we're moving away from std::error_code. Differential Revision: http://reviews.llvm.org/D20592 llvm-svn: 270604
* [ORC] clang-format code that was touched in r267457. NFC.Lang Hames2016-04-251-2/+2
| | | | | | | Commit r267457 made a lot of type-substitutions threw off code formatting and alignment. This patch should tidy those changes up. llvm-svn: 267475
* [ORC] Thread Error/Expected through the RPC library.Lang Hames2016-04-251-2/+3
| | | | | | | | | | This replaces use of std::error_code and ErrorOr in the ORC RPC support library with Error and Expected. This required updating the OrcRemoteTarget API, Client, and server code, as well as updating the Orc C API. This patch also fixes several instances where Errors were dropped. llvm-svn: 267457
* [Orc] Re-commit r266581 with fixes for MSVC, and format cleanups.Lang Hames2016-04-181-0/+2
| | | | | | | | | | Fixes: (1) Removes constexpr (unsupported in MSVC) (2) Move constructors (remove explicitly defaulted ones) (3) <future> - Add warning suppression for MSVC. llvm-svn: 266663
* Revert 266581 (and follow-up 266588), it doesn't build on Windows.Nico Weber2016-04-181-2/+0
| | | | | | | | | | Three problems: 1. <future> can't be easily used. If you must use it, see include/Support/ThreadPool.h for how. 2. constexpr problems, even after 266588. 3. Move assignment operators can't be defaulted in MSVC2013. llvm-svn: 266615
* [ORC] Generalize the ORC RPC utils to support RPC function return values andLang Hames2016-04-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | asynchronous call/handle. Also updates the ORC remote JIT API to use the new scheme. The previous version of the RPC tools only supported void functions, and required the user to manually call a paired function to return results. This patch replaces the Procedure typedef (which only supported void functions) with the Function typedef which supports return values, e.g.: Function<FooId, int32_t(std::string)> Foo; The RPC primitives and channel operations are also expanded. RPC channels must support four new operations: startSendMessage, endSendMessage, startRecieveMessage and endRecieveMessage, to handle channel locking. In addition, serialization support for tuples to RPCChannels is added to enable multiple return values. The RPC primitives are expanded from callAppend, call, expect and handle, to: appendCallAsync - Make an asynchronous call to the given function. callAsync - The same as appendCallAsync, but calls send on the channel when done. callSTHandling - Blocking call for single-threaded code. Wraps a call to callAsync then waits on the result, using a user-supplied handler to handle any callbacks from the remote. callST - The same as callSTHandling, except that it doesn't handle callbacks - it expects the result to be the first return. expect and handle - as before. handleResponse - Handle a response from the remote. waitForResult - Wait for the response with the given sequence number to arrive. llvm-svn: 266581
* [Orc] Add error codes and a new std::error_category for remote-jit errors.Lang Hames2016-01-111-0/+57
These will be used by an upcoming patch that adds remote-jit support utilities to ORC. llvm-svn: 257297
OpenPOWER on IntegriCloud