[all-commits] [llvm/llvm-project] 6ab43f: [Support] Add PerThreadBumpPtrAllocator class.

avl-llvm via All-commits all-commits at lists.llvm.org
Sat May 6 05:36:26 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6ab43f9b87ce982fed7073d91da6c5f027321b53
      https://github.com/llvm/llvm-project/commit/6ab43f9b87ce982fed7073d91da6c5f027321b53
  Author: Alexey Lapshin <a.v.lapshin at mail.ru>
  Date:   2023-05-06 (Sat, 06 May 2023)

  Changed paths:
    M llvm/include/llvm/DWARFLinkerParallel/StringPool.h
    M llvm/include/llvm/Support/Parallel.h
    A llvm/include/llvm/Support/PerThreadBumpPtrAllocator.h
    M llvm/lib/Support/Parallel.cpp
    M llvm/unittests/ADT/ConcurrentHashtableTest.cpp
    M llvm/unittests/DWARFLinkerParallel/StringPoolTest.cpp
    M llvm/unittests/DWARFLinkerParallel/StringTableTest.cpp
    M llvm/unittests/Support/CMakeLists.txt
    A llvm/unittests/Support/PerThreadBumpPtrAllocatorTest.cpp

  Log Message:
  -----------
  [Support] Add PerThreadBumpPtrAllocator class.

PerThreadBumpPtrAllocator allows separating allocations by thread id.
That makes allocations race free. It is possible because
ThreadPoolExecutor class creates threads, keeps them until
the destructor of ThreadPoolExecutor is called, and assigns ids
to the threads. Thus PerThreadBumpPtrAllocator should be used with only
threads created by ThreadPoolExecutor. This allocator is useful when
thread safe BumpPtrAllocator is needed.

Reviewed By: MaskRay, dexonsmith, andrewng

Differential Revision: https://reviews.llvm.org/D142318




More information about the All-commits mailing list