File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -256,6 +256,9 @@ Changes to the C API
256256* Added `` LLVMGetICmpSameSign `` and `` LLVMSetICmpSameSign `` for the ` samesign `
257257 flag on ` icmp ` instructions.
258258
259+ * Added ` LLVMOrcThreadSafeContextGetLock ` and ` LLVMOrcThreadSafeContextReleaseLock `
260+ for acquiring and releasing locks associated with ` ThreadSafeContext ` instances.
261+
259262Changes to the CodeGen infrastructure
260263-------------------------------------
261264
Original file line number Diff line number Diff line change @@ -385,6 +385,12 @@ typedef int (*LLVMOrcSymbolPredicate)(void *Ctx,
385385 */
386386typedef struct LLVMOrcOpaqueThreadSafeContext *LLVMOrcThreadSafeContextRef;
387387
388+ /* *
389+ * A reference to an orc::ThreadSafeContext::Lock instance.
390+ */
391+ typedef struct LLVMOrcOpaqueThreadSafeContextLock
392+ *LLVMOrcThreadSafeContextLockRef;
393+
388394/* *
389395 * A reference to an orc::ThreadSafeModule instance.
390396 */
@@ -1082,6 +1088,18 @@ LLVMOrcThreadSafeContextGetContext(LLVMOrcThreadSafeContextRef TSCtx);
10821088 */
10831089void LLVMOrcDisposeThreadSafeContext (LLVMOrcThreadSafeContextRef TSCtx);
10841090
1091+ /* *
1092+ * Acquire the lock associated with a ThreadSafeContext.
1093+ */
1094+ LLVMOrcThreadSafeContextLockRef
1095+ LLVMOrcThreadSafeContextGetLock (LLVMOrcThreadSafeContextRef TSCtx);
1096+
1097+ /* *
1098+ * Release the lock associated with a ThreadSafeContext.
1099+ */
1100+ void LLVMOrcThreadSafeContextReleaseLock (
1101+ LLVMOrcThreadSafeContextLockRef TSCtxLock);
1102+
10851103/* *
10861104 * Create a ThreadSafeModule wrapper around the given LLVM module. This takes
10871105 * ownership of the M argument which should not be disposed of or referenced
Original file line number Diff line number Diff line change @@ -61,6 +61,8 @@ DEFINE_SIMPLE_CONVERSION_FUNCTIONS(DefinitionGenerator,
6161DEFINE_SIMPLE_CONVERSION_FUNCTIONS(InProgressLookupState, LLVMOrcLookupStateRef)
6262DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ThreadSafeContext,
6363 LLVMOrcThreadSafeContextRef)
64+ DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ThreadSafeContext::Lock,
65+ LLVMOrcThreadSafeContextLockRef)
6466DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ThreadSafeModule, LLVMOrcThreadSafeModuleRef)
6567DEFINE_SIMPLE_CONVERSION_FUNCTIONS(JITTargetMachineBuilder,
6668 LLVMOrcJITTargetMachineBuilderRef)
@@ -738,6 +740,16 @@ void LLVMOrcDisposeThreadSafeContext(LLVMOrcThreadSafeContextRef TSCtx) {
738740 delete unwrap (TSCtx);
739741}
740742
743+ LLVMOrcThreadSafeContextLockRef
744+ LLVMOrcThreadSafeContextGetLock (LLVMOrcThreadSafeContextRef TSCtx) {
745+ return wrap (new ThreadSafeContext::Lock (std::move (unwrap (TSCtx)->getLock ())));
746+ }
747+
748+ void LLVMOrcThreadSafeContextReleaseLock (
749+ LLVMOrcThreadSafeContextLockRef TSCtxLock) {
750+ delete unwrap (TSCtxLock);
751+ }
752+
741753LLVMErrorRef
742754LLVMOrcThreadSafeModuleWithModuleDo (LLVMOrcThreadSafeModuleRef TSM,
743755 LLVMOrcGenericIRModuleOperationFunction F,
You can’t perform that action at this time.
0 commit comments