|
Revision tags: llvmorg-20.1.0, llvmorg-20.1.0-rc3, llvmorg-20.1.0-rc2, llvmorg-20.1.0-rc1, llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5 |
|
| #
1aa71f86 |
| 26-May-2022 |
Peter S. Housel <[email protected]> |
[ORC][ORC_RT] Integrate ORC platforms with LLJIT and lli
This change enables integrating orc::LLJIT with the ORCv2 platforms (MachOPlatform and ELFNixPlatform) and the compiler-rt orc runtime. Chang
[ORC][ORC_RT] Integrate ORC platforms with LLJIT and lli
This change enables integrating orc::LLJIT with the ORCv2 platforms (MachOPlatform and ELFNixPlatform) and the compiler-rt orc runtime. Changes include:
- Adding SPS wrapper functions for the orc runtime's dlfcn emulation functions, allowing initialization and deinitialization to be invoked by LLJIT.
- Changing the LLJIT code generation default to add UseInitArray so that .init_array constructors are generated for ELF platforms.
- Integrating the ORCv2 Platforms into lli, and adding a PlatformSupport implementation to the LLJIT instance used by lli which implements initialization and deinitialization by calling the new wrapper functions in the runtime.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D126492
show more ...
|
|
Revision tags: llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1 |
|
| #
f9aef477 |
| 08-Feb-2022 |
Lang Hames <[email protected]> |
[ORC][ORC-RT] Rewrite the MachO platform to use allocation actions.
This patch updates the MachO platform (both the ORC MachOPlatform class and the ORC-Runtime macho_platform.* files) to use allocat
[ORC][ORC-RT] Rewrite the MachO platform to use allocation actions.
This patch updates the MachO platform (both the ORC MachOPlatform class and the ORC-Runtime macho_platform.* files) to use allocation actions, rather than EPC calls, to transfer the initializer information scraped from each linked object. Interactions between the ORC and ORC-Runtime sides of the platform are substantially redesigned to accomodate the change.
The high-level changes in this patch are:
1. The MachOPlatform::setupJITDylib method now calls into the runtime to set up a dylib name <-> header mapping, and a dylib state object (JITDylibState).
2. The MachOPlatformPlugin builds an allocation action that calls the __orc_rt_macho_register_object_platform_sections and __orc_rt_macho_deregister_object_platform_sections functions in the runtime to register the address ranges for all "interesting" sections in the object being allocated (TLS data sections, initializers, language runtime metadata sections, etc.).
3. The MachOPlatform::rt_getInitializers method (the entry point in the controller for requests from the runtime for initializer information) is replaced by MachOPlatform::rt_pushInitializers. The former returned a data structure containing the "interesting" section address ranges, but these are now handled by __orc_rt_macho_register_object_platform_sections. The new rt_pushInitializers method first issues a lookup to trigger materialization of the "interesting" sections, then returns the dylib dependence tree rooted at the requested dylib for dlopen to consume. (The dylib dependence tree is returned by rt_pushInitializers, rather than being handled by some dedicated call, because rt_pushInitializers can alter the dependence tree).
The advantage of these changes (beyond the performance advantages of using allocation actions) is that it moves more information about the materialized portions of the JITDylib into the executor. This tends to make the runtime easier to reason about, e.g. the implementation of dlopen in the runtime is now recursive, rather than relying on recursive calls in the controller to build a linear data structure for consumption by the runtime. This change can also make some operations more efficient, e.g. JITDylibs can be dlclosed and then re-dlopened without having to pull all initializers over from the controller again.
In addition to the high-level changes, there are some low-level changes to ORC and the runtime:
* In ORC, at ExecutionSession teardown time JITDylibs are now destroyed in reverse creation order. This is on the assumption that the ORC runtime will be loaded into an earlier dylib that will be used by later JITDylibs. This is a short-term solution to crashes that arose during testing when the runtime was torn down before its users. Longer term we will likely destroy dylibs in dependence order.
* toSPSSerializable(Expected<T> E) is updated to explicitly initialize the T value, allowing it to be used by Ts that have explicit constructors.
* The ORC runtime now (1) attempts to track ref-counts, and (2) distinguishes not-yet-processed "interesting" sections from previously processed ones. (1) is necessary for standard dlopen/dlclose emulation. (2) is intended as a step towards better REPL support -- it should enable future runtime calls that run only newly registered initializers ("dlopen_more", "dlopen_additions", ...?).
show more ...
|
|
Revision tags: llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3 |
|
| #
9eb4939b |
| 20-Jan-2022 |
Lang Hames <[email protected]> |
[ORC] Allow JITDylib::getDFSLinkOrder and friends to fail for defunct JITDylibs.
Calls to JITDylib's getDFSLinkOrder and getReverseDFSLinkOrder methods (both static an non-static versions) are now v
[ORC] Allow JITDylib::getDFSLinkOrder and friends to fail for defunct JITDylibs.
Calls to JITDylib's getDFSLinkOrder and getReverseDFSLinkOrder methods (both static an non-static versions) are now valid to make on defunct JITDylibs, but will return an error if any JITDylib in the link order is defunct.
This means that platforms can safely lookup link orders by name in response to jit-dlopen calls from the ORC runtime, even if the call names a defunct JITDylib -- the call will just fail with an error.
show more ...
|
| #
ade71641 |
| 18-Jan-2022 |
Lang Hames <[email protected]> |
[ORC] Add Platform::teardownJITDylib method.
This is a counterpart to Platform::setupJITDylib, and is called when JITDylib instances are removed (via ExecutionSession::removeJITDylib).
Upcoming Mac
[ORC] Add Platform::teardownJITDylib method.
This is a counterpart to Platform::setupJITDylib, and is called when JITDylib instances are removed (via ExecutionSession::removeJITDylib).
Upcoming MachOPlatform patches will use this to clear per-JITDylib data when JITDylibs are removed.
show more ...
|
|
Revision tags: llvmorg-13.0.1-rc2 |
|
| #
089acf25 |
| 08-Jan-2022 |
Lang Hames <[email protected]> |
[ORC][JITLink] Merge JITLink AllocActionCall and ORC WrapperFunctionCall.
These types performed identical roles. Merging them simplifies interoperability between JITLink and ORC APIs (allowing us to
[ORC][JITLink] Merge JITLink AllocActionCall and ORC WrapperFunctionCall.
These types performed identical roles. Merging them simplifies interoperability between JITLink and ORC APIs (allowing us to address a few FIXMEs).
show more ...
|
| #
118e953b |
| 06-Jan-2022 |
Lang Hames <[email protected]> |
Re-apply "[JITLink] Update JITLink to use ExecutorAddr rather... " with fixes.
This re-applies 133f86e95492b2a00b944e070878424cfa73f87c, which was reverted in c5965a411c635106a47738b8d2e24db822b7416
Re-apply "[JITLink] Update JITLink to use ExecutorAddr rather... " with fixes.
This re-applies 133f86e95492b2a00b944e070878424cfa73f87c, which was reverted in c5965a411c635106a47738b8d2e24db822b7416f while I investigated bot failures.
The original failure contained an arithmetic conversion think-o (on line 419 of EHFrameSupport.cpp) that could cause failures on 32-bit platforms. The issue should be fixed in this patch.
show more ...
|
| #
c5965a41 |
| 06-Jan-2022 |
Lang Hames <[email protected]> |
Revert "[JITLink] Update JITLink to use ExecutorAddr rather than..."
This reverts commit 133f86e95492b2a00b944e070878424cfa73f87c while I investigate the bot failures at https://lab.llvm.org/buildbo
Revert "[JITLink] Update JITLink to use ExecutorAddr rather than..."
This reverts commit 133f86e95492b2a00b944e070878424cfa73f87c while I investigate the bot failures at https://lab.llvm.org/buildbot#builders/186/builds/3370.
show more ...
|
| #
133f86e9 |
| 05-Jan-2022 |
Lang Hames <[email protected]> |
[JITLink] Update JITLink to use ExecutorAddr rather than JITTargetAddress.
ExecutorAddr is the preferred representation for executor process addresses now.
|
| #
ae73f3fd |
| 07-Dec-2021 |
Lang Hames <[email protected]> |
[ORC] Add a MaterializationUnit::Interface struct.
MaterializationUnit::Interface holds the values that make up the interface (for ORC's purposes) of a materialization unit: the symbol flags map and
[ORC] Add a MaterializationUnit::Interface struct.
MaterializationUnit::Interface holds the values that make up the interface (for ORC's purposes) of a materialization unit: the symbol flags map and initializer symbol.
Having a type for this will make functions that build materializer interfaces more readable and maintainable.
show more ...
|
|
Revision tags: llvmorg-13.0.1-rc1 |
|
| #
2a739f27 |
| 12-Nov-2021 |
Ben Langmuir <[email protected]> |
[ORC][ORC-RT] Register type metadata from __swift5_types MachO section
Similar to how the other swift sections are registered by the ORC runtime's macho platform, add the __swift5_types section, whi
[ORC][ORC-RT] Register type metadata from __swift5_types MachO section
Similar to how the other swift sections are registered by the ORC runtime's macho platform, add the __swift5_types section, which contains type metadata. Add a simple test that demonstrates that the swift runtime recognized the registered types.
rdar://85358530
Differential Revision: https://reviews.llvm.org/D113811
show more ...
|
| #
ff846fcb |
| 31-Oct-2021 |
Lang Hames <[email protected]> |
[ORC][ORC-RT] Switch MachO EH/TLV registration from EPC-calls to alloc actions.
MachOPlatform used to make an EPC-call (registerObjectSections) to register the eh-frame and thread-data sections for
[ORC][ORC-RT] Switch MachO EH/TLV registration from EPC-calls to alloc actions.
MachOPlatform used to make an EPC-call (registerObjectSections) to register the eh-frame and thread-data sections for each linked object with the ORC runtime.
Now that JITLinkMemoryManager supports allocation actions we can use these instead of an EPC call. This saves us one EPC-call per object linked, and manages registration/deregistration in the executor, rather than the controller process. In the future we may use this to allow JIT'd code in the executor to outlive the controller object while still being able to be cleanly destroyed.
Since the code for allocation actions must be available when the actions are run, and since the eh-frame registration code lives in the ORC runtime itself, this change required that MachO eh-frame support be split out of macho_platform.cpp and into its own macho_ehframe_registration.cpp file that has no other dependencies. During bootstrap we start by forcing emission of macho_ehframe_registration.cpp so that eh-frame registration is guaranteed to be available for the rest of the bootstrap process. Then we load the rest of the MachO-platform runtime support, erroring out if there is any attempt to use TLVs. Once the bootstrap process is complete all subsequent code can use all features.
show more ...
|
| #
afeb1e4a |
| 30-Oct-2021 |
Lang Hames <[email protected]> |
[ORC] Move all pass config into MachOPlatformPlugin::modifyPassConfig.
NFC, this just makes it easier to see and reason about pass ordering.
|
| #
3d13ee28 |
| 27-Oct-2021 |
Ben Langmuir <[email protected]> |
[ORC][ORC-RT] Enable the MachO platform for arm64
Enables the arm64 MachO platform, adds basic tests, and implements the missing TLV relocations and runtime wrapper function. The TLV relocations are
[ORC][ORC-RT] Enable the MachO platform for arm64
Enables the arm64 MachO platform, adds basic tests, and implements the missing TLV relocations and runtime wrapper function. The TLV relocations are just handled as GOT accesses.
rdar://84671534
Differential Revision: https://reviews.llvm.org/D112656
show more ...
|
| #
962a2479 |
| 12-Oct-2021 |
Lang Hames <[email protected]> |
Re-apply e50aea58d59, "Major JITLinkMemoryManager refactor". with fixes.
Adds explicit narrowing casts to JITLinkMemoryManager.cpp.
Honors -slab-address option in llvm-jitlink.cpp, which was accide
Re-apply e50aea58d59, "Major JITLinkMemoryManager refactor". with fixes.
Adds explicit narrowing casts to JITLinkMemoryManager.cpp.
Honors -slab-address option in llvm-jitlink.cpp, which was accidentally dropped in the refactor.
This effectively reverts commit 6641d29b70993bce6dbd7e0e0f1040753d38842f.
show more ...
|
| #
6641d29b |
| 12-Oct-2021 |
Lang Hames <[email protected]> |
Revert "[JITLink][ORC] Major JITLinkMemoryManager refactor."
This reverts commit e50aea58d59c8cfae807a7fee21c4227472c0678 while I investigate bot failures.
|
| #
e50aea58 |
| 11-Oct-2021 |
Lang Hames <[email protected]> |
[JITLink][ORC] Major JITLinkMemoryManager refactor.
This commit substantially refactors the JITLinkMemoryManager API to: (1) add asynchronous versions of key operations, (2) give memory manager impl
[JITLink][ORC] Major JITLinkMemoryManager refactor.
This commit substantially refactors the JITLinkMemoryManager API to: (1) add asynchronous versions of key operations, (2) give memory manager implementations full control over link graph address layout, (3) enable more efficient tracking of allocated memory, and (4) support "allocation actions" and finalize-lifetime memory.
Together these changes provide a more usable API, and enable more powerful and efficient memory manager implementations.
To support these changes the JITLinkMemoryManager::Allocation inner class has been split into two new classes: InFlightAllocation, and FinalizedAllocation. The allocate method returns an InFlightAllocation that tracks memory (both working and executor memory) prior to finalization. The finalize method returns a FinalizedAllocation object, and the InFlightAllocation is discarded. Breaking Allocation into InFlightAllocation and FinalizedAllocation allows InFlightAllocation subclassses to be written more naturally, and FinalizedAlloc to be implemented and used efficiently (see (3) below).
In addition to the memory manager changes this commit also introduces a new MemProt type to represent memory protections (MemProt replaces use of sys::Memory::ProtectionFlags in JITLink), and a new MemDeallocPolicy type that can be used to indicate when a section should be deallocated (see (4) below).
Plugin/pass writers who were using sys::Memory::ProtectionFlags will have to switch to MemProt -- this should be straightworward. Clients with out-of-tree memory managers will need to update their implementations. Clients using in-tree memory managers should mostly be able to ignore it.
Major features:
(1) More asynchrony:
The allocate and deallocate methods are now asynchronous by default, with synchronous convenience wrappers supplied. The asynchronous versions allow clients (including JITLink) to request and deallocate memory without blocking.
(2) Improved control over graph address layout:
Instead of a SegmentRequestMap, JITLinkMemoryManager::allocate now takes a reference to the LinkGraph to be allocated. The memory manager is responsible for calculating the memory requirements for the graph, and laying out the graph (setting working and executor memory addresses) within the allocated memory. This gives memory managers full control over JIT'd memory layout. For clients that don't need or want this degree of control the new "BasicLayout" utility can be used to get a segment-based view of the graph, similar to the one provided by SegmentRequestMap. Once segment addresses are assigned the BasicLayout::apply method can be used to automatically lay out the graph.
(3) Efficient tracking of allocated memory.
The FinalizedAlloc type is a wrapper for an ExecutorAddr and requires only 64-bits to store in the controller. The meaning of the address held by the FinalizedAlloc is left up to the memory manager implementation, but the FinalizedAlloc type enforces a requirement that deallocate be called on any non-default values prior to destruction. The deallocate method takes a vector<FinalizedAlloc>, allowing for bulk deallocation of many allocations in a single call.
Memory manager implementations will typically store the address of some allocation metadata in the executor in the FinalizedAlloc, as holding this metadata in the executor is often cheaper and may allow for clean deallocation even in failure cases where the connection with the controller is lost.
(4) Support for "allocation actions" and finalize-lifetime memory.
Allocation actions are pairs (finalize_act, deallocate_act) of JITTargetAddress triples (fn, arg_buffer_addr, arg_buffer_size), that can be attached to a finalize request. At finalization time, after memory protections have been applied, each of the "finalize_act" elements will be called in order (skipping any elements whose fn value is zero) as
((char*(*)(const char *, size_t))fn)((const char *)arg_buffer_addr, (size_t)arg_buffer_size);
At deallocation time the deallocate elements will be run in reverse order (again skipping any elements where fn is zero).
The returned char * should be null to indicate success, or a non-null heap-allocated string error message to indicate failure.
These actions allow finalization and deallocation to be extended to include operations like registering and deregistering eh-frames, TLS sections, initializer and deinitializers, and language metadata sections. Previously these operations required separate callWrapper invocations. Compared to callWrapper invocations, actions require no extra IPC/RPC, reducing costs and eliminating a potential source of errors.
Finalize lifetime memory can be used to support finalize actions: Sections with finalize lifetime should be destroyed by memory managers immediately after finalization actions have been run. Finalize memory can be used to support finalize actions (e.g. with extra-metadata, or synthesized finalize actions) without incurring permanent memory overhead.
show more ...
|
| #
21a06254 |
| 27-Sep-2021 |
Lang Hames <[email protected]> |
[ORC] Switch from JITTargetAddress to ExecutorAddr for EPC-call APIs.
Part of the ongoing move to ExecutorAddr.
|
|
Revision tags: llvmorg-13.0.0, llvmorg-13.0.0-rc4 |
|
| #
ef391df2 |
| 23-Sep-2021 |
Lang Hames <[email protected]> |
[ORC] Rename ExecutorAddress to ExecutorAddr.
Removing the 'ess' suffix improves the ergonomics without sacrificing clarity. Since this class is likely to be used more frequently in the future it's
[ORC] Rename ExecutorAddress to ExecutorAddr.
Removing the 'ess' suffix improves the ergonomics without sacrificing clarity. Since this class is likely to be used more frequently in the future it's worth some short term pain to fix this now.
show more ...
|
|
Revision tags: llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2 |
|
| #
64288571 |
| 19-Aug-2021 |
Lang Hames <[email protected]> |
[ORC] Introduce lookupAndRecordAddrs utility.
Accepts a vector of (SymbolStringPtr, ExecutorAddress*) pairs, looks up all the symbols, then writes their address to each of the corresponding Executor
[ORC] Introduce lookupAndRecordAddrs utility.
Accepts a vector of (SymbolStringPtr, ExecutorAddress*) pairs, looks up all the symbols, then writes their address to each of the corresponding ExecutorAddresses.
This idiom (looking up and recording addresses into a specific set of variables) is used in MachOPlatform and the (temporarily reverted) ELFNixPlatform, and is likely to be used in other places in the near future, so wrapping it in a utility function should save us some boilerplate.
show more ...
|
| #
27ea3f16 |
| 14-Aug-2021 |
Lang Hames <[email protected]> |
[JITLink][x86-64] Rename *Relaxable edges to *REXRelaxable.
The existing relaxable edges all assume a REX prefix. ELF includes non-REX relaxations, so rename these edges to make room for the new kin
[JITLink][x86-64] Rename *Relaxable edges to *REXRelaxable.
The existing relaxable edges all assume a REX prefix. ELF includes non-REX relaxations, so rename these edges to make room for the new kinds.
show more ...
|
|
Revision tags: llvmorg-13.0.0-rc1, llvmorg-14-init |
|
| #
2487db1f |
| 27-Jul-2021 |
Lang Hames <[email protected]> |
[ORC] Require ExecutorProcessControl when constructing an ExecutionSession.
Wrapper function call and dispatch handler helpers are moved to ExecutionSession, and existing EPC-based tools are re-writ
[ORC] Require ExecutorProcessControl when constructing an ExecutionSession.
Wrapper function call and dispatch handler helpers are moved to ExecutionSession, and existing EPC-based tools are re-written to take an ExecutionSession argument instead.
Requiring an ExecutorProcessControl instance simplifies existing EPC based utilities (which only need to take an ES now), and should encourage more utilities to use the EPC interface. It also simplifies process termination, since the session can automatically call ExecutorProcessControl::disconnect (previously this had to be done manually, and carefully ordered with the rest of JIT tear-down to work correctly).
show more ...
|
| #
cdcc3547 |
| 26-Jul-2021 |
Lang Hames <[email protected]> |
[ORC][ORC-RT] Add initial Objective-C and Swift support to MachOPlatform.
This allows ORC to execute code containing Objective-C and Swift classes and methods (provided that the language runtime is
[ORC][ORC-RT] Add initial Objective-C and Swift support to MachOPlatform.
This allows ORC to execute code containing Objective-C and Swift classes and methods (provided that the language runtime is loaded into the executor).
show more ...
|
| #
eda6afda |
| 22-Jul-2021 |
Lang Hames <[email protected]> |
Re-re-re-apply "[ORC][ORC-RT] Add initial native-TLV support to MachOPlatform."
The ccache builders have recevied a config update that should eliminate the build issues seen previously.
|
| #
af5602d3 |
| 23-Jul-2021 |
Hubert Tong <[email protected]> |
[ORC] Work around AIX build compiler: Replace lambda; NFC
By replacing a lambda expression with a functor class instance, this patch works around an issue encountered on AIX where the IBM XL compile
[ORC] Work around AIX build compiler: Replace lambda; NFC
By replacing a lambda expression with a functor class instance, this patch works around an issue encountered on AIX where the IBM XL compiler appears to make no progress for many hours.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D106554
show more ...
|
| #
402b681f |
| 22-Jul-2021 |
Lang Hames <[email protected]> |
Re-re-revert "[ORC][ORC-RT] Add initial native-TLV support to MachOPlatform."
This reverts commit 6b2a96285b9bbe92d2c5e21830f21458f8be976d.
The ccache builders are still failing. Looks like they ne
Re-re-revert "[ORC][ORC-RT] Add initial native-TLV support to MachOPlatform."
This reverts commit 6b2a96285b9bbe92d2c5e21830f21458f8be976d.
The ccache builders are still failing. Looks like they need to be updated to get the llvm-zorg config change in 490633945677656ba75d42ff1ca9d4a400b7b243.
I'll re-apply this as soon as the builders are updated.
show more ...
|