[all-commits] [llvm/llvm-project] 0bfa0b: [ORC] Replace ThreadSafeContext::getContext with w...

Lang Hames via All-commits all-commits at lists.llvm.org
Thu Jul 3 00:04:01 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0bfa0bcd79f787db6194270bb838ae04ca46587e
      https://github.com/llvm/llvm-project/commit/0bfa0bcd79f787db6194270bb838ae04ca46587e
  Author: Lang Hames <lhames at gmail.com>
  Date:   2025-07-03 (Thu, 03 Jul 2025)

  Changed paths:
    M clang/lib/Interpreter/Interpreter.cpp
    M llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp
    M llvm/examples/OrcV2Examples/OrcV2CBindingsBasicUsage/OrcV2CBindingsBasicUsage.c
    M llvm/examples/OrcV2Examples/OrcV2CBindingsDumpObjects/OrcV2CBindingsDumpObjects.c
    M llvm/examples/OrcV2Examples/OrcV2CBindingsIRTransforms/OrcV2CBindingsIRTransforms.c
    M llvm/examples/OrcV2Examples/OrcV2CBindingsLazy/OrcV2CBindingsLazy.c
    M llvm/examples/OrcV2Examples/OrcV2CBindingsMCJITLikeMemoryManager/OrcV2CBindingsMCJITLikeMemoryManager.c
    M llvm/examples/OrcV2Examples/OrcV2CBindingsRemovableCode/OrcV2CBindingsRemovableCode.c
    M llvm/examples/OrcV2Examples/OrcV2CBindingsVeryLazy/OrcV2CBindingsVeryLazy.c
    M llvm/include/llvm-c/Orc.h
    M llvm/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h
    M llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp
    M llvm/lib/ExecutionEngine/Orc/Speculation.cpp
    M llvm/lib/ExecutionEngine/Orc/ThreadSafeModule.cpp
    M llvm/tools/lli/lli.cpp
    M llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
    M llvm/unittests/ExecutionEngine/Orc/ReOptimizeLayerTest.cpp
    M llvm/unittests/ExecutionEngine/Orc/ThreadSafeModuleTest.cpp

  Log Message:
  -----------
  [ORC] Replace ThreadSafeContext::getContext with withContextDo. (#146819)

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).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list