[Openmp-commits] [PATCH] D103606: [OpenMP][Tools] Cleanup memory pool used in Archer
Jonas Hahnfeld via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Sun Jun 6 23:26:55 PDT 2021
Hahnfeld added inline comments.
================
Comment at: openmp/tools/archer/ompt-tsan.cpp:361-362
-// This function takes care to return the data to the originating DataPool
-// A pointer to the originating DataPool is stored just before the actual data.
-template <typename T, int N> static void retData(void *data) {
- ((DataPool<T, N> **)data)[-1]->returnData((T *)data);
-}
+template <typename T> struct PoolData {
+ DataPool<T> *owner;
+
----------------
I find `PoolData` vs `DataPool` highly confusing. Maybe `DataPoolEntry`?
================
Comment at: openmp/tools/archer/ompt-tsan.cpp:366-374
+ virtual void Delete() {
+ this->Reset();
+ if (owner == DataPool<T>::ThreadDataPool)
+ owner->returnOwnData(static_cast<T *>(this));
+ else
+ owner->returnData(static_cast<T *>(this));
+ }
----------------
Shouldn't be `virtual`, the idea of CRTP is that you can do without. `Reset` can be called after `static_cast<T *>`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103606/new/
https://reviews.llvm.org/D103606
More information about the Openmp-commits
mailing list