7 Commits

Author SHA1 Message Date
Alexey Lapshin
6ab43f9b87 [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
2023-05-06 14:35:26 +02:00
Alexey Lapshin
33c442118f [Reland][ADT][ConcurrentHashTable] adapt ConcurrentHashTable and its users to LLVM_ENABLE_THREADS=0 mode.
This patch hides thread specific handling under LLVM_ENABLE_THREADS guard.
It also removes usages of thread_local variables, since it has a weak
support on some platforms. Instead, the patch uses single mutex for locking
allocator. That may be replaced with more effective allocator later.
f.e. D142318

Differential Revision: https://reviews.llvm.org/D147649
2023-04-12 11:28:44 +02:00
Alexey Lapshin
b24b179b1a Revert "[ADT][ConcurrentHashTable] Change thread_local to LLVM_THREAD_LOCAL inside unit test."
This reverts commit 9ef701318b4590e1fa8bb61906d5957d7b1f6a2f.
2023-04-06 04:55:26 +02:00
Alexey Lapshin
9ef701318b [ADT][ConcurrentHashTable] Change thread_local to LLVM_THREAD_LOCAL inside unit test.
Not all platform support C++11 thread_local. Use portable
LLVM_THREAD_LOCAL macro instead.

Differential Revision: https://reviews.llvm.org/D147649
2023-04-05 22:15:51 +02:00
Alexey Lapshin
42058eea79 [reland][ADT] add ConcurrentHashtable class.
ConcurrentHashTable - is a resizeable concurrent hashtable.
The range of resizings is limited up to x2^31.
The hashtable allows only concurrent insertions.

Concurrent hashtable is necessary for the D96035 patch.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D132455
2023-03-27 15:49:00 +02:00
Alexey Lapshin
fd4aeba307 Revert "[ADT] add ConcurrentHashtable class."
This reverts commit 8482b238062ed7263facea9490f67119e00a037a.
2023-03-23 14:42:40 +01:00
Alexey Lapshin
8482b23806 [ADT] add ConcurrentHashtable class.
ConcurrentHashTable - is a resizeable concurrent hashtable.
The range of resizings is limited up to x2^32. The hashtable allows only concurrent insertions.

Concurrent hashtable is necessary for the D96035 patch.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D132455
2023-03-23 14:32:43 +01:00