summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
Commit message (Collapse)AuthorAgeFilesLines
...
* Update to use new name alignTo().Rui Ueyama2016-01-141-3/+1
| | | | llvm-svn: 257804
* [LLI] Replace the LLI remote-JIT support with the new ORC remote-JIT components.Lang Hames2016-01-111-0/+5
| | | | | | | | The new ORC remote-JITing support provides a superset of the old code's functionality, so we can replace the old stuff. As a bonus, a couple of previously XFAILed tests have started passing. llvm-svn: 257343
* [Orc] Add support for remote JITing to the ORC API.Lang Hames2016-01-112-0/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds utilities to ORC for managing a remote JIT target. It consists of: 1. A very primitive RPC system for making calls over a byte-stream. See RPCChannel.h, RPCUtils.h. 2. An RPC API defined in the above system for managing memory, looking up symbols, creating stubs, etc. on a remote target. See OrcRemoteTargetRPCAPI.h. 3. An interface for creating high-level JIT components (memory managers, callback managers, stub managers, etc.) that operate over the RPC API. See OrcRemoteTargetClient.h. 4. A helper class for building servers that can handle the RPC calls. See OrcRemoteTargetServer.h. The system is designed to work neatly with the existing ORC components and functionality. In particular, the ORC callback API (and consequently the CompileOnDemandLayer) is supported, enabling lazy compilation of remote code. Assuming this doesn't trigger any builder failures, a follow-up patch will be committed which tests these utilities by using them to replace LLI's existing remote-JITing demo code. llvm-svn: 257305
* [Orc] Rename OrcTargetSupport to OrcArchitectureSupport to avoid confusion withLang Hames2016-01-113-4/+4
| | | | | | the upcoming remote-target support classes. llvm-svn: 257302
* [Orc] Add error codes and a new std::error_category for remote-jit errors.Lang Hames2016-01-112-0/+58
| | | | | | | These will be used by an upcoming patch that adds remote-jit support utilities to ORC. llvm-svn: 257297
* [RuntimeDyld] Add a notifyObjectLoaded method to RuntimeDyld::MemoryManager.Lang Hames2016-01-101-1/+3
| | | | | | | | This is a more generic version of the MCJITMemoryManager::notifyObjectLoaded method: It provides only a RuntimeDyld reference (rather than an ExecutionEngine), and so can be used with ORC JIT stacks. llvm-svn: 257296
* [RuntimeDyld] Add alignment arguments to the reserveAllocationSpace method ofLang Hames2016-01-103-20/+28
| | | | | | | | | | | | | | RuntimeDyld::MemoryManager. The RuntimeDyld::MemoryManager::reserveAllocationSpace method is called when object files are loaded, and gives clients a chance to pre-allocate memory for all segments. Previously only the size of each segment (code, ro-data, rw-data) was supplied but not the alignment. This hasn't caused any problems so far, as most clients allocate via the MemoryBlock interface which returns page-aligned blocks. Adding alignment arguments enables finer grained allocation while still satisfying alignment restrictions. llvm-svn: 257294
* [SectionMemoryManager] Don't just drop the RO free listKeno Fischer2016-01-101-3/+0
| | | | | | | | | | | | | In r255760, I optimized the SectionMemoryManager to make better use of virtual memory on platforms where the allocation granularity was bigger than the protection granularity. As part of this, fixing up the free list became more complicated and was moved into `applyMemoryGroupPermissions`. Unfortunately, I forgot to actually remove the call that drops the free list for RO memory (I did remove the corresponding one for RX memory), defeating the whole optimization. llvm-svn: 257293
* [Orc] Enable user-supplied memory managers in the CompileOnDemand layer.Lang Hames2016-01-091-1/+2
| | | | | | | Previously the CompileOnDemand layer was hard-coded to use a new SectionMemoryManager for each function when it was called. llvm-svn: 257265
* [Orc][RuntimeDyld] Prevent duplicate calls to finalizeMemory on shared memoryLang Hames2016-01-091-0/+11
| | | | | | | | | | | | | | | | | | | | | | | 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
* Delete APIs that have been deprecated since 2010.Rafael Espindola2015-12-191-42/+0
| | | | llvm-svn: 256107
* Drop materializeAllPermanently.Rafael Espindola2015-12-181-1/+1
| | | | | | | | This inlines materializeAll into the only caller (materializeAllPermanently) and renames materializeAllPermanently to just materializeAll. llvm-svn: 256024
* [SectionMemoryManager] Make better use of virtual memoryKeno Fischer2015-12-161-23/+66
| | | | | | | | | | | | | | | | | Summary: On Windows, the allocation granularity can be significantly larger than a page (64K), so with many small objects, just clearing the FreeMem list rapidly leaks quite a bit of virtual memory space (if not rss). Fix that by only removing those parts of the FreeMem blocks that overlap pages for which we are applying memory permissions, rather than dropping the FreeMem blocks entirely. Reviewers: lhames Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D15202 llvm-svn: 255760
* [Orc] Rename IndirectStubsManagerBase to IndirectStubsManager.Lang Hames2015-12-063-3/+4
| | | | | | No functional change. llvm-svn: 254885
* Use make_range to reduce mentions of iterator type. NFCCraig Topper2015-12-061-1/+1
| | | | llvm-svn: 254872
* [Orc] Rename JITCompileCallbackManagerBase to JITCompileCallbackManager.Lang Hames2015-12-043-3/+3
| | | | | | | | | This class is turning into a useful interface, rather than an implementation detail, so I'm dropping the 'Base' suffix. No functional change. llvm-svn: 254693
* [RuntimeDyld] DenseMap -> std::unordered_mapKeno Fischer2015-12-032-3/+4
| | | | | | | | | | | DenseMap is most applicable when both keys and values are small. In this case, the value violates that assumption, causing quite significant memory overhead. A std::unordered_map is more appropriate in this case (or at least fixed the memory problems I was seeing). Differential Revision: http://reviews.llvm.org/D14910 llvm-svn: 254651
* [RuntimeDyld] Fix a class of arithmetic errors introduced in r253918Sanjoy Das2015-11-241-4/+4
| | | | | | | | | | | r253918 had refactored expressions like "A - B.Address + C" to "A - B.getAddressWithOffset(C)". This is incorrect, since the latter really computes "A - B.Address - C". None of the tests I can run locally on x86 broke due to this bug, but it is the current suspect for breakage on the AArch64 buildbots. llvm-svn: 254017
* [RuntimeDyld] Avoid unused-private-field warning; NFCSanjoy Das2015-11-231-1/+5
| | | | | | Fixes the no asserts -Werror,-Wunused-private-field build. llvm-svn: 253933
* [RuntimeDyld] Don't allocate unnecessary stub buffer spaceSanjoy Das2015-11-234-4/+29
| | | | | | | | | | | | | | Summary: For relocation types that are known to not require stub functions, there is no need to allocate extra space for the stub functions. Reviewers: lhames, reames, maksfb Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14676 llvm-svn: 253920
* [RuntimeDyld] Add bounds checking to SectionEntry::advanceStubOffsetSanjoy Das2015-11-233-7/+19
| | | | | | | | | | | | | | Summary: Change SectionEntry to keep track of the size of its underlying allocation, and use that to bounds check advanceStubOffset. Reviewers: lhames, andrew.w.kaylor, reames Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14675 llvm-svn: 253919
* [RuntimeDyld] Add accessors to `SectionEntry`; NFCSanjoy Das2015-11-2312-223/+266
| | | | | | | | | | | | | | | | Summary: Remove naked access to the data members in `SectionEntry` and route accesses through accessor functions. This makes it obvious how the instances of the class are used, and will also facilitate adding bounds checking to `advanceStubOffset` in a later change. Reviewers: lhames, loladiro, andrew.w.kaylor Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14674 llvm-svn: 253918
* [RuntimeDyld] Fix resolving R_PPC64_REL24 relocationsUlrich Weigand2015-11-171-3/+3
| | | | | | | | | | | | | | | When resolving R_PPC64_REL24, code used to check for an address delta that fits in 24 bits, while the instructions that take this relocation actually can process address deltas that fit into *26* bits (as those instructions have a 24 bit field, but implicitly append two zero bits at the end since all instruction addresses are a multiple of 4). This means that code would signal overflow once a single object's text section exceeds 8 MB, while we can actually support up to 32 MB. Partially fixes PR25540. llvm-svn: 253369
* [RuntimeDyld] Fix indentation and whitespace; NFCSanjoy Das2015-11-141-21/+22
| | | | | | Whitespace-only change. llvm-svn: 253105
* [RuntimeDyld] Add support for R_X86_64_PC8 relocation.Maksim Panchenko2015-11-081-0/+8
| | | | llvm-svn: 252423
* Refactor: Simplify boolean conditional return statements in ↵Alexander Kornienko2015-11-051-3/+1
| | | | | | | | | | lib/llvm/ExecutionEngine/Orc Patch by Richard Thomson! Differential revision: http://reviews.llvm.org/D9973 llvm-svn: 252212
* Reapply r250906 with many suggested updates from Rafael Espindola.Kevin Enderby2015-11-052-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The needed lld matching changes to be submitted immediately next, but this revision will cause lld failures with this alone which is expected. This removes the eating of the error in Archive::Child::getSize() when the characters in the size field in the archive header for the member is not a number. To do this we have all of the needed methods return ErrorOr to push them up until we get out of lib. Then the tools and can handle the error in whatever way is appropriate for that tool. So the solution is to plumb all the ErrorOr stuff through everything that touches archives. This include its iterators as one can create an Archive object but the first or any other Child object may fail to be created due to a bad size field in its header. Thanks to Lang Hames on the changes making child_iterator contain an ErrorOr<Child> instead of a Child and the needed changes to ErrorOr.h to add operator overloading for * and -> . We don’t want to use llvm_unreachable() as it calls abort() and is produces a “crash” and using report_fatal_error() to move the error checking will cause the program to stop, neither of which are really correct in library code. There are still some uses of these that should be cleaned up in this library code for other than the size field. The test cases use archives with text files so one can see the non-digit character, in this case a ‘%’, in the size field. These changes will require corresponding changes to the lld project. That will be committed immediately after this change. But this revision will cause lld failures with this alone which is expected. llvm-svn: 252192
* RuntimeDyld: fix -Wtype-limitsSaleem Abdulrasool2015-11-051-2/+2
| | | | | | | Adjust the casted type. By casting to the same size rather than just the signed-ness, we were asserting tautological statements. NFC. llvm-svn: 252150
* Revert "Revert "[Orc] Directly emit machine code for the x86 resolver block ↵Rafael Espindola2015-11-034-150/+90
| | | | | | | | | | and trampolines."" This reverts commit r251937. The test was updated to the new API, bring the API back. llvm-svn: 251944
* Revert "[Orc] Directly emit machine code for the x86 resolver block and ↵Rafael Espindola2015-11-034-90/+150
| | | | | | | | | | trampolines." This reverts commit r251933. It broke the build of examples/Kaleidoscope/Orc/fully_lazy/toy.cpp. llvm-svn: 251937
* [Orc] Directly emit machine code for the x86 resolver block and trampolines.Lang Hames2015-11-034-150/+90
| | | | | | | | | | | | | | Bypassing LLVM for this has a number of benefits: 1) Laziness support becomes asm-syntax agnostic (previously lazy jitting didn't work on Windows as the resolver block was in Darwin asm). 2) For cross-process JITs, it allows resolver blocks and trampolines to be emitted directly in the target process, reducing cross process traffic. 3) It should be marginally faster. llvm-svn: 251933
* RuntimeDyld: add COFF i386 supportSaleem Abdulrasool2015-11-012-0/+202
| | | | | | | This adds support for COFF I386. This is sufficient for code execution in a 32-bit JIT, though, imported symbols need to custom lowered for the redirection. llvm-svn: 251761
* Add a sys::OwningMemoryBlock class, which is a sys::MemoryBlock that owns itsLang Hames2015-10-311-31/+10
| | | | | | | | underlying memory, and will automatically release it on destruction. Use this to tidy up the orc::IndirectStubsInfo class. llvm-svn: 251731
* [Orc] Expose the compile callback API through the C bindings.Lang Hames2015-10-302-13/+58
| | | | llvm-svn: 251683
* [Orc] Teach IndirectStubsManager to manage an expandable pool of stubs, ratherLang Hames2015-10-291-0/+16
| | | | | | | than a pre-allocated slab of stubs. Also add a convenience method for creating a single stub, rather than a whole block a time. llvm-svn: 251658
* [Orc] Add support for RuntimeDyld::setProcessAllSections.Lang Hames2015-10-291-0/+4
| | | | llvm-svn: 251604
* [Orc] Remove the 'takeOwnershipOfBuffers' kludge.Lang Hames2015-10-281-6/+1
| | | | | | Keno Fischer fixed the underlying issue that necessitated this in r236341. llvm-svn: 251560
* [Orc] Remove unnecessary semicolon. NFC.Vasileios Kalintiris2015-10-281-2/+2
| | | | llvm-svn: 251509
* [Orc] Re-add C bindings for the Orc APIs, with a fix to remove the union thatLang Hames2015-10-284-0/+390
| | | | | | | | | 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-284-397/+0
| | | | llvm-svn: 251473
* [Orc] Add experimental C bindings for Orc.Lang Hames2015-10-284-0/+397
| | | | llvm-svn: 251472
* [Orc] Add license header to OrcTargetSupport.Lang Hames2015-10-261-1/+9
| | | | llvm-svn: 251274
* [RuntimeDyld][COFF] Fix a think-o in the handling of the IMAGE_REL_AMD64_ADDR64Lang Hames2015-10-231-1/+1
| | | | | | relocation that was introduced in r250733. llvm-svn: 251135
* [ExecutionEngine] Garbage collect some dead (and unsafe) code.Davide Italiano2015-10-221-22/+0
| | | | llvm-svn: 251042
* [RuntimeDyld] Ignore ST_FILE symbols when constructing GlobalSymbolTableKeno Fischer2015-10-211-1/+2
| | | | | | | | | | | | | | Summary: ELF's STT_File symbols may overlap with regular globals in other files, so we should ignore them here in order to avoid having bogus entries in the symbol table that confuse us when resolving relocations. Reviewers: lhames Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D13888 llvm-svn: 250942
* Backing out commit r250906 as it broke lld.Kevin Enderby2015-10-212-4/+4
| | | | llvm-svn: 250908
* This removes the eating of the error in Archive::Child::getSize() when the ↵Kevin Enderby2015-10-212-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | characters in the size field in the archive header for the member is not a number. To do this we have all of the needed methods return ErrorOr to push them up until we get out of lib. Then the tools and can handle the error in whatever way is appropriate for that tool. So the solution is to plumb all the ErrorOr stuff through everything that touches archives. This include its iterators as one can create an Archive object but the first or any other Child object may fail to be created due to a bad size field in its header. Thanks to Lang Hames on the changes making child_iterator contain an ErrorOr<Child> instead of a Child and the needed changes to ErrorOr.h to add operator overloading for * and -> . We don’t want to use llvm_unreachable() as it calls abort() and is produces a “crash” and using report_fatal_error() to move the error checking will cause the program to stop, neither of which are really correct in library code. There are still some uses of these that should be cleaned up in this library code for other than the size field. Also corrected the code where the size gets us to the “at the end of the archive” which is OK but past the end of the archive will return object_error::parse_failed now. The test cases use archives with text files so one can see the non-digit character, in this case a ‘%’, in the size field. llvm-svn: 250906
* [RuntimeDyld][COFF] Fix some endianness issues, re-enable the regression test.Lang Hames2015-10-191-10/+7
| | | | llvm-svn: 250733
* [Orc] Add support for emitting indirect stubs directly into the JIT target'sLang Hames2015-10-192-6/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | memory, rather than representing the stubs in IR. Update the CompileOnDemand layer to use this functionality. Directly emitting stubs is much cheaper than building them in IR and codegen'ing them (see below). It also plays well with remote JITing - stubs can be emitted directly in the target process, rather than having to send them over the wire. The downsides are: (1) Care must be taken when resolving symbols, as stub symbols are held in a separate symbol table. This is only a problem for layer writers and other people using this API directly. The CompileOnDemand layer hides this detail. (2) Aliases of function stubs can't be symbolic any more (since there's no symbol definition in IR), but must be converted into a constant pointer expression. This means that modules containing aliases of stubs cannot be cached. In practice this is unlikely to be a problem: There's no benefit to caching such a module anyway. On balance I think the extra performance is more than worth the trade-offs: In a simple stress test with 10000 dummy functions requiring stubs and a single executed "hello world" main function, directly emitting stubs reduced user time for JITing / executing by over 90% (1.5s for IR stubs vs 0.1s for direct emission). llvm-svn: 250712
* [RuntimeDyld] Add support for absolute symbols.Lang Hames2015-10-183-18/+42
| | | | llvm-svn: 250639
OpenPOWER on IntegriCloud