summaryrefslogtreecommitdiffstats
path: root/vespalib/src
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2023-07-14 10:42:31 +0200
committerGitHub <noreply@github.com>2023-07-14 10:42:31 +0200
commit0a38c6b813cd118e7aab833699a2c8547d1c8e14 (patch)
treed8e5fd52c92cb974dded54b486bb951bbd67855b /vespalib/src
parentbf480e663efe4e7390285d624a7b383de66a1a10 (diff)
Revert "- Pack data closer to let config fit in 2 cache lines instead of 4."
Diffstat (limited to 'vespalib/src')
-rw-r--r--vespalib/src/vespa/vespalib/datastore/compaction_strategy.cpp8
-rw-r--r--vespalib/src/vespa/vespalib/datastore/compaction_strategy.h53
-rw-r--r--vespalib/src/vespa/vespalib/text/lowercase.h4
-rw-r--r--vespalib/src/vespa/vespalib/text/utf8.cpp39
-rw-r--r--vespalib/src/vespa/vespalib/text/utf8.h47
-rw-r--r--vespalib/src/vespa/vespalib/util/alloc.cpp4
-rw-r--r--vespalib/src/vespa/vespalib/util/alloc.h7
-rw-r--r--vespalib/src/vespa/vespalib/util/growstrategy.h9
-rw-r--r--vespalib/src/vespa/vespalib/util/mmap_file_allocator.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/util/small_vector.h2
10 files changed, 95 insertions, 80 deletions
diff --git a/vespalib/src/vespa/vespalib/datastore/compaction_strategy.cpp b/vespalib/src/vespa/vespalib/datastore/compaction_strategy.cpp
index eea49e80135..4eb4ff16864 100644
--- a/vespalib/src/vespa/vespalib/datastore/compaction_strategy.cpp
+++ b/vespalib/src/vespa/vespalib/datastore/compaction_strategy.cpp
@@ -10,19 +10,19 @@
namespace vespalib::datastore {
bool
-CompactionStrategy::should_compact_memory(const MemoryUsage& memory_usage) const noexcept
+CompactionStrategy::should_compact_memory(const MemoryUsage& memory_usage) const
{
return should_compact_memory(memory_usage.usedBytes(), memory_usage.deadBytes());
}
bool
-CompactionStrategy::should_compact_address_space(const AddressSpace& address_space) const noexcept
+CompactionStrategy::should_compact_address_space(const AddressSpace& address_space) const
{
return should_compact_address_space(address_space.used(), address_space.dead());
}
CompactionSpec
-CompactionStrategy::should_compact(const MemoryUsage& memory_usage, const AddressSpace& address_space) const noexcept
+CompactionStrategy::should_compact(const MemoryUsage& memory_usage, const AddressSpace& address_space) const
{
return CompactionSpec(should_compact_memory(memory_usage), should_compact_address_space(address_space));
}
@@ -36,7 +36,7 @@ std::ostream& operator<<(std::ostream& os, const CompactionStrategy& compaction_
}
CompactionStrategy
-CompactionStrategy::make_compact_all_active_buffers_strategy() noexcept
+CompactionStrategy::make_compact_all_active_buffers_strategy()
{
return CompactionStrategy(0.0, 0.0, std::numeric_limits<uint32_t>::max(), 1.0);
}
diff --git a/vespalib/src/vespa/vespalib/datastore/compaction_strategy.h b/vespalib/src/vespa/vespalib/datastore/compaction_strategy.h
index c0c1857deae..f78e123e5de 100644
--- a/vespalib/src/vespa/vespalib/datastore/compaction_strategy.h
+++ b/vespalib/src/vespa/vespalib/datastore/compaction_strategy.h
@@ -25,15 +25,15 @@ public:
static constexpr size_t DEAD_BYTES_SLACK = 0x10000u;
static constexpr size_t DEAD_ADDRESS_SPACE_SLACK = 0x10000u;
private:
- float _maxDeadBytesRatio; // Max ratio of dead bytes before compaction
- float _maxDeadAddressSpaceRatio; // Max ratio of dead address space before compaction
- float _active_buffers_ratio; // Ratio of active buffers to compact for each reason (memory usage, address space usage)
+ double _maxDeadBytesRatio; // Max ratio of dead bytes before compaction
+ double _maxDeadAddressSpaceRatio; // Max ratio of dead address space before compaction
uint32_t _max_buffers; // Max number of buffers to compact for each reason (memory usage, address space usage)
- bool should_compact_memory(size_t used_bytes, size_t dead_bytes) const noexcept {
+ double _active_buffers_ratio; // Ratio of active buffers to compact for each reason (memory usage, address space usage)
+ bool should_compact_memory(size_t used_bytes, size_t dead_bytes) const {
return ((dead_bytes >= DEAD_BYTES_SLACK) &&
(dead_bytes > used_bytes * getMaxDeadBytesRatio()));
}
- bool should_compact_address_space(size_t used_address_space, size_t dead_address_space) const noexcept {
+ bool should_compact_address_space(size_t used_address_space, size_t dead_address_space) const {
return ((dead_address_space >= DEAD_ADDRESS_SPACE_SLACK) &&
(dead_address_space > used_address_space * getMaxDeadAddressSpaceRatio()));
}
@@ -41,37 +41,40 @@ public:
CompactionStrategy() noexcept
: _maxDeadBytesRatio(0.05),
_maxDeadAddressSpaceRatio(0.2),
- _active_buffers_ratio(0.1),
- _max_buffers(1)
- { }
- CompactionStrategy(float maxDeadBytesRatio, float maxDeadAddressSpaceRatio) noexcept
+ _max_buffers(1),
+ _active_buffers_ratio(0.1)
+ {
+ }
+ CompactionStrategy(double maxDeadBytesRatio, double maxDeadAddressSpaceRatio) noexcept
: _maxDeadBytesRatio(maxDeadBytesRatio),
_maxDeadAddressSpaceRatio(maxDeadAddressSpaceRatio),
- _active_buffers_ratio(0.1),
- _max_buffers(1)
- { }
- CompactionStrategy(float maxDeadBytesRatio, float maxDeadAddressSpaceRatio, uint32_t max_buffers, float active_buffers_ratio) noexcept
+ _max_buffers(1),
+ _active_buffers_ratio(0.1)
+ {
+ }
+ CompactionStrategy(double maxDeadBytesRatio, double maxDeadAddressSpaceRatio, uint32_t max_buffers, double active_buffers_ratio) noexcept
: _maxDeadBytesRatio(maxDeadBytesRatio),
_maxDeadAddressSpaceRatio(maxDeadAddressSpaceRatio),
- _active_buffers_ratio(active_buffers_ratio),
- _max_buffers(max_buffers)
- { }
- float getMaxDeadBytesRatio() const noexcept { return _maxDeadBytesRatio; }
- float getMaxDeadAddressSpaceRatio() const noexcept { return _maxDeadAddressSpaceRatio; }
+ _max_buffers(max_buffers),
+ _active_buffers_ratio(active_buffers_ratio)
+ {
+ }
+ double getMaxDeadBytesRatio() const { return _maxDeadBytesRatio; }
+ double getMaxDeadAddressSpaceRatio() const { return _maxDeadAddressSpaceRatio; }
uint32_t get_max_buffers() const noexcept { return _max_buffers; }
- float get_active_buffers_ratio() const noexcept { return _active_buffers_ratio; }
- bool operator==(const CompactionStrategy & rhs) const noexcept {
+ double get_active_buffers_ratio() const noexcept { return _active_buffers_ratio; }
+ bool operator==(const CompactionStrategy & rhs) const {
return (_maxDeadBytesRatio == rhs._maxDeadBytesRatio) &&
(_maxDeadAddressSpaceRatio == rhs._maxDeadAddressSpaceRatio) &&
(_max_buffers == rhs._max_buffers) &&
(_active_buffers_ratio == rhs._active_buffers_ratio);
}
- bool operator!=(const CompactionStrategy & rhs) const noexcept { return !(operator==(rhs)); }
+ bool operator!=(const CompactionStrategy & rhs) const { return !(operator==(rhs)); }
- bool should_compact_memory(const MemoryUsage& memory_usage) const noexcept;
- bool should_compact_address_space(const AddressSpace& address_space) const noexcept;
- CompactionSpec should_compact(const MemoryUsage& memory_usage, const AddressSpace& address_space) const noexcept;
- static CompactionStrategy make_compact_all_active_buffers_strategy() noexcept;
+ bool should_compact_memory(const MemoryUsage& memory_usage) const;
+ bool should_compact_address_space(const AddressSpace& address_space) const;
+ CompactionSpec should_compact(const MemoryUsage& memory_usage, const AddressSpace& address_space) const;
+ static CompactionStrategy make_compact_all_active_buffers_strategy();
};
std::ostream& operator<<(std::ostream& os, const CompactionStrategy& compaction_strategy);
diff --git a/vespalib/src/vespa/vespalib/text/lowercase.h b/vespalib/src/vespa/vespalib/text/lowercase.h
index 5c4e3e34e07..dc081c6ba2d 100644
--- a/vespalib/src/vespa/vespalib/text/lowercase.h
+++ b/vespalib/src/vespa/vespalib/text/lowercase.h
@@ -43,9 +43,9 @@ public:
* @param codepoint the character codepoint to be lowercased.
* @return lowercase UCS-4 character (codepoint if no lowercasing is performed).
**/
- static uint32_t convert(uint32_t codepoint) noexcept
+ static uint32_t convert(uint32_t codepoint)
{
- if (codepoint < 0x100) [[likely]] {
+ if (codepoint < 0x100) {
return lowercase_0_block[codepoint];
} else if (codepoint < 0x600) {
return lowercase_0_5_blocks[codepoint];
diff --git a/vespalib/src/vespa/vespalib/text/utf8.cpp b/vespalib/src/vespa/vespalib/text/utf8.cpp
index c950f62985f..cae2bbae682 100644
--- a/vespalib/src/vespa/vespalib/text/utf8.cpp
+++ b/vespalib/src/vespa/vespalib/text/utf8.cpp
@@ -16,16 +16,18 @@ void Utf8::throwX(const char *msg, unsigned int number)
throw IllegalArgumentException(what);
}
-uint32_t Utf8Reader::getComplexChar(unsigned char firstbyte, uint32_t fallback) noexcept
+uint32_t Utf8Reader::getComplexChar(unsigned char firstbyte, uint32_t fallback)
{
if (_pos == size()) {
// this shouldn't happen ...
- LOG(warning, "last byte %02X of Utf8Reader block was incomplete UTF-8", firstbyte);
+ LOG(warning, "last byte %02X of Utf8Reader block was incomplete UTF-8",
+ firstbyte);
return fallback;
}
assert(hasMore()); // should never fall out of range
if (! Utf8::validFirstByte(firstbyte)) {
- LOG(debug, "invalid first byte %02X in Utf8Reader data block", firstbyte);
+ LOG(debug, "invalid first byte %02X in Utf8Reader data block",
+ firstbyte);
return fallback;
}
int need = Utf8::numContBytes(firstbyte);
@@ -46,7 +48,8 @@ uint32_t Utf8Reader::getComplexChar(unsigned char firstbyte, uint32_t fallback)
// check > 0x7F ?
return r;
} else {
- LOG(debug, "invalid continuation byte %02X in Utf8Reader data block", contbyte);
+ LOG(debug, "invalid continuation byte %02X in Utf8Reader data block",
+ contbyte);
return fallback;
}
}
@@ -66,7 +69,8 @@ uint32_t Utf8Reader::getComplexChar(unsigned char firstbyte, uint32_t fallback)
// check > 0x7FF ?
return r;
} else {
- LOG(debug, "invalid continuation bytes %02X/%02X in Utf8Reader data block", contbyte1, contbyte2);
+ LOG(debug, "invalid continuation bytes %02X/%02X in Utf8Reader data block",
+ contbyte1, contbyte2);
return fallback;
}
}
@@ -91,10 +95,11 @@ uint32_t Utf8Reader::getComplexChar(unsigned char firstbyte, uint32_t fallback)
uint32_t
-Utf8ReaderForZTS::getComplexChar(unsigned char firstbyte, uint32_t fallback) noexcept
+Utf8ReaderForZTS::getComplexChar(unsigned char firstbyte, uint32_t fallback)
{
if (! Utf8::validFirstByte(firstbyte)) {
- LOG(debug, "invalid first byte %02X in Utf8Reader data block", firstbyte);
+ LOG(debug, "invalid first byte %02X in Utf8Reader data block",
+ firstbyte);
return fallback;
}
int need = Utf8::numContBytes(firstbyte);
@@ -103,7 +108,8 @@ Utf8ReaderForZTS::getComplexChar(unsigned char firstbyte, uint32_t fallback) noe
if (need == 1) {
if (_p[0] == 0) {
- LOG(debug, "incomplete character (first byte %02X) in Utf8ReaderZTS", firstbyte);
+ LOG(debug, "incomplete character (first byte %02X) in Utf8ReaderZTS",
+ firstbyte);
return fallback;
}
unsigned char contbyte = _p[0];
@@ -113,14 +119,16 @@ Utf8ReaderForZTS::getComplexChar(unsigned char firstbyte, uint32_t fallback) noe
// check > 0x7F ?
return r;
} else {
- LOG(debug, "invalid continuation byte %02X in Utf8Reader data block", contbyte);
+ LOG(debug, "invalid continuation byte %02X in Utf8Reader data block",
+ contbyte);
return fallback;
}
}
if (need == 2) {
if (_p[0] == 0 || _p[1] == 0) {
- LOG(debug, "incomplete character (first byte %02X) in Utf8ReaderZTS", firstbyte);
+ LOG(debug, "incomplete character (first byte %02X) in Utf8ReaderZTS",
+ firstbyte);
return fallback;
}
unsigned char contbyte1 = _p[0];
@@ -137,14 +145,16 @@ Utf8ReaderForZTS::getComplexChar(unsigned char firstbyte, uint32_t fallback) noe
// check > 0x7FF ?
return r;
} else {
- LOG(debug, "invalid continuation bytes %02X/%02X in Utf8Reader data block", contbyte1, contbyte2);
+ LOG(debug, "invalid continuation bytes %02X/%02X in Utf8Reader data block",
+ contbyte1, contbyte2);
return fallback;
}
}
assert(need == 3);
if (_p[0] == 0 || _p[1] == 0 || _p[2] == 0) {
- LOG(debug, "incomplete character (first byte %02X) in Utf8ReaderZTS", firstbyte);
+ LOG(debug, "incomplete character (first byte %02X) in Utf8ReaderZTS",
+ firstbyte);
return fallback;
}
unsigned char contbyte1 = _p[0];
@@ -158,7 +168,8 @@ Utf8ReaderForZTS::getComplexChar(unsigned char firstbyte, uint32_t fallback) noe
// check > 0xFFFF?
return decode4(firstbyte, contbyte1, contbyte2, contbyte3);
} else {
- LOG(debug, "invalid continuation bytes %02X/%02X/%02X in Utf8Reader data block", contbyte1, contbyte2, contbyte3);
+ LOG(debug, "invalid continuation bytes %02X/%02X/%02X in Utf8Reader data block",
+ contbyte1, contbyte2, contbyte3);
return fallback;
}
}
@@ -223,7 +234,7 @@ template class Utf8Writer<vespalib::string>;
template class Utf8Writer<std::string>;
template <typename T>
-T Utf8::filter_invalid_sequences(const T& input) noexcept
+T Utf8::filter_invalid_sequences(const T& input)
{
T retval;
Utf8Reader reader(input.c_str(), input.size());
diff --git a/vespalib/src/vespa/vespalib/text/utf8.h b/vespalib/src/vespa/vespalib/text/utf8.h
index 3367bd5b3d2..98e06ca5faf 100644
--- a/vespalib/src/vespa/vespalib/text/utf8.h
+++ b/vespalib/src/vespa/vespalib/text/utf8.h
@@ -34,14 +34,14 @@ public:
* UTF-8 encoded surrogates are also considered invalid.
**/
template <typename T>
- static T filter_invalid_sequences(const T& input) noexcept;
+ static T filter_invalid_sequences(const T& input);
/**
* check if a byte is valid as the first byte of an UTF-8 character.
* @param c the byte to be checked
* @return true if a valid UTF-8 character can start with this byte
**/
- static bool validFirstByte(unsigned char c) noexcept {
+ static bool validFirstByte(unsigned char c) {
return (c < 0x80 ||
(c > 0xC1 && c < 0xF5));
}
@@ -52,12 +52,12 @@ public:
* @param c the first byte (must pass validFirstByte check)
* @return 0, 1, 2, or 3
**/
- static int numContBytes(unsigned char c) noexcept {
+ static int numContBytes(unsigned char c) {
if (c < 0x80) return 0;
if (c > 0xC1 && c < 0xE0) return 1;
if (c > 0xDF && c < 0xF0) return 2;
if (c > 0xEF && c < 0xF5) return 3;
- return -1;
+ throwX("invalid first byte of UTF8 sequence", c);
}
/**
@@ -65,7 +65,7 @@ public:
* @param c the byte to be checked
* @return true if a valid UTF-8 character can contain this byte
**/
- static bool validContByte(unsigned char c) noexcept {
+ static bool validContByte(unsigned char c) {
return (c > 0x7F && c < 0xC0);
}
@@ -82,7 +82,8 @@ public:
* @param contbyte second byte in this UTF-8 character
* @return decoded UCS-4 codepoint in range [0, 0x7FF]
**/
- static uint32_t decode2(unsigned char firstbyte, unsigned char contbyte) noexcept
+ static uint32_t decode2(unsigned char firstbyte,
+ unsigned char contbyte)
{
uint32_t r = (firstbyte & low_5bits_mask);
r <<= 6;
@@ -107,7 +108,7 @@ public:
**/
static uint32_t decode3(unsigned char firstbyte,
unsigned char contbyte1,
- unsigned char contbyte2) noexcept
+ unsigned char contbyte2)
{
uint32_t r = (firstbyte & low_4bits_mask);
r <<= 6;
@@ -137,7 +138,7 @@ public:
static uint32_t decode4(unsigned char firstbyte,
unsigned char contbyte1,
unsigned char contbyte2,
- unsigned char contbyte3) noexcept
+ unsigned char contbyte3)
{
uint32_t r = (firstbyte & low_3bits_mask);
r <<= 6;
@@ -176,14 +177,14 @@ class Utf8Reader
private:
size_type _pos;
- uint32_t getComplexChar(unsigned char firstbyte, uint32_t fallback) noexcept;
+ uint32_t getComplexChar(unsigned char firstbyte, uint32_t fallback);
public:
/**
* Construct a reader for the given block of data
* @param input data to read UTF-8 from (can be read-only)
**/
- Utf8Reader(stringref input) noexcept
+ Utf8Reader(stringref input)
: stringref(input), _pos(0)
{}
@@ -192,7 +193,7 @@ public:
* @param start pointer to the start of the block
* @param sz size of the block in bytes
**/
- Utf8Reader(const char *start, size_t sz) noexcept
+ Utf8Reader(const char *start, size_t sz)
: stringref(start, sz), _pos(0)
{}
@@ -200,7 +201,7 @@ public:
* check if the buffer has more data.
* @return true if there is more data
**/
- bool hasMore() const noexcept { return _pos < size(); }
+ bool hasMore() const { return _pos < size(); }
/**
* Decode the UTF-8 character at the current position.
@@ -210,7 +211,7 @@ public:
* @param fallback the value to return if invalid UTF-8 is found
* @return a valid UCS-4 codepoint (or the fallback value)
**/
- uint32_t getChar(uint32_t fallback) noexcept {
+ uint32_t getChar(uint32_t fallback) {
unsigned char firstbyte = (*this)[_pos++]; // always steps at least 1 position
if (firstbyte < 0x80) {
return firstbyte;
@@ -231,13 +232,13 @@ public:
*
* @return a valid UCS-4 codepoint
**/
- uint32_t getChar() noexcept { return getChar(Utf8::REPLACEMENT_CHAR); }
+ uint32_t getChar() { return getChar(Utf8::REPLACEMENT_CHAR); }
/**
* obtain the current byte offset position
* @return position in bytes
**/
- size_type getPos() const noexcept { return _pos; }
+ size_type getPos() const { return _pos; }
};
@@ -251,7 +252,7 @@ class Utf8ReaderForZTS
{
private:
const char * &_p;
- uint32_t getComplexChar(unsigned char firstbyte, uint32_t fallback) noexcept;
+ uint32_t getComplexChar(unsigned char firstbyte, uint32_t fallback);
public:
/**
@@ -264,7 +265,7 @@ public:
*
* @param start pointer to the start of the block
**/
- Utf8ReaderForZTS(const char * &start) noexcept
+ Utf8ReaderForZTS(const char * &start)
: _p(start)
{}
@@ -272,7 +273,7 @@ public:
* check if the buffer has more data.
* @return true if there is more data
**/
- bool hasMore() const noexcept {
+ bool hasMore() const {
return (*_p) != '\0';
}
@@ -284,9 +285,9 @@ public:
* @param fallback the value to return if invalid UTF-8 is found
* @return a valid UCS-4 codepoint (or the fallback value)
**/
- uint32_t getChar(uint32_t fallback) noexcept {
+ uint32_t getChar(uint32_t fallback) {
unsigned char firstbyte = *_p++; // always steps at least 1 position
- if (firstbyte < 0x80) [[likely]] {
+ if (firstbyte < 0x80) {
return firstbyte;
} else {
return getComplexChar(firstbyte, fallback);
@@ -305,7 +306,7 @@ public:
*
* @return a valid UCS-4 codepoint
**/
- uint32_t getChar() noexcept{ return getChar(Utf8::REPLACEMENT_CHAR); }
+ uint32_t getChar() { return getChar(Utf8::REPLACEMENT_CHAR); }
/**
* count the number of UCS-4 characters will be returned when
@@ -313,7 +314,7 @@ public:
* "strlen" does not count the zero termination, but bytes
* that aren't valid UTF-8 will count as one character each.
**/
- static size_t countChars(const char *p) noexcept {
+ static size_t countChars(const char *p) {
Utf8ReaderForZTS reader(p);
size_t i;
for (i = 0; reader.hasMore(); ++i) {
@@ -339,7 +340,7 @@ public:
* that the writer will append to. Must be writable
* and must be kept alive while the writer is active.
**/
- Utf8Writer(Target &target) noexcept : _target(target) {}
+ Utf8Writer(Target &target) : _target(target) {}
/**
* append the given character to the target string.
diff --git a/vespalib/src/vespa/vespalib/util/alloc.cpp b/vespalib/src/vespa/vespalib/util/alloc.cpp
index 2ba3bc252ae..204d80340aa 100644
--- a/vespalib/src/vespa/vespalib/util/alloc.cpp
+++ b/vespalib/src/vespa/vespalib/util/alloc.cpp
@@ -292,7 +292,7 @@ HeapAllocator::alloc(size_t sz) const {
PtrAndSize
HeapAllocator::salloc(size_t sz) {
if (sz == 0) {
- return PtrAndSize();
+ return PtrAndSize(nullptr, sz);
}
void * ptr = malloc(sz);
if (ptr == nullptr) {
@@ -311,7 +311,7 @@ void HeapAllocator::sfree(PtrAndSize alloc) noexcept {
PtrAndSize
AlignedHeapAllocator::alloc(size_t sz) const {
- if (!sz) { return PtrAndSize(); }
+ if (!sz) { return PtrAndSize(nullptr, 0); }
void* ptr;
int result = posix_memalign(&ptr, _alignment, sz);
if (result != 0) {
diff --git a/vespalib/src/vespa/vespalib/util/alloc.h b/vespalib/src/vespa/vespalib/util/alloc.h
index dca4d633b43..a27bcca0b47 100644
--- a/vespalib/src/vespa/vespalib/util/alloc.h
+++ b/vespalib/src/vespa/vespalib/util/alloc.h
@@ -49,7 +49,7 @@ public:
}
return *this;
}
- Alloc() noexcept : _alloc(), _allocator(nullptr) { }
+ Alloc() noexcept : _alloc(nullptr, 0), _allocator(nullptr) { }
~Alloc() noexcept {
reset();
}
@@ -83,9 +83,10 @@ private:
Alloc(const MemoryAllocator * allocator, size_t sz) noexcept
: _alloc(allocator->alloc(sz)),
_allocator(allocator)
- { }
+ {
+ }
Alloc(const MemoryAllocator * allocator) noexcept
- : _alloc(),
+ : _alloc(nullptr, 0),
_allocator(allocator)
{ }
void clear() noexcept {
diff --git a/vespalib/src/vespa/vespalib/util/growstrategy.h b/vespalib/src/vespa/vespalib/util/growstrategy.h
index 643e3f03023..02e18e44925 100644
--- a/vespalib/src/vespa/vespalib/util/growstrategy.h
+++ b/vespalib/src/vespa/vespalib/util/growstrategy.h
@@ -4,15 +4,14 @@
#include <algorithm>
#include <cstddef>
-#include <cstdint>
namespace vespalib {
class GrowStrategy {
private:
- uint32_t _initialCapacity;
- uint32_t _minimumCapacity;
- uint32_t _growDelta;
+ size_t _initialCapacity;
+ size_t _minimumCapacity;
+ size_t _growDelta;
float _growFactor;
public:
GrowStrategy() noexcept
@@ -34,7 +33,7 @@ public:
void setInitialCapacity(size_t v) noexcept { _initialCapacity = v; }
void setGrowDelta(size_t v) noexcept { _growDelta = v; }
- size_t calc_new_size(size_t base_size) const noexcept {
+ size_t calc_new_size(size_t base_size) const {
size_t delta = (base_size * getGrowFactor()) + getGrowDelta();
size_t new_size = base_size + std::max(delta, static_cast<size_t>(1));
return std::max(new_size, getMinimumCapacity());
diff --git a/vespalib/src/vespa/vespalib/util/mmap_file_allocator.cpp b/vespalib/src/vespa/vespalib/util/mmap_file_allocator.cpp
index 2c0d0f4339d..9ed4806385d 100644
--- a/vespalib/src/vespa/vespalib/util/mmap_file_allocator.cpp
+++ b/vespalib/src/vespa/vespalib/util/mmap_file_allocator.cpp
@@ -46,7 +46,7 @@ PtrAndSize
MmapFileAllocator::alloc(size_t sz) const
{
if (sz == 0) {
- return PtrAndSize(); // empty allocation
+ return PtrAndSize(nullptr, 0); // empty allocation
}
sz = round_up_to_page_size(sz);
uint64_t offset = alloc_area(sz);
diff --git a/vespalib/src/vespa/vespalib/util/small_vector.h b/vespalib/src/vespa/vespalib/util/small_vector.h
index ba166362d33..b47cb5903b9 100644
--- a/vespalib/src/vespa/vespalib/util/small_vector.h
+++ b/vespalib/src/vespa/vespalib/util/small_vector.h
@@ -216,7 +216,7 @@ public:
template <typename T, size_t N, size_t M>
bool operator==(const SmallVector<T,N> &a,
- const SmallVector<T,M> &b) noexcept
+ const SmallVector<T,M> &b)
{
if (a.size() != b.size()) {
return false;