summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Remove TypeBuilder.h, and fix the few locations using it.James Y Knight2019-01-131-15/+5
| | | | | | | | | | | | | | This shortcut mechanism for creating types was added 10 years ago, but has seen almost no uptake since then, neither internally nor in external projects. The very small number of characters saved by using it does not seem worth the mental overhead of an additional type-creation API, so, delete it. Differential Revision: https://reviews.llvm.org/D56573 llvm-svn: 351020
* [ORC] Make the VModuleKey optional, propagate it via MaterializationUnit andLang Hames2018-10-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 344643
* [ORC] Pass symbol name to discard by const reference.Lang Hames2018-10-061-1/+2
| | | | | | This saves some unnecessary atomic ref-counting operations. llvm-svn: 343927
* [ORC] Add an 'intern' method to ExecutionEngine for interning symbol names.Lang Hames2018-09-301-4/+4
| | | | | | | This cuts down on boilerplate by reducing 'ES.getSymbolStringPool().intern(...)' to 'ES.intern(...)'. llvm-svn: 343427
* [ORC] Fix the unit tests that were broken by r343323.Lang Hames2018-09-281-0/+2
| | | | llvm-svn: 343326
* [ORC] Add a "lazy call-through" utility based on the same underlying trampolineLang Hames2018-09-261-0/+38
| | | | | | | | | | | | | | | | | | | | implementation as lazy compile callbacks, and a "lazy re-exports" utility that builds lazy call-throughs. Lazy call-throughs are similar to lazy compile callbacks (and are based on the same underlying state saving/restoring trampolines) but resolve their targets by performing a standard ORC lookup rather than invoking a user supplied compiler callback. This allows them to inherit the thread-safety of ORC lookups while blocking only the calling thread (whereas compile callbacks also block one compile thread). Lazy re-exports provide a simple way of building lazy call-throughs. Unlike a regular re-export, a lazy re-export generates a new address (a stub entry point) that will act like the re-exported symbol when called. The first call via a lazy re-export will trigger compilation of the re-exported symbol before calling through to it. llvm-svn: 343061
* [ORC] Add a special 'main' JITDylib that is created on ExecutionSessionLang Hames2018-09-121-2/+2
| | | | | | | | | | | | | | | | | | | | | construction, a new convenience lookup method, and add-to layer methods. ExecutionSession now creates a special 'main' JITDylib upon construction. All subsequently created JITDylibs are added to the main JITDylib's search order by default (controlled by the AddToMainDylibSearchOrder parameter to ExecutionSession::createDylib). The main JITDylib's search order will be used in the future to properly handle cross-JITDylib weak symbols, with the first definition in this search order selected. This commit also adds a new ExecutionSession::lookup convenience method that performs a blocking lookup using the main JITDylib's search order, as this will be a very common operation for clients. Finally, new convenience overloads of IRLayer and ObjectLayer's add methods are introduced that add the given program representations to the main dylib, which is likely to be the common case. llvm-svn: 342086
* [ORC] Rename VSO to JITDylib.Lang Hames2018-08-171-2/+2
| | | | | | | | | | | | | VSO was a little close to VDSO (an acronym on Linux for Virtual Dynamic Shared Object) for comfort. It also risks giving the impression that instances of this class could be shared between ExecutionSessions, which they can not. JITDylib seems moderately less confusing, while still hinting at how this class is intended to be used, i.e. as a JIT-compiled stand-in for a dynamic library (code that would have been a dynamic library if you had wanted to compile it ahead of time). llvm-svn: 340084
* [ORC] Replace SymbolResolvers in the new ORC layers with search orders on VSOs.Lang Hames2018-07-201-1/+41
| | | | | | | | | | | | | | | A search order is a list of VSOs to be searched linearly to find symbols. Each VSO now has a search order that will be used when fixing up definitions in that VSO. Each VSO's search order defaults to just that VSO itself. This is a first step towards removing symbol resolvers from ORC altogether. In practice symbol resolvers tended to be used to implement a search order anyway, sometimes with additional programatic generation of symbols. Now that VSOs support programmatic generation of definitions via fallback generators, search orders provide a cleaner way to achieve the desired effect (while removing a lot of boilerplate). llvm-svn: 337593
* [ORC] Update JITCompileCallbackManager to support multi-threaded code.Lang Hames2018-05-301-1/+2
| | | | | | | | | 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] Restore the narrower check from before r328687.Lang Hames2018-03-281-1/+2
| | | | | | | This should get the builders green again while I investigate why r328706 was insufficient. llvm-svn: 328711
* [ORC] Re-add the Windows check that was dropped in r328687.Lang Hames2018-03-281-0/+4
| | | | | | | | | This check prevents the ORC execution tests from running on Windows (which is not supported yet). This should fix the windows bots. llvm-svn: 328706
* [ORC] Fix ORC on platforms without indirection support.Lang Hames2018-03-281-3/+10
| | | | | | | | | | 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] Update the GlobalMappingLayer interface to fit the error-ized layerLang Hames2017-09-281-50/+40
| | | | | | | | | concept. Add a unit-test to make sure we don't backslide, and tweak the MockBaseLayer utility to make it easier to test this kind of thing in the future. llvm-svn: 314374
* [ORC] Errorize the ORC APIs.Lang Hames2017-07-071-9/+20
| | | | | | | | 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] Re-apply r306166 and r306168 with fix for regression test.Lang Hames2017-06-231-24/+24
| | | | llvm-svn: 306182
* This reverts commit r306166 and r306168.Rafael Espindola2017-06-231-24/+24
| | | | | | | | | Revert "[ORC] Remove redundant semicolons from DEFINE_SIMPLE_CONVERSION_FUNCTIONS uses." Revert "[ORC] Move ORC IR layer interface from addModuleSet to addModule and fix the module type as std::shared_ptr<Module>." They broke ExecutionEngine/OrcMCJIT/test-global-ctors.ll on linux. llvm-svn: 306176
* [ORC] Move ORC IR layer interface from addModuleSet to addModule and fix theLang Hames2017-06-231-24/+24
| | | | | | module type as std::shared_ptr<Module>. llvm-svn: 306166
* Re-sort #include lines for unittests. This uses a slightly modifiedChandler Carruth2017-06-061-2/+2
| | | | | | | | | | | | | | | clang-format (https://reviews.llvm.org/D33932) to keep primary headers at the top and handle new utility headers like 'gmock' consistently with other utility headers. No other change was made. I did no manual edits, all of this is clang-format. This should allow other changes to have more clear and focused diffs, and is especially motivated by moving some headers into more focused libraries. llvm-svn: 304786
* 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
* [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-041-4/+16
| | | | | | | | | | | | | | | 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
* [ExecutionEngine][MCJIT][Orc] Replace RuntimeDyld::SymbolInfo with JITSymbol.Lang Hames2016-08-011-3/+3
| | | | | | | | | | | | | | | | 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
* Remove every uses of getGlobalContext() in LLVM (but the C API)Mehdi Amini2016-04-141-0/+1
| | | | | | | | | | | At the same time, fixes InstructionsTest::CastInst unittest: yes you can leave the IR in an invalid state and exit when you don't destroy the context (like the global one), no longer now. This is the first part of http://reviews.llvm.org/D19094 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266379
* [Orc] Add lazy-JITting support for i386.Lang Hames2016-02-101-1/+3
| | | | | | | | | | | This patch adds a new class, OrcI386, which contains the hooks needed to support lazy-JITing on i386 (currently only for Pentium 2 or above, as the JIT re-entry code uses the FXSAVE/FXRSTOR instructions). Support for i386 is enabled in the LLI lazy JIT and the Orc C API, and regression and unit tests are enabled for this architecture. llvm-svn: 260338
* [Orc] Try to turn Orc execution unit tests back on for Linux.Lang Hames2016-01-201-1/+1
| | | | | | | The fix in r258324 (plus r258354) should allow Orc execution tests to run on Linux. llvm-svn: 258358
* [Orc] Revert r258031 - it broke the builders.Lang Hames2016-01-181-1/+1
| | | | llvm-svn: 258034
* [Orc] Enable ORC execution unit tests on non-windows platforms.Lang Hames2016-01-181-1/+1
| | | | | | | | | | | Previously these were Darwin-only. Since the switch to direct binary emission of stubs, trampolines and resolver blocks, these should work on other *nix platforms too. These tests can be enabled on Windows once known issues with ORC's handling of Windows symbol mangling (see e.g. https://llvm.org/PR25940) have been fixed. llvm-svn: 258031
* [Orc][RuntimeDyld] Prevent duplicate calls to finalizeMemory on shared memoryLang Hames2016-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | managers. Prior to this patch, recursive finalization (where finalization of one RuntimeDyld instance triggers finalization of another instance on which the first depends) could trigger memory access failures: When the inner (dependent) RuntimeDyld instance and its memory manager are finalized, memory allocated (but not yet relocated) by the outer instance is locked, and relocation in the outer instance fails with a memory access error. This patch adds a latch to the RuntimeDyld::MemoryManager base class that is checked by a new method: RuntimeDyld::finalizeWithMemoryManagerLocking, ensuring that shared memory managers are only finalized by the outermost RuntimeDyld instance. This allows ORC clients to supply the same memory manager to multiple calls to addModuleSet. In particular it enables the use of user-supplied memory managers with the CompileOnDemandLayer which must reuse the supplied memory manager for each function that is lazily compiled. llvm-svn: 257263
* [Orc] Expose the compile callback API through the C bindings.Lang Hames2015-10-301-14/+11
| | | | llvm-svn: 251683
* [Orc] Require target support for host before running execution unit tests.Lang Hames2015-10-281-3/+6
| | | | | | | Orc unit tests that execute code shouldn't run if the compiler doesn't have target support for the host machine. llvm-svn: 251551
* Fix a -Wpessimizing-move warning.Craig Topper2015-10-281-1/+1
| | | | llvm-svn: 251495
* [Orc] Disable Orc C API unit tests on non-Darwin while I investigate moreLang Hames2015-10-281-1/+1
| | | | | | builder failures. llvm-svn: 251484
* [Orc] Re-add C bindings for the Orc APIs, with a fix to remove the union thatLang Hames2015-10-281-2/+33
| | | | | | | | | was causing builder failures. The bindings were originally added in r251472, and reverted in r251473 due to the builder failures. llvm-svn: 251482
* [Orc] Revert the C bindngs commit, r251472, while I debug some builder failures.Lang Hames2015-10-281-33/+2
| | | | llvm-svn: 251473
* [Orc] Add experimental C bindings for Orc.Lang Hames2015-10-281-2/+33
| | | | llvm-svn: 251472
* [Orc] Fix indentation.Lang Hames2015-10-271-35/+35
| | | | llvm-svn: 251423
* [Orc] Make CompileOnDemandLayer::findSymbol call BaseLayer::findSymbol if noLang Hames2015-10-201-0/+82
| | | | | | symbol definition is found in the logical dylibs. llvm-svn: 250796
* s/NULL/nullptr/ in OrcTestCommon.h to silence -Wsentinel in clang-clReid Kleckner2015-04-211-1/+2
| | | | llvm-svn: 235386
* [Orc] Make the makeStub function propagate argument attributes onto the call toLang Hames2015-04-201-0/+65
the function body. This is necessary for correctness when lazily compiling. Also, flesh out the Orc unit test infrastructure slightly, and add a unit test for this. llvm-svn: 235347
OpenPOWER on IntegriCloud