aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2024-04-24 13:16:38 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2024-04-24 13:16:38 +0000
commit5eb6eb5dddc63510f356c148eee5440892416253 (patch)
tree969e14a3845515a8b5810aef61851778cc4899ec /vespalib
parent6c514bde43038a5031a99ecce6dbad8d14faf1c3 (diff)
Add noexcept
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/datastore/datastore.h2
-rw-r--r--vespalib/src/vespa/vespalib/datastore/datastorebase.cpp18
-rw-r--r--vespalib/src/vespa/vespalib/datastore/datastorebase.h38
3 files changed, 29 insertions, 29 deletions
diff --git a/vespalib/src/vespa/vespalib/datastore/datastore.h b/vespalib/src/vespa/vespalib/datastore/datastore.h
index 0226c780cf1..b4fe9ce2ac7 100644
--- a/vespalib/src/vespa/vespalib/datastore/datastore.h
+++ b/vespalib/src/vespa/vespalib/datastore/datastore.h
@@ -49,7 +49,7 @@ public:
void reclaim_all_entry_refs() override;
- bool getCompacting(EntryRef ref) {
+ bool getCompacting(EntryRef ref) noexcept {
return getBufferState(RefType(ref).bufferId()).getCompacting();
}
diff --git a/vespalib/src/vespa/vespalib/datastore/datastorebase.cpp b/vespalib/src/vespa/vespalib/datastore/datastorebase.cpp
index c15d4784cc9..fd1d2c9a8d1 100644
--- a/vespalib/src/vespa/vespalib/datastore/datastorebase.cpp
+++ b/vespalib/src/vespa/vespalib/datastore/datastorebase.cpp
@@ -48,7 +48,7 @@ primary_buffer_too_dead(const BufferState &state)
}
DataStoreBase::FallbackHold::FallbackHold(size_t bytesSize, BufferState::Alloc &&buffer, size_t used_entries,
- BufferTypeBase *typeHandler, uint32_t typeId)
+ BufferTypeBase *typeHandler, uint32_t typeId) noexcept
: GenerationHeldBase(bytesSize),
_buffer(std::move(buffer)),
_used_entries(used_entries),
@@ -68,7 +68,7 @@ class DataStoreBase::BufferHold : public GenerationHeldBase {
uint32_t _bufferId;
public:
- BufferHold(size_t bytesSize, DataStoreBase &dsb, uint32_t bufferId)
+ BufferHold(size_t bytesSize, DataStoreBase &dsb, uint32_t bufferId) noexcept
: GenerationHeldBase(bytesSize),
_dsb(dsb),
_bufferId(bufferId)
@@ -159,7 +159,7 @@ DataStoreBase::consider_grow_active_buffer(uint32_t type_id, size_t entries_need
}
uint32_t
-DataStoreBase::getFirstFreeBufferId() {
+DataStoreBase::getFirstFreeBufferId() noexcept {
uint32_t buffer_id = 0;
for (auto & buffer : _buffers) {
BufferState * state = buffer.get_state_relaxed();
@@ -268,7 +268,7 @@ DataStoreBase::dropBuffers()
}
vespalib::MemoryUsage
-DataStoreBase::getDynamicMemoryUsage() const
+DataStoreBase::getDynamicMemoryUsage() const noexcept
{
auto stats = getMemStats();
vespalib::MemoryUsage usage;
@@ -280,7 +280,7 @@ DataStoreBase::getDynamicMemoryUsage() const
}
vespalib::MemoryUsage
-DataStoreBase::getMemoryUsage() const {
+DataStoreBase::getMemoryUsage() const noexcept {
auto usage = getDynamicMemoryUsage();
size_t extra_allocated = 0;
extra_allocated += _buffers.capacity() * sizeof(BufferAndMeta);
@@ -319,7 +319,7 @@ DataStoreBase::enableFreeLists()
}
void
-DataStoreBase::disableFreeLists()
+DataStoreBase::disableFreeLists() noexcept
{
for_each_buffer([](BufferState & state) { state.disable_free_list(); });
_freeListsEnabled = false;
@@ -335,7 +335,7 @@ DataStoreBase::disable_entry_hold_list()
}
MemoryStats
-DataStoreBase::getMemStats() const
+DataStoreBase::getMemStats() const noexcept
{
MemoryStats stats;
@@ -368,7 +368,7 @@ DataStoreBase::getMemStats() const
}
vespalib::AddressSpace
-DataStoreBase::getAddressSpaceUsage() const
+DataStoreBase::getAddressSpaceUsage() const noexcept
{
uint32_t buffer_id_limit = get_bufferid_limit_acquire();
size_t used_entries = 0;
@@ -520,7 +520,7 @@ DataStoreBase::start_compact_worst_buffers(CompactionSpec compaction_spec, const
}
void
-DataStoreBase::inc_hold_buffer_count()
+DataStoreBase::inc_hold_buffer_count() noexcept
{
assert(_hold_buffer_count < std::numeric_limits<uint32_t>::max());
++_hold_buffer_count;
diff --git a/vespalib/src/vespa/vespalib/datastore/datastorebase.h b/vespalib/src/vespa/vespalib/datastore/datastorebase.h
index bce2d2096f2..fb525f9378b 100644
--- a/vespalib/src/vespa/vespalib/datastore/datastorebase.h
+++ b/vespalib/src/vespa/vespalib/datastore/datastorebase.h
@@ -64,10 +64,10 @@ public:
*/
void switch_primary_buffer(uint32_t typeId, size_t entries_needed);
- vespalib::MemoryUsage getMemoryUsage() const;
- vespalib::MemoryUsage getDynamicMemoryUsage() const;
+ vespalib::MemoryUsage getMemoryUsage() const noexcept;
+ vespalib::MemoryUsage getDynamicMemoryUsage() const noexcept;
- vespalib::AddressSpace getAddressSpaceUsage() const;
+ vespalib::AddressSpace getAddressSpaceUsage() const noexcept;
/**
* Get the primary buffer id for the given type id.
@@ -135,7 +135,7 @@ public:
/**
* Disable free list management.
*/
- void disableFreeLists();
+ void disableFreeLists() noexcept;
void disable_entry_hold_list();
bool has_free_lists_enabled() const { return _freeListsEnabled; }
@@ -143,38 +143,38 @@ public:
/**
* Returns the free list for the given type id.
*/
- FreeList &getFreeList(uint32_t typeId) {
+ FreeList &getFreeList(uint32_t typeId) noexcept {
return _free_lists[typeId];
}
/**
* Returns aggregated memory statistics for all buffers in this data store.
*/
- MemoryStats getMemStats() const;
+ MemoryStats getMemStats() const noexcept;
/**
* Assume that no readers are present while data structure is being initialized.
*/
- void setInitializing(bool initializing) { _initializing = initializing; }
+ void setInitializing(bool initializing) noexcept { _initializing = initializing; }
- uint32_t getTypeId(uint32_t bufferId) const {
+ uint32_t getTypeId(uint32_t bufferId) const noexcept {
return _buffers[bufferId].getTypeId();
}
void finishCompact(const std::vector<uint32_t> &toHold);
- vespalib::GenerationHolder &getGenerationHolder() {
+ vespalib::GenerationHolder &getGenerationHolder() noexcept {
return _genHolder;
}
// need object location before construction
- static vespalib::GenerationHolder &getGenerationHolderLocation(DataStoreBase &self) {
+ static vespalib::GenerationHolder &getGenerationHolderLocation(DataStoreBase &self) noexcept {
return self._genHolder;
}
std::unique_ptr<CompactingBuffers> start_compact_worst_buffers(CompactionSpec compaction_spec, const CompactionStrategy &compaction_strategy);
- uint64_t get_compaction_count() const { return _compaction_count.load(std::memory_order_relaxed); }
- void inc_compaction_count() const { ++_compaction_count; }
+ uint64_t get_compaction_count() const noexcept { return _compaction_count.load(std::memory_order_relaxed); }
+ void inc_compaction_count() const noexcept { ++_compaction_count; }
bool has_held_buffers() const noexcept { return _hold_buffer_count != 0u; }
/**
@@ -184,9 +184,9 @@ public:
*/
virtual void reclaim_entry_refs(generation_t oldest_used_gen) = 0;
- uint32_t get_entry_size(uint32_t type_id) { return _typeHandlers[type_id]->entry_size(); }
+ uint32_t get_entry_size(uint32_t type_id) noexcept { return _typeHandlers[type_id]->entry_size(); }
- void* getBuffer(uint32_t bufferId) { return _buffers[bufferId].get_buffer_relaxed(); }
+ void* getBuffer(uint32_t bufferId) noexcept { return _buffers[bufferId].get_buffer_relaxed(); }
protected:
DataStoreBase(uint32_t numBuffers, uint32_t offset_bits, size_t max_entries);
@@ -196,7 +196,7 @@ protected:
EntryRef ref;
size_t num_entries;
- EntryRefHoldElem(EntryRef ref_in, size_t num_entries_in)
+ EntryRefHoldElem(EntryRef ref_in, size_t num_entries_in) noexcept
: ref(ref_in),
num_entries(num_entries_in)
{}
@@ -223,7 +223,7 @@ private:
uint32_t _typeId;
FallbackHold(size_t bytesSize, BufferState::Alloc &&buffer, size_t used_entries,
- BufferTypeBase *typeHandler, uint32_t typeId);
+ BufferTypeBase *typeHandler, uint32_t typeId) noexcept;
~FallbackHold() override;
};
@@ -247,12 +247,12 @@ private:
*/
void on_active(uint32_t bufferId, uint32_t typeId, size_t entries_needed);
- void inc_hold_buffer_count();
+ void inc_hold_buffer_count() noexcept;
void fallback_resize(uint32_t bufferId, size_t entries_needed);
- uint32_t getFirstFreeBufferId();
+ uint32_t getFirstFreeBufferId() noexcept;
template<typename FuncType>
- void for_each_buffer(FuncType func) {
+ void for_each_buffer(FuncType func) noexcept {
uint32_t buffer_id_limit = get_bufferid_limit_relaxed();
for (uint32_t i = 0; i < buffer_id_limit; i++) {
func(*(_buffers[i].get_state_relaxed()));