summaryrefslogtreecommitdiff
path: root/orc-rt
AgeCommit message (Collapse)Author
2025-11-21[orc-rt] Rename 'Session' variables to avoid ambiguity with type. NFCI. ↵Lang Hames
(#168999) Re-using Session as a variable name risks confusion with the Session type.
2025-11-19[orc-rt] Initial ORC Runtime design documentation. (#168681)Lang Hames
This document aims to lay out the high level design and goals of the ORC runtime, and the relationships between key components.
2025-11-19[orc-rt] Simplify Session shutdown. (#168664)Lang Hames
Moves all Session member variables dedicated to shutdown into a new ShutdownInfo struct, and uses the presence / absence of this struct as the flag to indicate that we've entered the "shutting down" state. This simplifies the implementation of the shutdown process.
2025-11-19[orc-rt] Fix typos in file comments.Lang Hames
2025-11-19[orc-rt] Introduce Task and TaskDispatcher APIs and implementations. (#168514)Lang Hames
Introduces the Task and TaskDispatcher interfaces (TaskDispatcher.h), ThreadPoolTaskDispatcher implementation (ThreadPoolTaskDispatch.h), and updates Session to include a TaskDispatcher instance that can be used to run tasks. TaskDispatcher's introduction is motivated by the need to handle calls to JIT'd code initiated from the controller process: Incoming calls will be wrapped in Tasks and dispatched. Session shutdown will wait on TaskDispatcher shutdown, ensuring that all Tasks are run or destroyed prior to the Session being destroyed.
2025-11-17[orc-rt] Add missing headers to Session.h (#168330)Lang Hames
2025-11-12[orc-rt] Make Session explicitly immovable. (#167640)Lang Hames
NFCI -- the deleted copy constructor already made this immovable. The explicit operations just make clear that this was intentional.
2025-11-12Orc rt session wrap unwrap (#167635)Lang Hames
2025-11-11[orc-rt] Replace wrapper fn `void *CallCtx` arg with `uint64_t CallId`. ↵Lang Hames
(#167452) This argument serves as an opaque id (outside the ControllerAccess object) for a call to a wrapper function. I expect that most ControllerAccess implementations will want to use this argument as a sequence number (plain integer), for which uint64_t will be a better fit than void*. For ControllerAccess implementations that want to use a pointer, uint64_t should be sufficiently large.
2025-11-07[orc-rt] Add endian_read/write operations. (#166892)Lang Hames
The endian_read and endian_write operations read and write unsigned integers stored in a given endianness.
2025-10-15[orc-rt] Add ExecutorAddrRange::contains overload for ranges. (#163458)Lang Hames
Can be used to test that one address range is fully contained within another. This is an orc-rt counterpart to aa731e19045, which added the same operation to llvm::orc::ExecutorAddrRange.
2025-10-13[orc-rt] Rename InitializeRequest variables after 7381558ef8b. NFCI.Lang Hames
7381558ef8b renamed the FinalizeRequest type to InitializeRequest. This commit updates InitializeRequest variable names to follow suit ("FR"s become "IR"s).
2025-10-13[orc-rt] Rename SimpleNativeMemoryMap finalize & deallocate. NFCI. (#163114)Lang Hames
This commit renames the "finalize" operation to "initialize", and "deallocate" to "deinitialize". The new names are chosen to better fit the point of view of the ORC-runtime and executor-process: After memory is *reserved* it can be *initialized* with some content, and *deinitialized* to return that memory to the reserved region. This seems more understandable to me than the original scheme, which named these operations after the controller-side JITLinkMemoryManager operations that they partially implemented. I.e. SimpleNativeMemoryMap::finalize implemented the final step of JITLinkMemoryManager::finalize, initializing the memory in the executor; and SimpleNativeMemoryMap::deallocate implemented the final step of JITLinkMemoryManager::deallocate, running dealloc actions and releasing the finalized region. The proper way to think of the relationship between these operations now is that: 1. The final step of finalization is to initialize the memory in the executor. 2. The final step of deallocation is to deinitialize the memory in the executor.
2025-10-12[orc-rt] Add multi-addr dealloc/release to SimpleNativeMemoryMap. (#163025)Lang Hames
In an ORC JIT it's common for multiple memory regions to be deallocated at once, e.g. when a ResourceTracker covering multiple object files is removed. This commit adds SimpleNativeMemoryMap::deallocateMultiple and SimpleNativeMemoryMap::releaseMultiple APIs that can be used to reduce the number of calls (and consequently IPC messages in cross-process setups) in these cases. Adding these operations will make it easier to write an llvm::orc::MemoryMapper class that can use SimpleNativeMemoryMap as a backend.
2025-10-11[orc-rt] Add SPSExecutorAddr <-> T* serialization. (#162992)Lang Hames
This replaces SPS transparent conversion for pointers. Transparent conversion only applies to argument/return types, not nested types. We want to be able to serialize / deserialize structs containing pointers. We may need to replace this in the near future with a new SPSPointer tag type, since SPSExecutorAddr is meant to be serialization for pure addresses, and pointers may carry other information (e.g. tag bits), but we can do that in a follow-up commit.
2025-10-11[orc-rt] Align SimpleNativeMemoryMap Segment with LLVM type. (#162823)Lang Hames
This commit aims to align SimpleNativeMemoryMap::FinalizeRequest::Segment with llvm::orc::tpctypes::SegFinalizeRequest. This will simplify construction of a new LLVM JITLinkMemoryManager that's capable of using SimpleNativeMemoryMap as a backend.
2025-10-10[orc-rt] Enable span<const char> use in SPSWrapperFunctions. (#162792)Lang Hames
SPS deserialization for span<const char> produces a value that points directly into the argument buffer for efficiency. This was broken by an unnecessary std::move of the buffer inside WrapperFunction, which this commit removes.
2025-10-09[orc-rt] Remove (effectively) unused header orc-rt-c/orc-rt.h. NFCI.Lang Hames
This header was a placeholder in the initial project check-in, but is not used. Time to remove it.
2025-10-09[orc-rt] Add Session class. (#162590)Lang Hames
An orc-rt Session contains a JIT'd program, managing resources and communicating with a remote JIT-controller instance (expected to be an orc::ExecutionSession, though this is not required).
2025-10-09[orc-rt] Add SimpleNativeMemoryMap. (#162584)Lang Hames
SimpleNativeMemoryMap is a memory allocation backend for use with ORC. It can... 1. Reserve slabs of address space. 2. Finalize regions of memory within a reserved slab: copying content into requested addresses, applying memory protections, running finalization actions, and storing deallocation actions to be run by deallocate. 3. Deallocate finalized memory regions: running deallocate actions and, if possible, making memory in these regions available for use by future finalization operations. (Some systems prohibit reuse of executable memory. On these systems deallocated memory is no longer usable within the process). 4. Release reserved slabs. This runs deallocate for any not-yet-deallocated finalized regions, and then (if possible) returns the address space to system. (On systems that prohibit reuse of executable memory parts of the released address space may be permanently unusable by the process). SimpleNativeMemoryMap is intended primarily for use by llvm::orc::JITLinkMemoryManager implementations to allocate JIT'd code and data.
2025-10-09[orc-rt] Add ResourceManager interface.Lang Hames
The ResourceManager interface can be used to implement ownership for resources allocated to JIT'd code, e.g. memory and metadata registrations (frame info, language runtime metadata, etc.). Resources can be *deallocated*, meaning that they should be cleaned up (memory released, registrations deregistered, etc.), or they can be *detached*, meaning that cleanup should be performed automatically when the ResourceManager itself is destroyed. The intent is to allow JIT'd code to continue running after the llvm::orc::ExecutionSession that produced it is disconnected / destroyed.
2025-10-09[orc-rt] Enable SPS transparent conversion for reference arguments. (#162563)Lang Hames
Ensures that SPS transparent conversion will apply to arguments passed by reference.
2025-10-08[orc-rt] Rename unit tests for consistency. NFCI.Lang Hames
Related tests use "TransparentConversion" rather than "TransparentSerialization".
2025-10-08[orc-rt] Hoist DirectCaller test utility into header to enable re-use. (#162405)Lang Hames
The DirectCaller utility allows "direct" calls (with arguments serialized into, and then immediately back out of a WrapperFunctionBuffer) to wrapper functions. It was introduced for the SPSWrapperFunction tests, but will be useful for testing WrapperFunction interfaces for various orc-rt APIs too, so this commit hoists it somewhere where it can be reused.
2025-10-07[orc-rt] Add unit test utility: MakeAllocAction. (#162229)Lang Hames
MakeAllocAction can be used to construct AllocActions with less boilerplate than the previous option (spsSerialize + AllocAction constructor call). This will be used to simplify upcoming unit tests that use AllocActions. The existing AllocActionsTest is updated to use the new utility.
2025-10-07[orc-rt] Fix header ordering. NFCI.Lang Hames
2025-10-07[orc-rt] Add SPS serialization support for size_t. (#162214)Lang Hames
Serialize size_ts to uint64_t.
2025-10-07[orc-rt] Enable transparent SPS conversion for Expected<T*>. (#162073)Lang Hames
Expected<T*> values will be converted to/from Expected<ExecutorAddr> values.
2025-10-06[orc-rt] Clean up SPSWrapperFunction unittest names.Lang Hames
Drop the redundant 'Test' prefix and rename transparent serialization tests to clarify their purpose.
2025-10-06[orc-rt] Enable transparent SPS conversion for ptrs via ExecutorAddr. (#162069)Lang Hames
Allows SPS wrapper function calls and handles to use pointer arguments. These will be converted to ExecutorAddr for serialization / deserialization.
2025-10-06[orc-rt] Remove incorrect noexcept specifiers.Lang Hames
Conversions between Error/Expected and their serializable counterparts may throw.
2025-10-06[orc-rt] Add method-wrapper utils for use with WrapperFunction::handle. ↵Lang Hames
(#162035) WrapperFunction::handleWithAsyncMethod can be used to wrap asynchronous methods (void methods whose first arguments are Return callbacks) for use with WrapperFunction::handle. WrapperFunction::handleWithSyncMethod can be used to wrap regular (non-asynchronous) methods for use with WrapperFunction::handle. Both variants return function objects that take a Return callback as their first argument, and an ExecutorAddr representing the address of the instance to call the object on. For asynchronous methods the resulting function object (AsyncMethod<method-ptr>) forwards the Return callback through to the method. For synchronous methods the method is called and the result passed to the Return callback.
2025-10-05[orc-rt] WrapperFunction::handle: add by-ref args, minimize temporaries. ↵Lang Hames
(#161999) This adds support for WrapperFunction::handle handlers that take their arguments by reference, rather than by value. This commit also reduces the number of temporary objects created to support SPS-transparent conversion in SPSWrapperFunction.
2025-10-05[orc-rt] Support multiple copies of OpCounter unittest utility. (#161985)Lang Hames
This commit templatizes OpCounter with a size_t argument, allowing multiple copies of OpCounter to be easily created. This functionality will be used in upcoming unit tests that need to count operations on several types at once.
2025-10-03[orc-rt] Add transparent SPS conversion for error/expected types. (#161768)Lang Hames
This commit aims to reduce boilerplate by adding transparent conversion between Error/Expected types and their SPS-serializable counterparts (SPSSerializableError/SPSSerializableExpected). This allows SPSWrapperFunction calls and handles to be written in terms of Error/Expected directly. This functionality can also be extended to transparently convert between other types. This may be used in the future to provide conversion between ExecutorAddr and native pointer types.
2025-10-03[orc-rt] Refactor WrapperFunction to simplify Serializer classes. (#161763)Lang Hames
Serializers only need to provide two methods now, rather than four. The first method should return an argument serializer / deserializer, the second a result value serializer / deserializer. The interfaces for these are now more uniform (deserialize now returns a tuple, rather than taking its output location(s) by reference). The intent is to simplify Serializer helper code. NFCI.
2025-10-03[orc-rt] Add CallableTraitsHelper, refactor WrapperFunction to use it. (#161761)Lang Hames
CallableTraitsHelper identifies the return type and argument types of a callable type and passes those to an implementation class template to operate on. The CallableArgInfo utility uses CallableTraitsHelper to provide typedefs for the return type and argument types (as a tuple) of a callable type. In WrapperFunction.h, the detail::WFCallableTraits utility is rewritten in terms of CallableTraitsHandler (and renamed to WFHandlerTraits).
2025-10-03[orc-rt] Add testcase for Expected<Expected<T>> support. (#161660)Lang Hames
Follows addition of Expected<Error> support (99ce2062462), and has essentially the same motivation: supporting RPC calls to functions returning Expected<T>, where the RPC infrastructure wants to be able to wrap that result in its own Expected.
2025-10-02[orc-rt] Fix typo in comment. NFC.Lang Hames
2025-10-02[orc-rt] Add support for constructing Expected<Error> values. (#161656)Lang Hames
These will be used in upcoming RPC support patches where the outer Expected value captures any RPC-infrastructure errors, and the inner Error is returned from the romet call (i.e. the remote handler's return type is Error).
2025-10-02[orc-rt] Tidy up some type_traits uses. NFC.Lang Hames
2025-09-10[orc-rt] Simplify construction of SPSSerializableExpected from values. (#157796)Lang Hames
Adds an overload of toSPSSerializableExpected that takes a plain T value and returns an SPSSerializableExpected<T>. This will reduce some boilerplate when creating SPSSerializableExpected values.
2025-09-10[orc-rt] Add WrapperFunction::handle support for fns, fn-ptrs. (#157787)Lang Hames
Adds support for using functions and function pointers to the WrapperFunction::handle utility.
2025-09-10[orc-rt] Use perfect forwarding for scope-exit initialization. (#157786)Lang Hames
Allows the use of move-only types with make_scope_exit.
2025-09-10[orc-rt] Host std::decay_t out of helper for orc_rt::bind_front. NFC. (#157785)Lang Hames
The helper implementation shouldn't differ based on how it's initialized.
2025-09-10[orc-rt] Restore perfect forwarding to move_only_function init (#157784)Lang Hames
After the recent change to hoist std::decay_t (cd8f47b2d4e) we were forcing move-initialization of the callable type. This commit restores perfect forwarding so that we copy-initialize where expected.
2025-09-10[orc-rt] Add const support to move_only_function. (#157781)Lang Hames
Adds support for both const move_only_functions, and const callees.
2025-09-10[orc-rt] Rename helper class. NFC.Lang Hames
This commit is cleanup in preparation for adding const support to orc_rt::move_only_function.
2025-09-10[orc-rt] Hoist std::decay_t out of helper class.Lang Hames
The helper implementation shouldn't differ based on how it's initialized.
2025-09-09[orc-rt] Add SPS serialization for AllocAction and AllocActionPair. (#157620)Lang Hames