summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ExecutionEngine/Orc
Commit message (Collapse)AuthorAgeFilesLines
...
* [ExecutionEngine] Make RuntimeDyld::MemoryManager responsible for tracking EHLang Hames2017-05-092-14/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | frames. RuntimeDyld was previously responsible for tracking allocated EH frames, but it makes more sense to have the RuntimeDyld::MemoryManager track them (since the frames are allocated through the memory manager, and written to memory owned by the memory manager). This patch moves the frame tracking into RTDyldMemoryManager, and changes the deregisterFrames method on RuntimeDyld::MemoryManager from: void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size); to: void deregisterEHFrames(); Separating this responsibility will allow ORC to continue to throw the RuntimeDyld instances away post-link (saving a few dozen bytes per lazy function) while properly deregistering frames when modules are unloaded. This patch also updates ORC to call deregisterEHFrames when modules are unloaded. This fixes a bug where an exception that tears down the JIT can then unwind through dangling EH frames that have been deallocated but not deregistered, resulting in UB. For people using SectionMemoryManager this should be pretty much a no-op. For people with custom allocators that override registerEHFrames/deregisterEHFrames, you will now be responsible for tracking allocated EH frames. Reviewed in https://reviews.llvm.org/D32829 llvm-svn: 302589
* Suppress all uses of LLVM_END_WITH_NULL. NFC.Serge Guelton2017-05-091-1/+1
| | | | | | | | | Use variadic templates instead of relying on <cstdarg> + sentinel. This enforces better type checking and makes code more readable. Differential Revision: https://reviews.llvm.org/D32541 llvm-svn: 302571
* [IR] Abstract away ArgNo+1 attribute indexing as much as possibleReid Kleckner2017-05-031-11/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Do three things to help with that: - Add AttributeList::FirstArgIndex, which is an enumerator currently set to 1. It allows us to change the indexing scheme with fewer changes. - Add addParamAttr/removeParamAttr. This just shortens addAttribute call sites that would otherwise need to spell out FirstArgIndex. - Remove some attribute-specific getters and setters from Function that take attribute list indices. Most of these were only used from BuildLibCalls, and doesNotAlias was only used to test or set if the return value is malloc-like. I'm happy to split the patch, but I think they are probably easier to review when taken together. This patch should be NFC, but it sets the stage to change the indexing scheme to this, which is more convenient when indexing into an array: 0: func attrs 1: retattrs 2...: arg attrs Reviewers: chandlerc, pete, javed.absar Subscribers: david2050, llvm-commits Differential Revision: https://reviews.llvm.org/D32811 llvm-svn: 302060
* [IR] Make paramHasAttr to use arg indices instead of attr indicesReid Kleckner2017-04-141-1/+1
| | | | | | | | | This avoids the confusing 'CS.paramHasAttr(ArgNo + 1, Foo)' pattern. Previously we were testing return value attributes with index 0, so I introduced hasReturnAttr() for that use case. llvm-svn: 300367
* [ORC] Re-enable the Error/Expected unit tests that were disabled in r300177.Lang Hames2017-04-141-135/+133
| | | | | | | | | | | | | The tests were failing due to an occasional deadlock in SerializationTraits for Error: Both serializers and deserializers were protected by a single mutex and in the unit test (where both ends of the RPC are in the same process) one side might obtain the mutex, then block waiting for input, leaving the other side of the connection unable to obtain the mutex to write the data the first side was waiting for. Splitting the mutex into two (one for serialization, one for deserialization) appears to have fixed the issue. llvm-svn: 300286
* [ORC] Temporarily disable the RPC Error/Expected unit tests while I investigateLang Hames2017-04-131-133/+135
| | | | | | bot failures. llvm-svn: 300177
* [ORC] Remove more extraneous semicolons from r300167, rename the RPC ExpectedLang Hames2017-04-131-4/+4
| | | | | | tests to be consistent with the Error tests. llvm-svn: 300173
* [ORC] Add RPC and serialization support for Errors and Expecteds.Lang Hames2017-04-131-0/+192
| | | | | | | | | | | | | | 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-3/+3
| | | | llvm-svn: 300155
* [Orc] Add missing header include for r299611.Lang Hames2017-04-061-0/+1
| | | | llvm-svn: 299623
* [Orc] Break QueueChannel out into its own header and add a utility,Lang Hames2017-04-064-83/+200
| | | | | | createPairedQueueChannels, to simplify channel creation in the RPC unit tests. llvm-svn: 299611
* [RuntimeDyld] Remove an unused static member left over from r299449.Lang Hames2017-04-051-2/+0
| | | | llvm-svn: 299497
* [RuntimeDyld] Make RuntimeDyld honor the ProcessAllSections flag.Lang Hames2017-04-043-6/+24
| | | | | | | | | | | | | | | When the ProcessAllSections flag (introduced in r204398) is set RuntimeDyld is supposed to make a call to the client's memory manager for every section in each object that is loaded. Due to some missing checks, this was not happening in all cases. This patch adds the missing cases, and fixes the Orc unit test that verifies correct behavior for ProcessAllSections (The unit test had been silently bailing out due to an ordering issue: a change in the test order meant that this unit-test was running before the native target was registered. This issue has also been fixed in this patch). This fixes <rdar://problem/22789965> llvm-svn: 299449
* Rename AttributeSet to AttributeListReid Kleckner2017-03-211-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This class is a list of AttributeSetNodes corresponding the function prototype of a call or function declaration. This class used to be called ParamAttrListPtr, then AttrListPtr, then AttributeSet. It is typically accessed by parameter and return value index, so "AttributeList" seems like a more intuitive name. Rename AttributeSetImpl to AttributeListImpl to follow suit. It's useful to rename this class so that we can rename AttributeSetNode to AttributeSet later. AttributeSet is the set of attributes that apply to a single function, argument, or return value. Reviewers: sanjoy, javed.absar, chandlerc, pete Reviewed By: pete Subscribers: pete, jholewinski, arsenm, dschuff, mehdi_amini, jfb, nhaehnle, sbc100, void, llvm-commits Differential Revision: https://reviews.llvm.org/D31102 llvm-svn: 298393
* [Orc][RPC] Accept both const char* and char* arguments for string serialization.Lang Hames2017-02-241-0/+45
| | | | llvm-svn: 296168
* [Orc] Rename ObjectLinkingLayer -> RTDyldObjectLinkingLayer.Lang Hames2017-02-203-13/+13
| | | | | | | | | | The current ObjectLinkingLayer (now RTDyldObjectLinkingLayer) links objects in-process using MCJIT's RuntimeDyld class. In the near future I hope to add new object linking layers (e.g. a remote linking layer that links objects in the JIT target process, rather than the client), so I'm renaming this class to be more descriptive. llvm-svn: 295636
* [Orc][RPC] Add a AsyncHandlerTraits specialization for non-value-type responseLang Hames2017-02-151-0/+51
| | | | | | | | | | handler args. The specialization just inherits from the std::decay'd response handler type. This allows member functions (via MemberFunctionWrapper) to be used as async handlers. llvm-svn: 295151
* [Orc][RPC] Remove lanch policies in favor of async handlers.Lang Hames2017-02-141-2/+48
| | | | | | | | | | | | | | | Launch policies provided a mechanism for running RPC handlers on a background thread (unblocking the main RPC receiver thread). Async handlers generalize this by passing the responder function (the function that sends the RPC return value) as an argument to the handler. The handler can optionally do its work on a background thread (the same way launch policies do), but can also (a) can inspect the call arguments before deciding to run the work on a different thread, or (b) can use the responder in a subsequent RPC call (e.g. in the handler of a callAsync), allowing the handler to call back to the originator (or to a 3rd party) without blocking the listener thread, and without launching a new thread. llvm-svn: 295030
* Silence redundant semicolon warnings. NFC.Michael Kuperstein2017-02-131-2/+2
| | | | llvm-svn: 295005
* [CMake] Fix pthread handling for out-of-tree buildsEric Fiselier2017-02-101-1/+1
| | | | | | | | | | | | | | | LLVM defines `PTHREAD_LIB` which is used by AddLLVM.cmake and various projects to correctly link the threading library when needed. Unfortunately `PTHREAD_LIB` is defined by LLVM's `config-ix.cmake` file which isn't installed and therefore can't be used when configuring out-of-tree builds. This causes such builds to fail since `pthread` isn't being correctly linked. This patch attempts to fix that problem by renaming and exporting `LLVM_PTHREAD_LIB` as part of`LLVMConfig.cmake`. I renamed `PTHREAD_LIB` because It seemed likely to cause collisions with downstream users of `LLVMConfig.cmake`. llvm-svn: 294690
* [Orc][RPC] Add a HandlerTratis specialization for free functions.Lang Hames2017-02-081-0/+9
| | | | llvm-svn: 294392
* [Orc][RPC] Refactor ParallelCallGroup to decouple it from RPCEndpoint.Lang Hames2017-01-241-8/+8
| | | | | | | | This refactor allows parallel calls to be made via an arbitrary async call dispatcher. In particular, this allows ParallelCallGroup to be used with derived RPC classes that expose custom async RPC call operations. llvm-svn: 292891
* [Orc][RPC] Add 'removeHandler' and 'clearHandlers' methods to RPC endpoints.Lang Hames2017-01-211-0/+26
| | | | | | | This can be used to free handler resources for handlers that won't be called again. llvm-svn: 292714
* unittest: remove extraneous ';'Saleem Abdulrasool2017-01-081-1/+1
| | | | | | Silences a warning from gcc:6. NFC llvm-svn: 291394
* [Orc][RPC] Fix typo.Lang Hames2017-01-081-1/+1
| | | | llvm-svn: 291381
* [Orc][RPC] Add an APICalls utility for grouping RPC funtions for registration.Lang Hames2017-01-081-2/+50
| | | | | | | | | | | | | APICalls allows groups of functions to be composed into an API that can be registered as a unit with an RPC endpoint. Doing registration on a-whole API basis (rather than per-function) allows missing API functions to be detected early. APICalls also allows Function membership to be tested at compile-time. This allows clients to write static assertions that functions to be called are members of registered APIs. llvm-svn: 291380
* [Orc][RPC] Rename Single/MultiThreadedRPC to Single/MultithreadedRPCEndpoint.Lang Hames2017-01-071-3/+2
| | | | llvm-svn: 291374
* [Orc][RPC] Add a ParallelCallGroup utility for dispatching and waiting onLang Hames2016-12-251-0/+71
| | | | | | | | | | | | | | | | 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][RPC] Actually specialize SerializationTraits and RPCTypeName in the rightLang Hames2016-12-211-24/+40
| | | | | | | | namespace. r290226 was a think-o - just qualifying the name doesn't count. llvm-svn: 290230
* [Orc][RPC] Specialize RPCTypeName and SerializationTraits in the right ↵Lang Hames2016-12-211-3/+3
| | | | | | namespace. llvm-svn: 290226
* [Orc] Add some static-assert checks to improve the error messages for RPC callsLang Hames2016-12-211-0/+126
| | | | | | | | and handler registrations. Also add a unit test for alternate-type serialization/deserialization. llvm-svn: 290223
* Remove a stale test case.Lang Hames2016-11-171-22/+0
| | | | llvm-svn: 287183
* [Orc] Re-enable the RPC unit test disabled in r286917.Lang Hames2016-11-161-168/+163
| | | | | | | | | This unit test infinite-looped on s390x due to a thread_yield being optimized out. I've updated the QueueChannel class (where thread_yield was called) to use a condition variable instead. This should cause the unit test to behave correctly. llvm-svn: 287121
* [ORC] Temporarily disable RPCUtils unit test.Lang Hames2016-11-151-152/+153
| | | | | | | This broke s390x due to a bug in the QueueChannel implementation that led to it infinite-looping. Disabling it while I look into a fix. llvm-svn: 286917
* [ORC] Add a WrappedHandlerReturn type to map handler return types onto errorLang Hames2016-11-121-1/+1
| | | | | | | | | | | | | return types. This class allows user provided handlers to return either error-wrapped types or plain types. In the latter case, the plain type is wrapped with a success value of Error or Expected<T> type to fit it into the rest of the serialization machinery. This patch allows us to remove the RPC unit-test workaround added in r286646. llvm-svn: 286701
* [ORC] Temporarily fix the RPCUtils unit test by explicitly specifying a handlerLang Hames2016-11-111-1/+1
| | | | | | | | | return type. This should be fixed permanently by having the RPCUtils header recognize the ErrorSuccess type. I'll commit that in a follow up patch. llvm-svn: 286646
* [ORC] Re-apply 286620 with fixes for the ErrorSuccess class.Lang Hames2016-11-111-86/+150
| | | | llvm-svn: 286639
* [ORC] Revert r286620 while I investigate a bot failure.Lang Hames2016-11-111-150/+86
| | | | llvm-svn: 286621
* [ORC] Refactor the ORC RPC utilities to add some new features.Lang Hames2016-11-111-86/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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
* [ORC] Fix the RPC unit test for header changes in r281171.Lang Hames2016-09-111-2/+2
| | | | llvm-svn: 281173
* Re-instate recent RPC updates (r280016, r280017, r280027, r280051) with aLang Hames2016-08-301-7/+7
| | | | | | workaround for the limitations of MSVC 2013's std::future class. llvm-svn: 280141
* Revert "[ORC][RPC] Make the future type of an Orc RPC call Error/Expected ↵Reid Kleckner2016-08-301-7/+7
| | | | | | | | | | | | | rather than" This reverts commit r280016, and the followups of r280017, r280027, r280051, r280058, and r280059. MSVC's implementation of std::promise does not get along with llvm::Error. It uses its promised value too much like a normal value type. llvm-svn: 280100
* [ORC][RPC] Reword 'async' to 'non-blocking' to better reflect call primitiveLang Hames2016-08-301-3/+3
| | | | | | | | | | | | | | behaviors, and add a callB (blacking call) primitive. callB is a blocking call primitive for threaded code where the RPC responses are being processed on a separate thread. (For single threaded code callST should continue to be used instead). No unit test yet: Last time I commited a threaded unit test it deadlocked on one of the s390x builders. I'll try to re-enable that test first, and add a new test if I can sort out the deadlock issue. llvm-svn: 280051
* [ORC] Fix unit-test breakage from r280016.Lang Hames2016-08-291-2/+2
| | | | | | | Void functions returning error now boolean convert to 'false' if they succeed. Unit tests updated to reflect this. llvm-svn: 280027
* [ORC][RPC] Make the future type of an Orc RPC call Error/Expected rather thanLang Hames2016-08-291-4/+4
| | | | | | | | | | | | | | | | Optional. For void functions the return type of a nonblocking call changes from Expected<future<Optional<bool>>> to Expected<future<Error>>, and for functions returning T the return type changes from Expected<future<Optional<T>>> to Expected<future<Expected<T>>>. Inner results need to be checked (since the RPC connection may have dropped out before a result came back) and Error/Expected provide stronger checking requirements. It also allows us drop the crufty 'optionalToError' function and just collapse Errors in the single-threaded call primitives. llvm-svn: 280016
* [Orc] Simplify LogicalDylib and move it back inside CompileOnDemandLayer. AlsoLang Hames2016-08-292-77/+0
| | | | | | | | | | | | | | | | | | | | switch to using one indirect stub manager per logical dylib rather than one per input module. LogicalDylib is a helper class used by the CompileOnDemandLayer to manage symbol resolution between modules during lazy compilation. In particular, it ensures that internal symbols resolve correctly even in the case where multiple input modules contain the same internal symbol name (which must to be promoted to external hidden linkage so that functions in any given module can be split out by lazy compilation). LogicalDylib's resolution scheme (before this commit) required one stub-manager per input module. This made recompilation of functions (by adding a module containing a new definition) difficult, as the stub manager for any given symbol was bound to the module that supplied the original definition. By using one stubs manager for the whole logical dylib symbols can be more easily replaced, although support for doing this is not included in this patch (it will be implemented in a follow up). llvm-svn: 279952
* [Orc] Explicitly specify type for assignment.Lang Hames2016-08-271-3/+3
| | | | | | | This should fix the MSVC errors in http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/15120 llvm-svn: 279908
* [ORC] Fix typo in LogicalDylib, add unit test.Lang Hames2016-08-272-0/+77
| | | | llvm-svn: 279892
* [ExecutionEngine][MCJIT][Orc] Replace RuntimeDyld::SymbolInfo with JITSymbol.Lang Hames2016-08-016-28/+30
| | | | | | | | | | | | | | | | This patch replaces RuntimeDyld::SymbolInfo with JITSymbol: A symbol class that is capable of lazy materialization (i.e. the symbol definition needn't be emitted until the address is requested). This can be used to support common and weak symbols in the JIT (though this is not implemented in this patch). For consistency, RuntimeDyld::SymbolResolver is renamed to JITSymbolResolver. For space efficiency a new class, JITEvaluatedSymbol, is introduced that behaves like the old RuntimeDyld::SymbolInfo - i.e. it is just a pair of an address and symbol flags. Instances of JITEvaluatedSymbol can be used in symbol-tables to avoid paying the space cost of the materializer. llvm-svn: 277386
* Fix warning in ObjectTransformLayerTest.Justin Lebar2016-07-131-1/+2
| | | | | | | | | | | | | | Doing "I++" inside of an EXPECT_* triggers warning: expression with side effects has no effect in an unevaluated context because EXPECT_* partially expands to EqHelper<(sizeof(::testing::internal::IsNullLiteralHelper(MockObjects[I++] + 1)) == 1)> which is an unevaluated context. llvm-svn: 275293
OpenPOWER on IntegriCloud