aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ExecutionEngine
AgeCommit message (Collapse)AuthorFilesLines
12 daysMC: Use Triple form of lookupTarget in more places (#157591)Matt Arsenault3-68/+65
2025-08-14[ORC] Add cloneExternalModuleToContext API.Lang Hames1-4/+24
cloneExternalModuleToContext can be used to clone an LLVM module onto a given ThreadSafeContext. Callers of this function are responsible for ensuring exclusive access to the source module and its LLVMContext.
2025-07-31[ExecutionEngine] Remove unnecessary casts (NFC) (#151442)Kazu Hirata1-3/+3
WA, WA1, and WA2 are already of char *.
2025-07-30[ExecutionEngine] Fix a warningKazu Hirata1-1/+1
This patch fixes: llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp:1578:3: error: 'std::unique_lock' may not intend to support class template argument deduction [-Werror,-Wctad-maybe-unsupported]
2025-07-30[ORC] Fix synchronization in CoreAPIsTest. (#144556)Jameson Nash1-8/+10
The code previously appeared to have a (benign?) race condition on `WorkThreads.size`, since it was being accessed outside of the mutex lock that protected it on the threads. This is usually okay since 1a1d6e6f98738be249b20994bcfed48dccac59e3, but doesn't seem reliable in general, so fix this code to express the intent more accurately. This instead relies on the same general principles as ref-counting, where each existing reference (thread) can add new references (threads) because they already have a reference themselves (until joined).
2025-07-16[JITLink][AArch32] Add explicit visibility macros to functions needed by ↵Thomas Fransham1-15/+16
unittests (#116557) Avoid missing symbol errors when building JITLinkTests for windows shared library builds with explicit symbol visibility macros are enabled. This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and LLVM plugins on window.
2025-07-03[ORC] Add cloneToContext: Clone Module to a given ThreadSafeContext (#146852)Lang Hames1-0/+49
This is a generalization of the existing cloneToNewContext operation: rather than cloning the given module into a new ThreadSafeContext it clones it into any given ThreadSafeContext. The given ThreadSafeContext is locked to ensure that the cloning operation is safe.
2025-07-03[ORC] Replace ThreadSafeContext::getContext with withContextDo. (#146819)Lang Hames3-70/+50
This removes ThreadSafeContext::Lock, ThreadSafeContext::getLock, and ThreadSafeContext::getContext, and replaces them with a ThreadSafeContext::withContextDo method (and const override). The new method can be used to access an existing ThreadSafeContext-wrapped LLVMContext in a safe way: ThreadSafeContext TSCtx = ... ; TSCtx.withContextDo([](LLVMContext *Ctx) { // this closure has exclusive access to Ctx. }); The new API enforces correct locking, whereas the old APIs relied on manual locking (which almost no in-tree code preformed, relying instead on incidental exclusive access to the ThreadSafeContext).
2025-06-26[llvm] Use a new constructor of ArrayRef (NFC) (#146008)Kazu Hirata1-1/+1
ArrayRef now has a new constructor that takes a parameter whose type has data() and size(). This patch migrates: ArrayRef<T>(X.data(), X.size() to: ArrayRef<T>(X)
2025-06-27[ORC] Fix EPCGenericMemoryAccessTest write-ptrs implementation after f93df5ebd99Lang Hames1-1/+1
The write-pointers operation should be writing a pointer, not a uint64_t. This bug existed prior to f93df5ebd99, but changes in that commit seem to have exposed the issue (see e.g. https://lab.llvm.org/buildbot/#/builders/154/builds/17956).
2025-06-27[ORC] Add read operations to orc::MemoryAccess. (#145834)Lang Hames1-67/+297
This commit adds operations to orc::MemoryAccess for reading basic types (uint8_t, uint16_t, uint32_t, uint64_t, pointers, buffers, and strings) from executor memory. The InProcessMemoryAccess and EPCGenericMemoryAccess implementations are updated to support the new operations.
2025-06-26[ORC] Extract MemoryAccess from ExecutorProcessControl, break up header. ↵Lang Hames6-0/+6
(#145671) This moves the MemoryAccess interface out of the ExecutorProcessControl class and splits implementation classes InProcessMemoryManager and SelfExecutorProcessControl out of ExecutorProcessControl.h and into their own headers.
2025-06-25[ORC] Move UnsupportedExecutorProcessControl into unittests.Lang Hames2-0/+43
The UnsupportedExecutorProcessControl implementation is only used in unit tests, so move it out of the public headers.
2025-06-06Pass memory buffer to RuntimeDyld::MemoryManager factory (#142930)Karlo Basioli1-7/+69
`RTDyldObjectLinkingLayer` is currently creating a memory manager without any parameters. In this PR I am passing the MemoryBuffer that will be emitted to the MemoryManager so that the user can use it to configure the behaviour of the MemoryManager.
2025-06-03[llvm] annotate interfaces in llvm/ExecutionEngine for DLL export (#140809)Andrew Rogers1-1/+1
## Purpose This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates the `llvm/ExecutionEngine` library. These annotations currently have no meaningful impact on the LLVM build; however, they are a prerequisite to support an LLVM Windows DLL (shared library) build. ## Background This effort is tracked in #109483. Additional context is provided in [this discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307), and documentation for `LLVM_ABI` and related annotations is found in the LLVM repo [here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst). The bulk of these changes were generated automatically using the [Interface Definition Scanner (IDS)](https://github.com/compnerd/ids) tool, followed formatting with `git clang-format`. The following manual adjustments were also applied after running IDS on Linux: - Add `LLVM_ABI_FRIEND` to friend member functions declared with `LLVM_ABI` - Add `LLVM_ABI` to a subset of private class methods and fields that require export - Add `LLVM_ABI` to a small number of symbols that require export but are not declared in headers - Add `LLVM_ABI` to a number of `extern "C"` methods that IDS missed because they're implicitly exported ## Validation Local builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations: - Windows with MSVC - Windows with Clang - Linux with GCC - Linux with Clang - Darwin with Clang
2025-05-09[ORC] skip reoptimization tests on ARM (#130178)fossdd1-0/+4
It failed on armv7 with "Architecture not supported" which is due to StubTests being not supported on ARM /builds/fossdd/aports/main/llvm20/src/llvm-project-20.1.0.src/llvm/unittests/ExecutionEngine/Orc/ReOptimizeLayerTest.cpp:140: Failure Value of: llvm::detail::TakeError(RM.takeError()) Expected: succeeded Actual: failed (Architecture not supported) (of type llvm::detail::ErrorHolder)
2025-05-08[JITLink][x86] Update StubsTest unit test for rename in b972164f381.Lang Hames1-4/+4
2025-05-04[llvm] Remove unused local variables (NFC) (#138454)Kazu Hirata1-2/+0
2025-04-19[llvm] Construct SmallVector with iterator ranges (NFC) (#136460)Kazu Hirata1-4/+1
2025-04-17[ORC][unittests] Skip the ReOptimizeLayerTest for RISC-V (#134702)Kashyap Chamarthy1-0/+4
David Abdurachmanov reports[1] that we hit this error on P550 hardware: /builddir/build/BUILD/llvm-20.1.1-build/llvm-project-20.1.1.src/llvm/unittests/ExecutionEngine/Orc/ReOptimizeLayerTest.cpp:140: Failure Value of: llvm::detail::TakeError(RM.takeError()) Expected: succeeded Actual: failed (Architecture not supported) (of type llvm::detail::ErrorHolder) Tom Stellard noted[2] that he's seen this before on other architectures and suggested to skip it. [1] https://src.fedoraproject.org/rpms/llvm/pull-request/408#comment-255547 [2] https://src.fedoraproject.org/rpms/llvm/pull-request/408#comment-255557 Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
2025-03-25[ORC] Add ExecutorAddrRange::fromPtrRange convenience method.Lang Hames1-0/+10
This can be used to construct an ExecutorAddrRange from a pair of pointers, or a pointer and a size. This will be used to reduce boilerplate in an upcoming patch.
2025-03-13[ORC] Remove some unnecessary namespace qualifications. NFCI.Lang Hames8-40/+29
2025-03-11[ORC] Swap handleAsync handler and send-result arguments.Lang Hames1-4/+5
Placing the handler argument last improves readability when passing a lambda value (the common case for this API).
2025-03-06[IR] Store Triple in Module (NFC) (#129868)Nikita Popov4-8/+8
The module currently stores the target triple as a string. This means that any code that wants to actually use the triple first has to instantiate a Triple, which is somewhat expensive. The change in #121652 caused a moderate compile-time regression due to this. While it would be easy enough to work around, I think that architecturally, it makes more sense to store the parsed Triple in the module, so that it can always be directly queried. For this change, I've opted not to add any magic conversions between std::string and Triple for backwards-compatibilty purses, and instead write out needed Triple()s or str()s explicitly. This is because I think a decent number of them should be changed to work on Triple as well, to avoid unnecessary conversions back and forth. The only interesting part in this patch is that the default triple is Triple("") instead of Triple() to preserve existing behavior. The former defaults to using the ELF object format instead of unknown object format. We should fix that as well.
2025-02-14[ORC][unittests] Remove hard coded 16k page size (#127115)Tristan Ross2-3/+16
Fixes a couple hard coded 16k values which is being used as the page size. Replaces the hard coded value with the system's page size. This fixes #116753 on an Ampere Altra Q64-22 CC @lhames
2025-02-06[JITLink] Add a jitlink::Symbol::getSection() convenience method.Lang Hames1-0/+30
`Sym.getSection()` is equivalent to `Sym.getBlock().getSection()`.
2025-01-22[IR][unittests] Replace of PointerType::getUnqual(Type) with opaque version ↵Mats Jun Larsen1-1/+1
(NFC) (#123901) Follow up to https://github.com/llvm/llvm-project/issues/123569
2025-01-22[ORC] Add ExecutorSymbolDef toPtr / fromPtr convenience functions.Lang Hames1-0/+32
This will simplify conversion of a number of APIs from ExecutorAddr to ExecutorSymbolDef.
2025-01-16[JITLink] Teach x86_64 GOT & PLT table managers to discover existing entries.Lang Hames2-0/+91
x86_64::GOTTableManager and x86_64::PLTTableManager will now look for existing GOT and PLT sections and re-use existing entries if they're present. This will be used for an upcoming MachO patch to enable compact unwind support. This patch is the x86-64 counterpart 42595bdaefb, which added the same functionality to the GOT and PLT managers for aarch64.
2025-01-16[JITLink] Add Block::edges_at(Edge::OffsetT): iterate over edges at offset.Lang Hames1-0/+30
Block::edges_at is a convenience method for iterating over edges at a given offset within a jitlink::Block. This method will be used in an upcoming patch for compact unwind info support.
2025-01-15[JITLink] Add convenience methods to LinkGraph to find symbols by name.Lang Hames1-0/+45
Adds new convenience methods findDefinedSymbolByName, findExternalSymbolByName and findAbsoluteSymbolByName to the LinkGraph class. These should be used to find symbols of the given types by name. COFFLinkGraphBuilder and MachOPlatform are updated to take advantage of the new methods.
2025-01-14[JITLink] Teach aarch64 GOT & PLT table managers to discover existing entries.Lang Hames2-0/+91
aarch64::GOTTableManager and aarch64::PLTTableManager will now look for existing GOT and PLT sections and re-use existing entries if they're present. This will be used for an upcoming MachO patch to enable compact unwind support.
2025-01-14[JITLink] Fix incorrect file name in unit test file comment.Lang Hames1-1/+1
2025-01-14[JITLink] Use target triple for LinkGraph pointer size and endianness.Lang Hames9-50/+58
Removes LinkGraph's PointerSize and Endianness members and uses the triple to find these values instead. Also removes some redundant Triple copies.
2024-12-17[ORC] Make LazyReexportsManager implement ResourceManager.Lang Hames1-0/+74
This ensures that the reexports mappings are cleared when the resource tracker associated with each mapping is removed.
2024-12-06[JITLink] Switch to SymbolStringPtr for Symbol names (#115796)Jared Wyles11-73/+103
Use SymbolStringPtr for Symbol names in LinkGraph. This reduces string interning on the boundary between JITLink and ORC, and allows pointer comparisons (rather than string comparisons) between Symbol names. This should improve the performance and readability of code that bridges between JITLink and ORC (e.g. ObjectLinkingLayer and ObjectLinkingLayer::Plugins). To enable use of SymbolStringPtr a std::shared_ptr<SymbolStringPool> is added to LinkGraph and threaded through to its construction sites in LLVM and Bolt. All LinkGraphs that are to have symbol names compared by pointer equality must point to the same SymbolStringPool instance, which in ORC sessions should be the pool attached to the ExecutionSession. --------- Co-authored-by: Lang Hames <lhames@gmail.com>
2024-12-03Re-apply "[ORC] Track all dependencies on symbols that aren't..." with fixes.Lang Hames1-0/+65
This reapplies 427fb5cc5ac, which was reverted in 08c1a6b3e18 due to bot failures. The fix was to remove an incorrect assertion: In IL_emit, during the initial worklist loop, an EDU can have all of its dependencies removed without becoming ready (because it may still have implicit dependencies that will be added back during the subsequent propagateExtraEmitDeps operation). The EDU will be marked Ready at the end of IL_emit if its Dependencies set is empty at that point. Prior to that we can only assert that it's either Emitted or Ready (which is already covered by other assertions).
2024-12-02Revert "[ORC] Track all dependencies on symbols that aren't Ready yet."Lang Hames1-65/+0
This reverts commit 427fb5cc5ac34414c4682c90d3db0c63c5a1b227 while I investigate the bot failure in https://lab.llvm.org/buildbot/#/builders/95/builds/6835.
2024-12-02[ORC] Track all dependencies on symbols that aren't Ready yet.Lang Hames1-0/+65
AsynchronousSymbolQuery tracks the symbols that it depends on in order to (1) detach the query in the event of a failure, and (2) report those dependencies to clients of the ExecutionSession::lookup method (via the RegisterDependencies argument). Previously we tracked only dependencies on symbols that didn't meet the required state (the only symbols that the query needs to be attached to), but this is insufficient to report all necessary dependencies to lookup clients. E.g. A lookup requiring SymbolState::Resolved where some matched symbol is already Resolved but not yet Emitted or Ready would result in the dependency on that symbol not being reported, which could result in illegal access in concurrent JIT setups. (This bug was discovered by @mikaoP on discord with a simple concurrent JIT setup). This patch tracks and reports all dependencies on symbols that aren't Ready yet, correcting the under-reporting issue. AsynchronousSymbolQuery::detach is updated to stop asserting that all depended-upon symbols have a query attached.
2024-11-18[JITLink] Move Symbol to new block before updating size.Lang Hames1-28/+37
Symbol::setSize asserts that the new size does not overflow the containing block, so we need to point the Symbol at the correct Block before updating its size (otherwise we may get a spurious overflow assertion).
2024-11-11[ORC] Move absoluteSymbols from Core.h to new AbsoluteSymbols.h header. NFC.Lang Hames4-2/+5
Continuing Core.h clean-up. If you see any errors about a missing absoluteSymbols function you need to include the new AbsoluteSymbols.h header.
2024-11-05[ORC] Add signext on @sum() arguments in test. (#113308)Jonas Paulsson1-26/+45
Make sure the inlined @sum() function has the right extension attributes on its arguments. A new struct TargetI32ArgExtensions is added that sets the Ret/Arg extension strings given a string TargetTriple. This might be used elsewhere as well for this purpose if needed. Fixes: #112503
2024-11-02[ORC] Simplify JITLinkRedirectableSymbolManager, fix definition locations.Lang Hames2-28/+16
Redirectable stubs should be placed in the same JITDylib as their names, with their lifetimes managed according to the ResourceTracker used when adding them. The original implementation created a single pool of stubs in the JITDylib that is passed to the JITLinkRedirectableSymbolManager constructor, but this may cause the addresses of the redirectable symbols themselves (added to the JITDylibs passed to createRedirectableSymbols) to appear outside the address range of their defining JITDylib. This patch fixes the issue by dropping the pool and emitting a new graph for each set of requested redirectable symbols. We lose the ability to recycle stubs, but gain the ability to free them entirely. Since we don't expect stub reuse to be a common case this is likely the best trade-off. If in the future we do need to return to a stub pool we should create a separate one for each JITDylib to ensure that addresses behave as expected.
2024-11-02[ORC] Initialize native target in JITLinkRedirectionManagerTest test fixture.Lang Hames1-0/+2
The native target must be initialized here otherwise the test will be skipped unless some prior test happens to initialize it. Failure to initialize the native target was causing the test to be skipped when --gtest_filter was used.
2024-11-02[JITLink] Don't return errors from pointer and jump stub creators.Lang Hames1-10/+8
Creation of pointers and jump stubs always succeeds for all existing JITLink backends, and I haven't been able to think of a scenario where it would fail. (Pointer / stub *fixup* may fail due to range errors, but that will happen later and the APIs already account for it).
2024-10-31[ORC] skip reoptimization tests on i386 (#114351)Tom Stellard1-0/+4
This test currently segfaults on i386-unknown-linux-gnu builds.
2024-10-30[ORC] Fix transfer to unknown ResourceTrackers (#114063)Jonas Hahnfeld1-0/+30
When transferring resources, the destination tracker key may not be in the internal map, invalidating iterators and value references. The added test creates such situation and would fail before with "Finalized allocation was not deallocated." For good measure, fix the same pattern in RTDyldObjectLinkingLayer which is harder to test because it "only" results in memory managers being deleted in the wrong order.
2024-10-28[JITLink][MachO] Add convenience functions for default text/data sections.Lang Hames7-121/+161
The getMachODefaultTextSection and getMachODefaultRWDataSection functions return the "__TEXT,__text" and "__DATA,__data" sections respectively, creating empty sections if the default sections are not already present in the graph. These functions can be used by utilities that want to add code or data to these standard sections (e.g. these functions can be used to supply the section argument to the createAnonymousPointerJumpStub and createPointerJumpStubBlock functions in the various targets).
2024-10-23[ORC] Move EPC load-dylib and lookup operations into their own class.Lang Hames1-2/+5
This keeps common operations together, and should make it easier to write re-usable dylib managers in the future (e.g. a DylibManager that uses the EPC's remote-execution APIs to implement load and lookup).
2024-10-21[ORC] skip reoptimization tests on s390x. (#112796)Tom Stellard1-0/+4
The test was failing on s390x with this error: JIT session error: Unsupported target machine architecture in ELF object <main>-jitted-objectbuffer