aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/actors/util
diff options
context:
space:
mode:
authorilnurkh <ilnurkh@yandex-team.com>2023-10-16 20:19:28 +0300
committerilnurkh <ilnurkh@yandex-team.com>2023-10-16 20:52:22 +0300
commit23b4cd86157da8b9f0f8acd5ef46acfab39669db (patch)
tree09572627315c6029e0434702e8330c557476ff06 /library/cpp/actors/util
parent05d934cd8bfcf7ce4b6241d6bd2914cc776877f9 (diff)
downloadydb-23b4cd86157da8b9f0f8acd5ef46acfab39669db.tar.gz
Y_VERIFY_DEBUG->Y_DEBUG_ABORT_UNLESS at '-v ydb'
https://clubs.at.yandex-team.ru/arcadia/29404
Diffstat (limited to 'library/cpp/actors/util')
-rw-r--r--library/cpp/actors/util/affinity.cpp4
-rw-r--r--library/cpp/actors/util/queue_oneone_inplace.h2
-rw-r--r--library/cpp/actors/util/rc_buf.h6
-rw-r--r--library/cpp/actors/util/rc_buf_backend.h4
-rw-r--r--library/cpp/actors/util/rope.h48
-rw-r--r--library/cpp/actors/util/rope_cont_embedded_list.h38
-rw-r--r--library/cpp/actors/util/shared_data.cpp2
-rw-r--r--library/cpp/actors/util/shared_data.h8
-rw-r--r--library/cpp/actors/util/ticket_lock.h2
-rw-r--r--library/cpp/actors/util/unordered_cache.h2
10 files changed, 58 insertions, 58 deletions
diff --git a/library/cpp/actors/util/affinity.cpp b/library/cpp/actors/util/affinity.cpp
index cc1b6e70ec..5851105ae7 100644
--- a/library/cpp/actors/util/affinity.cpp
+++ b/library/cpp/actors/util/affinity.cpp
@@ -12,7 +12,7 @@ public:
TImpl() {
#ifdef _linux_
int ar = sched_getaffinity(0, sizeof(cpu_set_t), &Mask);
- Y_VERIFY_DEBUG(ar == 0);
+ Y_DEBUG_ABORT_UNLESS(ar == 0);
#endif
}
@@ -33,7 +33,7 @@ public:
void Set() const {
#ifdef _linux_
int ar = sched_setaffinity(0, sizeof(cpu_set_t), &Mask);
- Y_VERIFY_DEBUG(ar == 0);
+ Y_DEBUG_ABORT_UNLESS(ar == 0);
#endif
}
diff --git a/library/cpp/actors/util/queue_oneone_inplace.h b/library/cpp/actors/util/queue_oneone_inplace.h
index d7ec8bb21c..288011955a 100644
--- a/library/cpp/actors/util/queue_oneone_inplace.h
+++ b/library/cpp/actors/util/queue_oneone_inplace.h
@@ -48,7 +48,7 @@ public:
}
~TOneOneQueueInplace() {
- Y_VERIFY_DEBUG(Head() == 0);
+ Y_DEBUG_ABORT_UNLESS(Head() == 0);
delete ReadFrom;
}
diff --git a/library/cpp/actors/util/rc_buf.h b/library/cpp/actors/util/rc_buf.h
index 638a410f6b..b5b15fa4cc 100644
--- a/library/cpp/actors/util/rc_buf.h
+++ b/library/cpp/actors/util/rc_buf.h
@@ -69,7 +69,7 @@ public:
{}
const char& operator[](size_t index) const {
- Y_VERIFY_DEBUG(index < Size_);
+ Y_DEBUG_ABORT_UNLESS(index < Size_);
return Data_[index];
}
@@ -639,7 +639,7 @@ class TRcBuf {
if constexpr (sizeof(TObject) <= sizeof(TBackendHolder)) {
TBackendHolder res = TBackend::Empty;
new(&res) std::decay_t<TObject>(std::forward<TObject>(object));
- Y_VERIFY_DEBUG((res.Data[0] & ValueMask) == res.Data[0]);
+ Y_DEBUG_ABORT_UNLESS((res.Data[0] & ValueMask) == res.Data[0]);
res.Data[0] = res.Data[0] | static_cast<uintptr_t>(type);
return res;
} else {
@@ -649,7 +649,7 @@ class TRcBuf {
template<typename TOwner, typename TCallback, bool IsConst = std::is_const_v<TOwner>>
static std::invoke_result_t<TCallback, EType, std::conditional_t<IsConst, const TString&, TString&>> VisitRaw(TOwner& origValue, TCallback&& callback) {
- Y_VERIFY_DEBUG(origValue);
+ Y_DEBUG_ABORT_UNLESS(origValue);
const EType type = static_cast<EType>(origValue.Data[0] & TypeMask);
TBackendHolder value(origValue);
value.Data[0] = value.Data[0] & ValueMask;
diff --git a/library/cpp/actors/util/rc_buf_backend.h b/library/cpp/actors/util/rc_buf_backend.h
index f7089a302c..9cb8616554 100644
--- a/library/cpp/actors/util/rc_buf_backend.h
+++ b/library/cpp/actors/util/rc_buf_backend.h
@@ -157,12 +157,12 @@ public:
private:
Y_FORCE_INLINE THeader* Header() const noexcept {
- Y_VERIFY_DEBUG(Data_);
+ Y_DEBUG_ABORT_UNLESS(Data_);
return reinterpret_cast<THeader*>(Data_);
}
Y_FORCE_INLINE char* Data() const noexcept {
- Y_VERIFY_DEBUG(Data_);
+ Y_DEBUG_ABORT_UNLESS(Data_);
return Data_ + OverheadSize;
}
diff --git a/library/cpp/actors/util/rope.h b/library/cpp/actors/util/rope.h
index 1ab9a1b8ee..4487fdc87d 100644
--- a/library/cpp/actors/util/rope.h
+++ b/library/cpp/actors/util/rope.h
@@ -162,7 +162,7 @@ private:
CheckValid();
while (amount) {
- Y_VERIFY_DEBUG(Valid());
+ Y_DEBUG_ABORT_UNLESS(Valid());
const size_t max = ContiguousSize();
const size_t num = std::min(amount, max);
amount -= num;
@@ -189,7 +189,7 @@ private:
amount -= num;
Ptr -= num;
if (amount) {
- Y_VERIFY_DEBUG(Iter != GetChainBegin());
+ Y_DEBUG_ABORT_UNLESS(Iter != GetChainBegin());
--Iter;
Ptr = Iter->End;
}
@@ -253,7 +253,7 @@ private:
// Advance to next contiguous block of data.
void AdvanceToNextContiguousBlock() {
CheckValid();
- Y_VERIFY_DEBUG(Valid());
+ Y_DEBUG_ABORT_UNLESS(Valid());
++Iter;
Ptr = Iter != GetChainEnd() ? Iter->Begin : nullptr;
}
@@ -263,7 +263,7 @@ private:
CheckValid();
while (len) {
- Y_VERIFY_DEBUG(Ptr);
+ Y_DEBUG_ABORT_UNLESS(Ptr);
// calculate amount of bytes we need to move
const size_t max = ContiguousSize();
@@ -290,7 +290,7 @@ private:
template<bool IsOtherConst>
bool operator ==(const TIteratorImpl<IsOtherConst>& other) const {
- Y_VERIFY_DEBUG(Rope == other.Rope);
+ Y_DEBUG_ABORT_UNLESS(Rope == other.Rope);
CheckValid();
other.CheckValid();
return Iter == other.Iter && Ptr == other.Ptr;
@@ -399,7 +399,7 @@ public:
}
TRope(TConstIterator begin, TConstIterator end) {
- Y_VERIFY_DEBUG(begin.Rope == end.Rope);
+ Y_DEBUG_ABORT_UNLESS(begin.Rope == end.Rope);
if (begin.Rope == this) {
TRope temp(begin, end);
*this = std::move(temp);
@@ -545,8 +545,8 @@ public:
}
void Insert(TIterator pos, TRope&& rope) {
- Y_VERIFY_DEBUG(this == pos.Rope);
- Y_VERIFY_DEBUG(this != &rope);
+ Y_DEBUG_ABORT_UNLESS(this == pos.Rope);
+ Y_DEBUG_ABORT_UNLESS(this != &rope);
if (!rope) {
return; // do nothing for empty rope
@@ -595,16 +595,16 @@ public:
if (rope) { // insert remains
Chain.Splice(pos.Iter, rope.Chain, rope.Chain.begin(), rope.Chain.end());
}
- Y_VERIFY_DEBUG(!rope);
+ Y_DEBUG_ABORT_UNLESS(!rope);
InvalidateIterators();
}
void EraseFront(size_t len) {
- Y_VERIFY_DEBUG(Size >= len);
+ Y_DEBUG_ABORT_UNLESS(Size >= len);
Size -= len;
while (len) {
- Y_VERIFY_DEBUG(Chain);
+ Y_DEBUG_ABORT_UNLESS(Chain);
TRcBuf& item = Chain.GetFirstChunk();
const size_t itemSize = item.GetSize();
if (len >= itemSize) {
@@ -620,11 +620,11 @@ public:
}
void EraseBack(size_t len) {
- Y_VERIFY_DEBUG(Size >= len);
+ Y_DEBUG_ABORT_UNLESS(Size >= len);
Size -= len;
while (len) {
- Y_VERIFY_DEBUG(Chain);
+ Y_DEBUG_ABORT_UNLESS(Chain);
TRcBuf& item = Chain.GetLastChunk();
const size_t itemSize = item.GetSize();
if (len >= itemSize) {
@@ -647,7 +647,7 @@ public:
Size -= len;
while (len) {
auto& chunk = Chain.GetFirstChunk();
- Y_VERIFY_DEBUG(chunk.Backend);
+ Y_DEBUG_ABORT_UNLESS(chunk.Backend);
const size_t num = Min(len, chunk.GetSize());
memcpy(buffer, chunk.Begin, num);
buffer = static_cast<char*>(buffer) + num;
@@ -848,7 +848,7 @@ public:
private:
void Cut(TIterator begin, TIterator end, TRope *target) {
// ensure all iterators are belong to us
- Y_VERIFY_DEBUG(this == begin.Rope && this == end.Rope);
+ Y_DEBUG_ABORT_UNLESS(this == begin.Rope && this == end.Rope);
// if begin and end are equal, we do nothing -- checking this case allows us to find out that begin does not
// point to End(), for example
@@ -886,7 +886,7 @@ private:
// now drop full blocks
size_t rangeSize = 0;
for (auto it = begin.Iter; it != end.Iter; ++it) {
- Y_VERIFY_DEBUG(it->GetSize());
+ Y_DEBUG_ABORT_UNLESS(it->GetSize());
rangeSize += it->GetSize();
}
if (rangeSize) {
@@ -927,7 +927,7 @@ public:
while (len) {
if (Arena) {
auto iter = Arena.Begin();
- Y_VERIFY_DEBUG(iter.Valid());
+ Y_DEBUG_ABORT_UNLESS(iter.Valid());
char *dest = const_cast<char*>(iter.ContiguousData());
const size_t bytesToCopy = std::min(len, iter.ContiguousSize());
memcpy(dest, buffer, bytesToCopy);
@@ -952,7 +952,7 @@ public:
struct TRopeUtils {
static void Memset(TRope::TConstIterator dst, char c, size_t size) {
while (size) {
- Y_VERIFY_DEBUG(dst.Valid());
+ Y_DEBUG_ABORT_UNLESS(dst.Valid());
size_t len = std::min(size, dst.ContiguousSize());
memset(const_cast<char*>(dst.ContiguousData()), c, len);
dst += len;
@@ -962,7 +962,7 @@ struct TRopeUtils {
static void Memcpy(TRope::TConstIterator dst, TRope::TConstIterator src, size_t size) {
while (size) {
- Y_VERIFY_DEBUG(dst.Valid() && src.Valid(),
+ Y_DEBUG_ABORT_UNLESS(dst.Valid() && src.Valid(),
"Invalid iterator in memcpy: dst.Valid() - %" PRIu32 ", src.Valid() - %" PRIu32,
(ui32)dst.Valid(), (ui32)src.Valid());
size_t len = std::min(size, std::min(dst.ContiguousSize(), src.ContiguousSize()));
@@ -975,7 +975,7 @@ struct TRopeUtils {
static void Memcpy(TRope::TConstIterator dst, const char* src, size_t size) {
while (size) {
- Y_VERIFY_DEBUG(dst.Valid());
+ Y_DEBUG_ABORT_UNLESS(dst.Valid());
size_t len = std::min(size, dst.ContiguousSize());
memcpy(const_cast<char*>(dst.ContiguousData()), src, len);
size -= len;
@@ -986,7 +986,7 @@ struct TRopeUtils {
static void Memcpy(char* dst, TRope::TConstIterator src, size_t size) {
while (size) {
- Y_VERIFY_DEBUG(src.Valid());
+ Y_DEBUG_ABORT_UNLESS(src.Valid());
size_t len = std::min(size, src.ContiguousSize());
memcpy(dst, src.ContiguousData(), len);
size -= len;
@@ -1080,13 +1080,13 @@ class TRopeZeroCopyInput : public IZeroCopyInput {
private:
size_t DoNext(const void** ptr, size_t len) override {
- Y_VERIFY_DEBUG(ptr);
+ Y_DEBUG_ABORT_UNLESS(ptr);
if (Len == 0) {
if (Iter.Valid()) {
Data = Iter.ContiguousData();
Len = Iter.ContiguousSize();
- Y_VERIFY_DEBUG(Len);
- Y_VERIFY_DEBUG(Data);
+ Y_DEBUG_ABORT_UNLESS(Len);
+ Y_DEBUG_ABORT_UNLESS(Data);
++Iter;
} else {
Data = nullptr;
diff --git a/library/cpp/actors/util/rope_cont_embedded_list.h b/library/cpp/actors/util/rope_cont_embedded_list.h
index 80d5990310..294599538f 100644
--- a/library/cpp/actors/util/rope_cont_embedded_list.h
+++ b/library/cpp/actors/util/rope_cont_embedded_list.h
@@ -40,14 +40,14 @@ class TChunkList {
}
void ClearSingleItem() {
- Y_VERIFY_DEBUG(Next == this && Prev == this);
+ Y_DEBUG_ABORT_UNLESS(Next == this && Prev == this);
static_cast<TChunk&>(*this) = {};
Next = Prev = nullptr;
}
template<typename... TArgs>
TItem *PrepareForUse(TArgs&&... args) {
- Y_VERIFY_DEBUG(!IsInUse());
+ Y_DEBUG_ABORT_UNLESS(!IsInUse());
static_cast<TChunk&>(*this) = TChunk(std::forward<TArgs>(args)...);
Next = Prev = this;
Invalidate();
@@ -136,7 +136,7 @@ private:
TIterator& operator++() {
CheckValid();
- Y_VERIFY_DEBUG(Item);
+ Y_DEBUG_ABORT_UNLESS(Item);
Item = Item->Next;
if (Item == &Cont->Root) {
Item = nullptr; // make it end
@@ -154,10 +154,10 @@ private:
TIterator& operator--() {
CheckValid();
if (!Item) {
- Y_VERIFY_DEBUG(*Cont);
+ Y_DEBUG_ABORT_UNLESS(*Cont);
Item = Cont->Root.Prev;
} else {
- Y_VERIFY_DEBUG(Item != &Cont->Root);
+ Y_DEBUG_ABORT_UNLESS(Item != &Cont->Root);
Item = Item->Prev;
}
UpdateValidityToken();
@@ -171,7 +171,7 @@ private:
}
friend bool operator ==(const TIterator& x, const TIterator& y) {
- Y_VERIFY_DEBUG(x.Cont == y.Cont);
+ Y_DEBUG_ABORT_UNLESS(x.Cont == y.Cont);
x.CheckValid();
y.CheckValid();
return x.Item == y.Item;
@@ -184,8 +184,8 @@ private:
private:
void CheckValid() const {
#ifndef NDEBUG
- Y_VERIFY_DEBUG(ValidityToken == (Item ? Item->ValidityToken : 0));
- Y_VERIFY_DEBUG(Cont && (Item != &Cont->Root || *Cont));
+ Y_DEBUG_ABORT_UNLESS(ValidityToken == (Item ? Item->ValidityToken : 0));
+ Y_DEBUG_ABORT_UNLESS(Cont && (Item != &Cont->Root || *Cont));
#endif
}
@@ -207,7 +207,7 @@ public:
~TChunkList() {
Erase(begin(), end());
- Y_VERIFY_DEBUG(!*this);
+ Y_DEBUG_ABORT_UNLESS(!*this);
}
TChunkList(const TChunkList& other) {
@@ -231,7 +231,7 @@ public:
TChunkList& operator=(TChunkList&& other) {
if (this != &other) {
Erase(begin(), end());
- Y_VERIFY_DEBUG(!*this);
+ Y_DEBUG_ABORT_UNLESS(!*this);
if (other.Root.IsInUse()) { // do we have something to move?
Root.PrepareForUse(std::move(static_cast<TChunk&>(other.Root)));
if (other.Root.Next != &other.Root) { // does other contain more than one item?
@@ -290,7 +290,7 @@ public:
}
void EraseBack() {
- Y_VERIFY_DEBUG(*this);
+ Y_DEBUG_ABORT_UNLESS(*this);
if (Root.Prev != &Root) {
delete Root.Prev;
} else {
@@ -324,8 +324,8 @@ public:
if (first != last) {
--last; // set 'last' pointing to the actual last element of the source range
- Y_VERIFY_DEBUG(first.Item != &from.Root);
- Y_VERIFY_DEBUG(pos.Item != &Root);
+ Y_DEBUG_ABORT_UNLESS(first.Item != &from.Root);
+ Y_DEBUG_ABORT_UNLESS(pos.Item != &Root);
TItem* const firstItem = first.Item;
TItem* const lastItem = last.Item;
@@ -347,9 +347,9 @@ public:
operator bool() const { return Root.IsInUse(); }
- TChunk& GetFirstChunk() { Y_VERIFY_DEBUG(*this); return Root; }
- const TChunk& GetFirstChunk() const { Y_VERIFY_DEBUG(*this); return Root; }
- TChunk& GetLastChunk() { Y_VERIFY_DEBUG(*this); return *Root.Prev; }
+ TChunk& GetFirstChunk() { Y_DEBUG_ABORT_UNLESS(*this); return Root; }
+ const TChunk& GetFirstChunk() const { Y_DEBUG_ABORT_UNLESS(*this); return Root; }
+ TChunk& GetLastChunk() { Y_DEBUG_ABORT_UNLESS(*this); return *Root.Prev; }
iterator begin() { return *this ? iterator(this, &Root) : end(); }
const_iterator begin() const { return *this ? const_iterator(this, &Root) : end(); }
@@ -359,14 +359,14 @@ public:
private:
TChunk Pop(iterator& pos) {
pos.CheckValid();
- Y_VERIFY_DEBUG(pos.Item);
+ Y_DEBUG_ABORT_UNLESS(pos.Item);
if (pos.Item == &Root) {
TChunk res = PopFront();
pos = begin();
return res;
} else {
- Y_VERIFY_DEBUG(pos != end());
+ Y_DEBUG_ABORT_UNLESS(pos != end());
TItem* const item = pos++.Item;
TChunk res = std::move(static_cast<TChunk&>(*item));
delete item;
@@ -375,7 +375,7 @@ private:
}
TChunk PopFront() {
- Y_VERIFY_DEBUG(*this);
+ Y_DEBUG_ABORT_UNLESS(*this);
TChunk res = std::move(static_cast<TChunk&>(Root));
if (Root.Next != &Root) {
static_cast<TChunk&>(Root) = std::move(static_cast<TChunk&>(*Root.Next));
diff --git a/library/cpp/actors/util/shared_data.cpp b/library/cpp/actors/util/shared_data.cpp
index 209ca7bcbd..51311ce7a3 100644
--- a/library/cpp/actors/util/shared_data.cpp
+++ b/library/cpp/actors/util/shared_data.cpp
@@ -40,7 +40,7 @@ namespace NActors {
NActors::NMemory::TLabel<MemoryLabelSharedData>::Sub(privateHeader->AllocSize);
auto* header = reinterpret_cast<THeader*>(raw + PrivateHeaderSize);
- Y_VERIFY_DEBUG(header->Owner == nullptr);
+ Y_DEBUG_ABORT_UNLESS(header->Owner == nullptr);
y_deallocate(raw);
}
diff --git a/library/cpp/actors/util/shared_data.h b/library/cpp/actors/util/shared_data.h
index 753eb85d07..bd9afb00a5 100644
--- a/library/cpp/actors/util/shared_data.h
+++ b/library/cpp/actors/util/shared_data.h
@@ -86,9 +86,9 @@ namespace NActors {
Y_FORCE_INLINE explicit operator bool() const { return Size_ > 0; }
- Y_FORCE_INLINE char* mutable_data() { Y_VERIFY_DEBUG(IsPrivate()); return Data_; }
- Y_FORCE_INLINE char* mutable_begin() { Y_VERIFY_DEBUG(IsPrivate()); return Data_; }
- Y_FORCE_INLINE char* mutable_end() { Y_VERIFY_DEBUG(IsPrivate()); return Data_ + Size_; }
+ Y_FORCE_INLINE char* mutable_data() { Y_DEBUG_ABORT_UNLESS(IsPrivate()); return Data_; }
+ Y_FORCE_INLINE char* mutable_begin() { Y_DEBUG_ABORT_UNLESS(IsPrivate()); return Data_; }
+ Y_FORCE_INLINE char* mutable_end() { Y_DEBUG_ABORT_UNLESS(IsPrivate()); return Data_ + Size_; }
Y_FORCE_INLINE const char* data() const { return Data_; }
Y_FORCE_INLINE const char* begin() const { return Data_; }
@@ -188,7 +188,7 @@ namespace NActors {
private:
Y_FORCE_INLINE THeader* Header() const noexcept {
- Y_VERIFY_DEBUG(Data_);
+ Y_DEBUG_ABORT_UNLESS(Data_);
return reinterpret_cast<THeader*>(Data_ - sizeof(THeader));
}
diff --git a/library/cpp/actors/util/ticket_lock.h b/library/cpp/actors/util/ticket_lock.h
index 3b1fa80393..30355c3390 100644
--- a/library/cpp/actors/util/ticket_lock.h
+++ b/library/cpp/actors/util/ticket_lock.h
@@ -23,7 +23,7 @@ public:
ui32 revolves = 0;
const ui32 ticket = AtomicUi32Increment(&TicketIn) - 1;
while (ticket != AtomicLoad(&TicketOut)) {
- Y_VERIFY_DEBUG(ticket >= AtomicLoad(&TicketOut));
+ Y_DEBUG_ABORT_UNLESS(ticket >= AtomicLoad(&TicketOut));
SpinLockPause();
++revolves;
}
diff --git a/library/cpp/actors/util/unordered_cache.h b/library/cpp/actors/util/unordered_cache.h
index 0ab1a3d220..40794fc04b 100644
--- a/library/cpp/actors/util/unordered_cache.h
+++ b/library/cpp/actors/util/unordered_cache.h
@@ -100,7 +100,7 @@ private:
}
void WriteOne(TLockedWriter& lock, T x) {
- Y_VERIFY_DEBUG(x != 0);
+ Y_DEBUG_ABORT_UNLESS(x != 0);
const ui32 pos = AtomicLoad(&lock.Slot->WritePosition);
if (pos != TChunk::EntriesCount) {