| 31 | #ifdef ENABLE_SAMPLING |
| 32 | template <class T, class IndexType, IndexType CAPACITY> |
| 33 | auto WriteOnlySet<T, IndexType, CAPACITY>::insert(const Reference<T>& lineage) -> Index { |
| 34 | Index res; |
| 35 | if (!freeQueue.pop(res)) { |
| 36 | TraceEvent(SevWarnAlways, "NoCapacityInWriteOnlySet"); |
| 37 | return npos; |
| 38 | } |
| 39 | ASSERT(_set[res].load() == 0); |
| 40 | auto ptr = reinterpret_cast<uintptr_t>(lineage.getPtr()); |
| 41 | ASSERT((ptr % 2) == 0); // this needs to be at least 2-byte aligned |
| 42 | ASSERT(ptr != 0); |
| 43 | lineage->addref(); |
| 44 | _set[res].store(ptr); |
| 45 | return res; |
| 46 | } |
| 47 | |
| 48 | template <class T, class IndexType, IndexType CAPACITY> |
| 49 | bool WriteOnlySet<T, IndexType, CAPACITY>::eraseImpl(Index idx) { |