diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-10-02 19:59:41 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-10-03 16:52:36 +0000 |
commit | 6a0ea2d5fce1967927cf1f4f319fb0209ac2eb1e (patch) | |
tree | cdf844359ac298e85d5ffc4e15f467964a8c7593 /searchlib | |
parent | 74d9d289d9b9ffd5f9f427a1fb7abf176bae4abe (diff) |
Checkpoint 1
Diffstat (limited to 'searchlib')
45 files changed, 145 insertions, 294 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/changevector.h b/searchlib/src/vespa/searchlib/attribute/changevector.h index a714e502588..90a8ff7e2d4 100644 --- a/searchlib/src/vespa/searchlib/attribute/changevector.h +++ b/searchlib/src/vespa/searchlib/attribute/changevector.h @@ -140,7 +140,7 @@ template <typename T> class ChangeVectorT : public ChangeVectorBase { private: typedef vespalib::hash_map<uint32_t, uint32_t> Map; - typedef vespalib::Array<T, vespalib::DefaultAlloc> Vector; + typedef vespalib::Array<T> Vector; public: ChangeVectorT() : _tail(0) { } class const_iterator { diff --git a/searchlib/src/vespa/searchlib/attribute/enumstore.h b/searchlib/src/vespa/searchlib/attribute/enumstore.h index 0f0675248a7..18bb676644e 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumstore.h +++ b/searchlib/src/vespa/searchlib/attribute/enumstore.h @@ -154,7 +154,7 @@ public: uint32_t _refCount; }; - typedef vespalib::Array<UniqueEntry, vespalib::DefaultAlloc> Uniques; + typedef vespalib::Array<UniqueEntry> Uniques; private: Uniques _uniques; uint64_t _bufferSize; diff --git a/searchlib/src/vespa/searchlib/attribute/enumstorebase.h b/searchlib/src/vespa/searchlib/attribute/enumstorebase.h index 3b8b9823d87..4c2d35d645f 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumstorebase.h +++ b/searchlib/src/vespa/searchlib/attribute/enumstorebase.h @@ -34,8 +34,8 @@ class EnumStoreComparatorWrapper; typedef btree::DataStoreT<btree::AlignedEntryRefT<31, 4> > EnumStoreDataStoreType; typedef EnumStoreDataStoreType::RefType EnumStoreIndex; -typedef vespalib::Array<EnumStoreIndex, vespalib::DefaultAlloc> EnumStoreIndexVector; -typedef vespalib::Array<uint32_t, vespalib::DefaultAlloc> EnumStoreEnumVector; +typedef vespalib::Array<EnumStoreIndex> EnumStoreIndexVector; +typedef vespalib::Array<uint32_t> EnumStoreEnumVector; typedef btree::BTreeTraits<32, 32, 7, true> EnumTreeTraits; diff --git a/searchlib/src/vespa/searchlib/attribute/iattributefilewriter.h b/searchlib/src/vespa/searchlib/attribute/iattributefilewriter.h index ec0fbf8e6a4..d2d5cb86cf5 100644 --- a/searchlib/src/vespa/searchlib/attribute/iattributefilewriter.h +++ b/searchlib/src/vespa/searchlib/attribute/iattributefilewriter.h @@ -16,7 +16,7 @@ class BufferWriter; class IAttributeFileWriter { public: - using BufferBuf = vespalib::MMapDataBuffer; + using BufferBuf = vespalib::DataBuffer; using Buffer = std::unique_ptr<BufferBuf>; virtual ~IAttributeFileWriter() = default; diff --git a/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.h b/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.h index 47b7eab1b83..749247b0e78 100644 --- a/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.h +++ b/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.h @@ -94,7 +94,7 @@ public: } }; -typedef vespalib::Array<LoadedEnumAttribute, vespalib::DefaultAlloc> LoadedEnumAttributeVector; +typedef vespalib::Array<LoadedEnumAttribute> LoadedEnumAttributeVector; /** diff --git a/searchlib/src/vespa/searchlib/attribute/loadednumericvalue.h b/searchlib/src/vespa/searchlib/attribute/loadednumericvalue.h index a8855ba5f15..23b6f02d2fa 100644 --- a/searchlib/src/vespa/searchlib/attribute/loadednumericvalue.h +++ b/searchlib/src/vespa/searchlib/attribute/loadednumericvalue.h @@ -6,12 +6,9 @@ #include <vespa/searchlib/util/fileutil.h> #include "loadedvalue.h" +namespace search { -namespace search -{ - -namespace attribute -{ +namespace attribute { /** * Temporary representation of enumerated attribute loaded from non-enumerated @@ -21,20 +18,12 @@ namespace attribute template <typename T> struct LoadedNumericValue : public LoadedValue<T> { - LoadedNumericValue() - : LoadedValue<T>() - { - } + LoadedNumericValue() : LoadedValue<T>() { } - class ValueCompare : public std::binary_function<LoadedNumericValue<T>, - LoadedNumericValue<T>, - bool> + class ValueCompare : public std::binary_function<LoadedNumericValue<T>, LoadedNumericValue<T>, bool> { public: - bool - operator()(const LoadedNumericValue<T> &x, - const LoadedNumericValue<T> &y) const - { + bool operator()(const LoadedNumericValue<T> &x, const LoadedNumericValue<T> &y) const { return x < y; } }; @@ -42,9 +31,7 @@ struct LoadedNumericValue : public LoadedValue<T> class ValueRadix { public: - uint64_t - operator()(const LoadedValue<T> &v) const - { + uint64_t operator()(const LoadedValue<T> &v) const { return vespalib::convertForSort<T, true>::convert(v.getValue()); } }; @@ -53,15 +40,11 @@ struct LoadedNumericValue : public LoadedValue<T> template <typename T> void -sortLoadedByValue(SequentialReadModifyWriteVector<LoadedNumericValue<T>, - vespalib::DefaultAlloc> & - loaded); +sortLoadedByValue(SequentialReadModifyWriteVector<LoadedNumericValue<T>> & loaded); template <typename T> void -sortLoadedByDocId(SequentialReadModifyWriteVector<LoadedNumericValue<T>, - vespalib::DefaultAlloc> & - loaded); +sortLoadedByDocId(SequentialReadModifyWriteVector<LoadedNumericValue<T>> & loaded); } // namespace attribute diff --git a/searchlib/src/vespa/searchlib/attribute/loadedstringvalue.cpp b/searchlib/src/vespa/searchlib/attribute/loadedstringvalue.cpp index 335abb799b0..478b7a5e7a9 100644 --- a/searchlib/src/vespa/searchlib/attribute/loadedstringvalue.cpp +++ b/searchlib/src/vespa/searchlib/attribute/loadedstringvalue.cpp @@ -3,18 +3,17 @@ #include <vespa/fastos/fastos.h> #include "loadedstringvalue.h" +using vespalib::Array; +using vespalib::alloc::MMapAllocFactory; -namespace search -{ +namespace search { -namespace attribute -{ +namespace attribute { void sortLoadedByValue(LoadedStringVectorReal &loaded) { - vespalib::Array<unsigned, vespalib::MMapAlloc> - radixScratchPad(loaded.size()); + Array<unsigned> radixScratchPad(loaded.size(), MMapAllocFactory::create()); for(size_t i(0), m(loaded.size()); i < m; i++) { loaded[i].prepareRadixSort(); } diff --git a/searchlib/src/vespa/searchlib/attribute/loadedstringvalue.h b/searchlib/src/vespa/searchlib/attribute/loadedstringvalue.h index 87e2574bdb6..15a29096e20 100644 --- a/searchlib/src/vespa/searchlib/attribute/loadedstringvalue.h +++ b/searchlib/src/vespa/searchlib/attribute/loadedstringvalue.h @@ -78,7 +78,7 @@ typedef RadixSortable<LoadedValue<const char *> > LoadedStringValue; typedef SequentialReadModifyWriteInterface<LoadedStringValue> LoadedStringVector; -typedef SequentialReadModifyWriteVector<LoadedStringValue, vespalib::DefaultAlloc> +typedef SequentialReadModifyWriteVector<LoadedStringValue> LoadedStringVectorReal; diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h b/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h index 8ef3d28549b..fae23b72dba 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h @@ -29,7 +29,7 @@ protected: typedef typename B::BaseClass::largeint_t largeint_t; typedef typename B::BaseClass::LoadedNumericValueT LoadedNumericValueT; typedef typename B::BaseClass::LoadedVector LoadedVector; - typedef SequentialReadModifyWriteVector<LoadedNumericValueT, vespalib::DefaultAlloc> LoadedVectorR; + typedef SequentialReadModifyWriteVector<LoadedNumericValueT> LoadedVectorR; typedef typename B::BaseClass::Weighted Weighted; typedef typename B::BaseClass::WeightedInt WeightedInt; typedef typename B::BaseClass::WeightedFloat WeightedFloat; diff --git a/searchlib/src/vespa/searchlib/attribute/multivaluemapping.h b/searchlib/src/vespa/searchlib/attribute/multivaluemapping.h index 3134f826774..c73ec38bcfe 100644 --- a/searchlib/src/vespa/searchlib/attribute/multivaluemapping.h +++ b/searchlib/src/vespa/searchlib/attribute/multivaluemapping.h @@ -236,7 +236,7 @@ private: virtual void clearVector(Index idx) = 0; public: - using IndexCopyVector = vespalib::Array<Index, vespalib::DefaultAlloc>; + using IndexCopyVector = vespalib::Array<Index>; void doneHoldVector(Index idx); @@ -330,11 +330,11 @@ public: template <typename VT> -class MultiValueMappingVector : public vespalib::Array<VT, vespalib::DefaultAlloc>, +class MultiValueMappingVector : public vespalib::Array<VT>, public MultiValueMappingVectorBaseBase { public: - typedef vespalib::Array<VT, vespalib::DefaultAlloc> VectorBase; + typedef vespalib::Array<VT> VectorBase; typedef MultiValueMappingFallbackVectorHold<VectorBase> FallBackHold; MultiValueMappingVector(); MultiValueMappingVector(uint32_t n); diff --git a/searchlib/src/vespa/searchlib/attribute/postingchange.h b/searchlib/src/vespa/searchlib/attribute/postingchange.h index b4abe0c7dd2..d728fa89fb0 100644 --- a/searchlib/src/vespa/searchlib/attribute/postingchange.h +++ b/searchlib/src/vespa/searchlib/attribute/postingchange.h @@ -18,7 +18,7 @@ template <typename P> class PostingChange { public: - typedef vespalib::Array<P, vespalib::DefaultAlloc> A; + typedef vespalib::Array<P> A; typedef std::vector<uint32_t> R; A _additions; R _removals; diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp index 2d79e80142a..847071cf4f4 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp @@ -237,8 +237,7 @@ handleFillPostings(LoadedVector &loaded) uint32_t docIdLimit = _attr.getNumDocs(); _postingList.resizeBitVectors(docIdLimit, docIdLimit); if ( ! loaded.empty() ) { - vespalib::Array<typename LoadedVector::Type, - vespalib::DefaultAlloc> similarValues; + vespalib::Array<typename LoadedVector::Type> similarValues; typename LoadedVector::Type v = loaded.read(); LoadedValueType prev = v.getValue(); for(size_t i(0), m(loaded.size()); i < m; i++, loaded.next()) { diff --git a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp index a0693755666..620188d9630 100644 --- a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp @@ -13,7 +13,7 @@ LOG_SETUP(".predicate_attribute"); using document::Predicate; using document::PredicateFieldValue; -using vespalib::MMapDataBuffer; +using vespalib::DataBuffer; using namespace search::predicate; namespace search { @@ -181,7 +181,7 @@ bool PredicateAttribute::onLoad() FileUtil::LoadedBuffer::UP loaded_buffer = loadDAT(); char *rawBuffer = const_cast<char *>(static_cast<const char *>(loaded_buffer->buffer())); size_t size = loaded_buffer->size(); - MMapDataBuffer buffer(rawBuffer, size); + DataBuffer buffer(rawBuffer, size); buffer.moveFreeToData(size); const GenericHeader &header = loaded_buffer->getHeader(); diff --git a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h index ad0cc2a98a3..4768928603b 100644 --- a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h @@ -24,8 +24,7 @@ protected: typedef vespalib::GenerationHolder GenerationHolder; public: - using EnumIndexCopyVector = vespalib::Array<EnumIndex, - vespalib::DefaultAlloc>; + using EnumIndexCopyVector = vespalib::Array<EnumIndex>; EnumStoreBase::Index getEnumIndex(DocId docId) const { return _enumIndices[docId]; } EnumHandle getE(DocId doc) const { return _enumIndices[doc].ref(); } diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h index 3793431f75b..125bf5587f3 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h @@ -30,7 +30,7 @@ protected: typedef typename B::BaseClass::generation_t generation_t; typedef typename B::BaseClass::LoadedNumericValueT LoadedNumericValueT; typedef typename B::BaseClass::LoadedVector LoadedVector; - typedef SequentialReadModifyWriteVector<LoadedNumericValueT, vespalib::DefaultAlloc> LoadedVectorR; + typedef SequentialReadModifyWriteVector<LoadedNumericValueT> LoadedVectorR; typedef typename SingleValueEnumAttribute<B>::EnumStore EnumStore; typedef typename SingleValueEnumAttributeBase::EnumIndex EnumIndex; diff --git a/searchlib/src/vespa/searchlib/attribute/stringbase.h b/searchlib/src/vespa/searchlib/attribute/stringbase.h index a70cc6ecfab..fde8e3847fc 100644 --- a/searchlib/src/vespa/searchlib/attribute/stringbase.h +++ b/searchlib/src/vespa/searchlib/attribute/stringbase.h @@ -19,7 +19,7 @@ class StringEntryType; class StringAttribute : public AttributeVector { public: - typedef vespalib::Array<uint32_t, vespalib::DefaultAlloc> OffsetVector; + typedef vespalib::Array<uint32_t> OffsetVector; typedef const char * LoadedValueType; typedef EnumStoreBase::Index EnumIndex; typedef EnumStoreBase::IndexVector EnumIndexVector; diff --git a/searchlib/src/vespa/searchlib/attribute/tensorattribute.h b/searchlib/src/vespa/searchlib/attribute/tensorattribute.h index 3c22d99882d..ec7f41bca18 100644 --- a/searchlib/src/vespa/searchlib/attribute/tensorattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/tensorattribute.h @@ -29,7 +29,7 @@ private: void compactWorst(); public: - using RefCopyVector = vespalib::Array<RefType, vespalib::DefaultAlloc>; + using RefCopyVector = vespalib::Array<RefType>; using Tensor = vespalib::tensor::Tensor; TensorAttribute(const vespalib::stringref &baseFileName, const Config &cfg); ~TensorAttribute(); diff --git a/searchlib/src/vespa/searchlib/btree/btreenodeallocator.h b/searchlib/src/vespa/searchlib/btree/btreenodeallocator.h index 53e949bacbe..3029c287027 100644 --- a/searchlib/src/vespa/searchlib/btree/btreenodeallocator.h +++ b/searchlib/src/vespa/searchlib/btree/btreenodeallocator.h @@ -46,8 +46,8 @@ private: NodeStore _nodeStore; - typedef vespalib::Array<BTreeNode::Ref, vespalib::DefaultAlloc> RefVector; - typedef vespalib::Array<BTreeRootBaseType *, vespalib::DefaultAlloc> BTreeRootBaseTypeVector; + typedef vespalib::Array<BTreeNode::Ref> RefVector; + typedef vespalib::Array<BTreeRootBaseType *> BTreeRootBaseTypeVector; // Nodes that might not be frozen. RefVector _internalToFreeze; diff --git a/searchlib/src/vespa/searchlib/btree/bufferstate.cpp b/searchlib/src/vespa/searchlib/btree/bufferstate.cpp index 21f548187ee..d0dd62fec4b 100644 --- a/searchlib/src/vespa/searchlib/btree/bufferstate.cpp +++ b/searchlib/src/vespa/searchlib/btree/bufferstate.cpp @@ -125,9 +125,8 @@ BufferState::BufferState(void) _typeId(0), _clusterSize(0), _compacting(false), - _buffer() + _buffer(DefaultAlloc::create()) { - _buffer.reset(new Alloc()); } @@ -163,14 +162,13 @@ BufferState::onActive(uint32_t bufferId, uint32_t typeId, assert(_freeListList == NULL || _freeListList->_head != this); size_t initialSizeNeeded = 0; - if (bufferId == 0) + if (bufferId == 0) { initialSizeNeeded = typeHandler->getClusterSize(); - size_t allocClusters = - typeHandler->calcClustersToAlloc(initialSizeNeeded + sizeNeeded, - maxClusters); + } + size_t allocClusters = typeHandler->calcClustersToAlloc(initialSizeNeeded + sizeNeeded, maxClusters); size_t allocSize = allocClusters * typeHandler->getClusterSize(); assert(allocSize >= initialSizeNeeded + sizeNeeded); - _buffer.reset(new Alloc(allocSize * typeHandler->elementSize())); + _buffer.create(allocSize * typeHandler->elementSize()).swap(_buffer); buffer = _buffer->get(); typeHandler->onActive(&_usedElems); assert(buffer != NULL); @@ -218,7 +216,7 @@ BufferState::onFree(void *&buffer) assert(_deadElems <= _usedElems); assert(_holdElems == _usedElems - _deadElems); _typeHandler->destroyElements(buffer, _usedElems); - Alloc().swap(*_buffer); + _buffer.create().swap(_buffer); _typeHandler->onFree(_usedElems); buffer = NULL; _usedElems = 0; @@ -334,10 +332,9 @@ BufferState::fallbackResize(uint64_t newSize, size_t allocSize = allocClusters * _typeHandler->getClusterSize(); assert(allocSize >= newSize); assert(allocSize > _allocElems); - Alloc::UP newBuffer(std::make_unique<Alloc> - (allocSize * _typeHandler->elementSize())); - _typeHandler->fallbackCopy(newBuffer->get(), buffer, _usedElems); - holdBuffer.swap(*_buffer); + Alloc newBuffer = _buffer.create(allocSize * _typeHandler->elementSize()); + _typeHandler->fallbackCopy(newBuffer.get(), buffer, _usedElems); + holdBuffer.swap(_buffer); std::atomic_thread_fence(std::memory_order_release); _buffer = std::move(newBuffer); buffer = _buffer->get(); diff --git a/searchlib/src/vespa/searchlib/btree/bufferstate.h b/searchlib/src/vespa/searchlib/btree/bufferstate.h index 3c7a3557952..bbb8f77d5ef 100644 --- a/searchlib/src/vespa/searchlib/btree/bufferstate.h +++ b/searchlib/src/vespa/searchlib/btree/bufferstate.h @@ -13,14 +13,8 @@ namespace search { namespace btree { - class BufferTypeBase { -private: - BufferTypeBase(const BufferTypeBase &rhs); - - BufferTypeBase & - operator=(const BufferTypeBase &rhs); protected: uint32_t _clusterSize; // Number of elements in an allocation unit uint32_t _minClusters; // Minimum number of clusters to allocate @@ -32,47 +26,21 @@ protected: const size_t *_lastUsedElems; // used elements in last active buffer public: - BufferTypeBase(uint32_t clusterSize, - uint32_t minClusters, - uint32_t maxClusters); - - virtual - ~BufferTypeBase(void); - - virtual void - destroyElements(void *buffer, size_t numElements) = 0; - - virtual void - fallbackCopy(void *newBuffer, - const void *oldBuffer, - size_t numElements) = 0; - - virtual void - cleanInitialElements(void *buffer) = 0; - - virtual size_t - elementSize(void) const = 0; - - virtual void - cleanHold(void *buffer, uint64_t offset, uint64_t len) = 0; - - uint32_t - getClusterSize(void) const - { - return _clusterSize; - } - - void - flushLastUsed(void); - - void - onActive(const size_t *usedElems); - - void - onHold(const size_t *usedElems); - - virtual void - onFree(size_t usedElems); + + BufferTypeBase(const BufferTypeBase &rhs) = delete; + BufferTypeBase & operator=(const BufferTypeBase &rhs) = delete; + BufferTypeBase(uint32_t clusterSize, uint32_t minClusters, uint32_t maxClusters); + virtual ~BufferTypeBase(); + virtual void destroyElements(void *buffer, size_t numElements) = 0; + virtual void fallbackCopy(void *newBuffer, const void *oldBuffer, size_t numElements) = 0; + virtual void cleanInitialElements(void *buffer) = 0; + virtual size_t elementSize() const = 0; + virtual void cleanHold(void *buffer, uint64_t offset, uint64_t len) = 0; + uint32_t getClusterSize() const { return _clusterSize; } + void flushLastUsed(); + void onActive(const size_t *usedElems); + void onHold(const size_t *usedElems); + virtual void onFree(size_t usedElems); /** * Calculate number of clusters to allocate for new buffer. @@ -82,9 +50,7 @@ public: * * @return number of clusters to allocate for new buffer */ - virtual size_t - calcClustersToAlloc(size_t sizeNeeded, - uint64_t clusterRefSize) const; + virtual size_t calcClustersToAlloc(size_t sizeNeeded, uint64_t clusterRefSize) const; uint32_t getActiveBuffers() const { return _activeBuffers; } }; @@ -93,41 +59,21 @@ public: template <typename EntryType> class BufferType : public BufferTypeBase { -private: - BufferType(const BufferType &rhs); - - BufferType & - operator=(const BufferType &rhs); public: EntryType _emptyEntry; - BufferType(uint32_t clusterSize, - uint32_t minClusters, - uint32_t maxClusters) + BufferType(const BufferType &rhs) = delete; + BufferType & operator=(const BufferType &rhs) = delete; + BufferType(uint32_t clusterSize, uint32_t minClusters, uint32_t maxClusters) : BufferTypeBase(clusterSize, minClusters, maxClusters), _emptyEntry() - { - } - - virtual void - destroyElements(void *buffer, size_t numElements); + { } - virtual void - fallbackCopy(void *newBuffer, - const void *oldBuffer, - size_t numElements); - - virtual void - cleanInitialElements(void *buffer); - - virtual void - cleanHold(void *buffer, uint64_t offset, uint64_t len); - - virtual size_t - elementSize(void) const - { - return sizeof(EntryType); - } + void destroyElements(void *buffer, size_t numElements) override; + void fallbackCopy(void *newBuffer, const void *oldBuffer, size_t numElements) override; + void cleanInitialElements(void *buffer) override; + void cleanHold(void *buffer, uint64_t offset, uint64_t len) override; + size_t elementSize() const override { return sizeof(EntryType); } }; @@ -186,25 +132,20 @@ BufferType<EntryType>::cleanHold(void *buffer, uint64_t offset, uint64_t len) class BufferState { public: - typedef vespalib::DefaultAlloc Alloc; + typedef vespalib::alloc::Alloc Alloc; class FreeListList { public: BufferState *_head; - FreeListList(void) - : _head(NULL) - { - } - - ~FreeListList(void); + FreeListList() : _head(NULL) { } + ~FreeListList(); }; - typedef vespalib::Array<EntryRef, vespalib::DefaultAlloc> FreeList; + typedef vespalib::Array<EntryRef> FreeList; - enum State - { + enum State { FREE, ACTIVE, HOLD @@ -224,18 +165,17 @@ public: BufferState *_prevHasFree; BufferTypeBase *_typeHandler; - uint32_t _typeId; - uint32_t _clusterSize; - bool _compacting; + uint32_t _typeId; + uint32_t _clusterSize; + bool _compacting; /* * TODO: Check if per-buffer free lists are useful, or if *compaction should always be used to free up whole buffers. */ - BufferState(void); - - ~BufferState(void); + BufferState(); + ~BufferState(); /** * Transition from FREE to ACTIVE state. @@ -250,21 +190,17 @@ public: */ void onActive(uint32_t bufferId, uint32_t typeId, BufferTypeBase *typeHandler, - size_t sizeNeeded, - size_t maxSize, - void *&buffer); + size_t sizeNeeded, size_t maxSize, void *&buffer); /** * Transition from ACTIVE to HOLD state. */ - void - onHold(void); + void onHold(); /** * Transition from HOLD to FREE state. */ - void - onFree(void *&buffer); + void onFree(void *&buffer); /** * Set list of buffer states with nonempty free lists. @@ -272,115 +208,57 @@ public: * @param freeListList List of buffer states. If NULL then free lists * are disabled. */ - void - setFreeListList(FreeListList *freeListList); + void setFreeListList(FreeListList *freeListList); /** * Add buffer state to list of buffer states with nonempty free lists. */ - void - addToFreeListList(void); + void addToFreeListList(); /** * Remove buffer state from list of buffer states with nonempty free lists. */ - void - removeFromFreeListList(void); + void removeFromFreeListList(); /** * Disable hold of elements, just mark then as dead without * cleanup. Typically used when tearing down data structure in a * controlled manner. */ - void - disableElemHoldList(void); + void disableElemHoldList(); /** * Pop element from free list. */ - EntryRef - popFreeList(void) - { + EntryRef popFreeList() { EntryRef ret = _freeList.back(); _freeList.pop_back(); - if (_freeList.empty()) + if (_freeList.empty()) { removeFromFreeListList(); + } _deadElems -= _clusterSize; return ret; } - - size_t - size(void) const - { - return _usedElems; - } - - size_t - capacity(void) const - { - return _allocElems; - } - - size_t - remaining(void) const - { - return _allocElems - _usedElems; - } - - void - pushed_back(uint64_t len) - { - _usedElems += len; - } - - void - cleanHold(void *buffer, uint64_t offset, uint64_t len) - { - _typeHandler->cleanHold(buffer, offset, len); - } - - void - dropBuffer(void *&buffer); - - uint32_t - getTypeId(void) const - { - return _typeId; - } - - uint32_t - getClusterSize(void) const - { - return _clusterSize; - } - + size_t size() const { return _usedElems; } + size_t capacity() const { return _allocElems; } + size_t remaining() const { return _allocElems - _usedElems; } + void pushed_back(uint64_t len) { _usedElems += len; } + void cleanHold(void *buffer, uint64_t offset, uint64_t len) { _typeHandler->cleanHold(buffer, offset, len); } + void dropBuffer(void *&buffer); + uint32_t getTypeId() const { return _typeId; } + uint32_t getClusterSize() const { return _clusterSize; } uint64_t getDeadElems() const { return _deadElems; } - - bool - getCompacting(void) const - { - return _compacting; - } - - void - setCompacting(void) - { - _compacting = true; - } - - void - fallbackResize(uint64_t newSize, - size_t maxClusters, - void *&buffer, - Alloc &holdBuffer); + bool getCompacting() const { return _compacting; } + void setCompacting() { _compacting = true; } + void fallbackResize(uint64_t newSize, size_t maxClusters, void *&buffer, Alloc &holdBuffer); bool isActive(uint32_t typeId) const { return ((_state == ACTIVE) && (_typeId == typeId)); } private: - Alloc::UP _buffer; + Alloc _buffer; }; diff --git a/searchlib/src/vespa/searchlib/btree/datastorebase.h b/searchlib/src/vespa/searchlib/btree/datastorebase.h index 0c44b485d18..f948ada3d2f 100644 --- a/searchlib/src/vespa/searchlib/btree/datastorebase.h +++ b/searchlib/src/vespa/searchlib/btree/datastorebase.h @@ -57,7 +57,7 @@ protected: } }; - typedef vespalib::Array<ElemHold1ListElem, vespalib::DefaultAlloc> ElemHold1List; + typedef vespalib::Array<ElemHold1ListElem> ElemHold1List; typedef std::deque<ElemHold2ListElem> ElemHold2List; class FallbackHold : public vespalib::GenerationHeldBase diff --git a/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp b/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp index 59d190b2b50..d6795f4b583 100644 --- a/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp +++ b/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp @@ -18,7 +18,7 @@ void AllocatedBitVector::alloc() uint32_t words = capacityWords(); words += (-words & 15); // Pad to 64 byte alignment const size_t sz(words * sizeof(Word)); - Alloc(sz).swap(_alloc); + DefaultAlloc(sz).swap(_alloc); assert(_alloc.size()/sizeof(Word) >= words); // Clear padding memset(static_cast<char *>(_alloc.get()) + sizeBytes(), 0, sz - sizeBytes()); diff --git a/searchlib/src/vespa/searchlib/common/allocatedbitvector.h b/searchlib/src/vespa/searchlib/common/allocatedbitvector.h index 8a52a07e29b..df1de516156 100644 --- a/searchlib/src/vespa/searchlib/common/allocatedbitvector.h +++ b/searchlib/src/vespa/searchlib/common/allocatedbitvector.h @@ -17,8 +17,7 @@ class BitVectorTest; class AllocatedBitVector : public BitVector { public: - typedef vespalib::AutoAlloc<0x800000, 0x1000> Alloc; - + using Alloc = vespalib::alloc::Alloc; /** * Class constructor specifying size but not content. New bitvector * is cleared. diff --git a/searchlib/src/vespa/searchlib/common/rcuvector.h b/searchlib/src/vespa/searchlib/common/rcuvector.h index 9c5954848c4..3c9274e3e94 100644 --- a/searchlib/src/vespa/searchlib/common/rcuvector.h +++ b/searchlib/src/vespa/searchlib/common/rcuvector.h @@ -44,7 +44,7 @@ class RcuVectorBase "Value type must be trivially destructible"); protected: - typedef vespalib::Array<T, vespalib::DefaultAlloc> Array; + typedef vespalib::Array<T> Array; typedef vespalib::GenerationHandler::generation_t generation_t; typedef vespalib::GenerationHolder GenerationHolder; Array _data; diff --git a/searchlib/src/vespa/searchlib/diskindex/docidmapper.h b/searchlib/src/vespa/searchlib/diskindex/docidmapper.h index 43e1ea44b89..f150e8636a5 100644 --- a/searchlib/src/vespa/searchlib/diskindex/docidmapper.h +++ b/searchlib/src/vespa/searchlib/diskindex/docidmapper.h @@ -12,7 +12,7 @@ class BitVector; namespace diskindex { -typedef vespalib::Array<uint8_t, vespalib::DefaultAlloc> SelectorArray; +typedef vespalib::Array<uint8_t> SelectorArray; class DocIdMapping { diff --git a/searchlib/src/vespa/searchlib/diskindex/indexbuilder.cpp b/searchlib/src/vespa/searchlib/diskindex/indexbuilder.cpp index a88ce029814..0ec75cfbdf2 100644 --- a/searchlib/src/vespa/searchlib/diskindex/indexbuilder.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/indexbuilder.cpp @@ -152,9 +152,9 @@ public: } }; - typedef vespalib::Array<FHWordDocFieldFeatures, vespalib::DefaultAlloc> FHWordDocFieldFeaturesVector; - typedef vespalib::Array<FHWordDocElementFeatures, vespalib::DefaultAlloc> FHWordDocElementFeaturesVector; - typedef vespalib::Array<FHWordDocElementWordPosFeatures, vespalib::DefaultAlloc> FHWordDocElementWordPosFeaturesVector; + typedef vespalib::Array<FHWordDocFieldFeatures> FHWordDocFieldFeaturesVector; + typedef vespalib::Array<FHWordDocElementFeatures> FHWordDocElementFeaturesVector; + typedef vespalib::Array<FHWordDocElementWordPosFeatures> FHWordDocElementWordPosFeaturesVector; FHWordDocFieldFeaturesVector _wdff; FHWordDocElementFeaturesVector _wdfef; diff --git a/searchlib/src/vespa/searchlib/diskindex/wordnummapper.h b/searchlib/src/vespa/searchlib/diskindex/wordnummapper.h index a1a72757f22..d12e0211b94 100644 --- a/searchlib/src/vespa/searchlib/diskindex/wordnummapper.h +++ b/searchlib/src/vespa/searchlib/diskindex/wordnummapper.h @@ -14,7 +14,7 @@ class WordNumMapper; class WordNumMapping { - typedef vespalib::Array<uint64_t, vespalib::DefaultAlloc> Array; + typedef vespalib::Array<uint64_t> Array; static uint64_t noWordNumHigh(void) diff --git a/searchlib/src/vespa/searchlib/docstore/documentstore.h b/searchlib/src/vespa/searchlib/docstore/documentstore.h index d44c94fe7f8..7ca3b98d525 100644 --- a/searchlib/src/vespa/searchlib/docstore/documentstore.h +++ b/searchlib/src/vespa/searchlib/docstore/documentstore.h @@ -173,7 +173,7 @@ private: _compressedSize(rhs._compressedSize), _uncompressedSize(rhs._uncompressedSize), _compression(rhs._compression), - _buf(rhs.size()) + _buf(vespalib::DefaultAlloc::create(rhs.size())) { memcpy(get(), rhs.get(), size()); } @@ -213,7 +213,7 @@ private: size_t _compressedSize; size_t _uncompressedSize; document::CompressionConfig::Type _compression; - vespalib::DefaultAlloc _buf; + vespalib::alloc::Alloc _buf; }; class BackingStore { public: diff --git a/searchlib/src/vespa/searchlib/docstore/filechunk.cpp b/searchlib/src/vespa/searchlib/docstore/filechunk.cpp index 36ee94f9f8f..f76d12ed7aa 100644 --- a/searchlib/src/vespa/searchlib/docstore/filechunk.cpp +++ b/searchlib/src/vespa/searchlib/docstore/filechunk.cpp @@ -293,7 +293,7 @@ public: } }; -typedef vespalib::Array<TmpChunkMeta, vespalib::DefaultAlloc> TmpChunkMetaV; +typedef vespalib::Array<TmpChunkMeta> TmpChunkMetaV; namespace { diff --git a/searchlib/src/vespa/searchlib/docstore/filechunk.h b/searchlib/src/vespa/searchlib/docstore/filechunk.h index 5c2006a7083..27cccc59290 100644 --- a/searchlib/src/vespa/searchlib/docstore/filechunk.h +++ b/searchlib/src/vespa/searchlib/docstore/filechunk.h @@ -345,7 +345,7 @@ protected: ssize_t read(uint32_t lid, SubChunkId chunkId, const ChunkInfo & chunkInfo, vespalib::DataBuffer & buffer) const; void read(LidInfoWithLidV::const_iterator begin, size_t count, ChunkInfo ci, IBufferVisitor & visitor) const; - typedef vespalib::Array<ChunkInfo, vespalib::DefaultAlloc> ChunkInfoVector; + typedef vespalib::Array<ChunkInfo> ChunkInfoVector; const IBucketizer * _bucketizer; size_t _addedBytes; TuneFileSummary _tune; diff --git a/searchlib/src/vespa/searchlib/docstore/storebybucket.h b/searchlib/src/vespa/searchlib/docstore/storebybucket.h index a7144596d0b..b6a25ef1dff 100644 --- a/searchlib/src/vespa/searchlib/docstore/storebybucket.h +++ b/searchlib/src/vespa/searchlib/docstore/storebybucket.h @@ -60,7 +60,7 @@ private: uint32_t _chunkId; uint32_t _lid; }; - using IndexVector = vespalib::Array<Index, vespalib::DefaultAlloc>; + using IndexVector = vespalib::Array<Index>; uint64_t _chunkSerial; Chunk::UP _current; std::map<uint64_t, IndexVector> _where; diff --git a/searchlib/src/vespa/searchlib/docstore/visitcache.cpp b/searchlib/src/vespa/searchlib/docstore/visitcache.cpp index 43a8c1b33aa..79d7fd4e26d 100644 --- a/searchlib/src/vespa/searchlib/docstore/visitcache.cpp +++ b/searchlib/src/vespa/searchlib/docstore/visitcache.cpp @@ -35,7 +35,7 @@ size_t getBufferSize(const BlobSet::Positions & p) { } -BlobSet::BlobSet(const Positions & positions, vespalib::DefaultAlloc && buffer) : +BlobSet::BlobSet(const Positions & positions, vespalib::alloc::Alloc && buffer) : _positions(positions), _buffer(std::move(buffer), getBufferSize(_positions)) { diff --git a/searchlib/src/vespa/searchlib/docstore/visitcache.h b/searchlib/src/vespa/searchlib/docstore/visitcache.h index fb1b61310f8..518280bcc09 100644 --- a/searchlib/src/vespa/searchlib/docstore/visitcache.h +++ b/searchlib/src/vespa/searchlib/docstore/visitcache.h @@ -47,7 +47,7 @@ public: using Positions = std::vector<LidPosition>; BlobSet(); - BlobSet(const Positions & positions, vespalib::DefaultAlloc && buffer); + BlobSet(const Positions & positions, vespalib::alloc::Alloc && buffer); void append(uint32_t lid, vespalib::ConstBufferRef blob); void remove(uint32_t lid); const Positions & getPositions() const { return _positions; } diff --git a/searchlib/src/vespa/searchlib/engine/searchreply.h b/searchlib/src/vespa/searchlib/engine/searchreply.h index 692806114ee..0e7ab43e66d 100644 --- a/searchlib/src/vespa/searchlib/engine/searchreply.h +++ b/searchlib/src/vespa/searchlib/engine/searchreply.h @@ -56,7 +56,7 @@ public: search::HitRank maxRank; std::vector<uint32_t> sortIndex; std::vector<char> sortData; - vespalib::Array<char, vespalib::DefaultAlloc> groupResult; + vespalib::Array<char> groupResult; bool useCoverage; Coverage coverage; bool useWideHits; diff --git a/searchlib/src/vespa/searchlib/grouping/sketch.h b/searchlib/src/vespa/searchlib/grouping/sketch.h index 0a475a9e805..e336955f337 100644 --- a/searchlib/src/vespa/searchlib/grouping/sketch.h +++ b/searchlib/src/vespa/searchlib/grouping/sketch.h @@ -226,19 +226,16 @@ decompress_buckets_from(char *buffer, uint32_t size) { memcpy(bucket, buffer, BUCKET_COUNT); } else { vespalib::ConstBufferRef compressed(buffer, size); - vespalib::DataBuffer uncompressed(reinterpret_cast<char *>(&bucket[0]), - BUCKET_COUNT); - document::decompress(document::CompressionConfig::LZ4, BUCKET_COUNT, - compressed, uncompressed, false); + vespalib::DataBuffer uncompressed(reinterpret_cast<char *>(&bucket[0]), BUCKET_COUNT); + document::decompress(document::CompressionConfig::LZ4, BUCKET_COUNT, compressed, uncompressed, false); } } template <int BucketBits, typename HashT> void NormalSketch<BucketBits, HashT>:: serialize(vespalib::Serializer &os) const { - vespalib::DefaultAlloc backing(LZ4_compressBound(BUCKET_COUNT)); + vespalib::alloc::Alloc backing(vespalib::DefaultAlloc::create(LZ4_compressBound(BUCKET_COUNT))); char * compress_array(static_cast<char *>(backing.get())); - uint32_t size = - compress_buckets_into(compress_array, backing.size()); + uint32_t size = compress_buckets_into(compress_array, backing.size()); os << BUCKET_COUNT << size; for (size_t i = 0; i < size; ++i) { os << static_cast<uint8_t>(compress_array[i]); diff --git a/searchlib/src/vespa/searchlib/memoryindex/fieldinverter.h b/searchlib/src/vespa/searchlib/memoryindex/fieldinverter.h index 1f72c8e62b4..47d1031d546 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/fieldinverter.h +++ b/searchlib/src/vespa/searchlib/memoryindex/fieldinverter.h @@ -98,7 +98,7 @@ private: FieldInverter &operator=(const FieldInverter &) = delete; FieldInverter &operator=(const FieldInverter &&) = delete; - typedef vespalib::Array<char, vespalib::DefaultAlloc> WordBuffer; + typedef vespalib::Array<char> WordBuffer; class ElemInfo { diff --git a/searchlib/src/vespa/searchlib/memoryindex/memoryfieldindex.cpp b/searchlib/src/vespa/searchlib/memoryindex/memoryfieldindex.cpp index 88b718e1860..ba0c8e95efa 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/memoryfieldindex.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/memoryfieldindex.cpp @@ -173,7 +173,7 @@ MemoryFieldIndex::dump(search::index::IndexBuilder & indexBuilder) vespalib::stringref word; FeatureStore::DecodeContextCooked decoder(NULL); DocIdAndFeatures features; - vespalib::Array<uint32_t, vespalib::DefaultAlloc> wordMap(_numUniqueWords + 1, 0); + vespalib::Array<uint32_t> wordMap(_numUniqueWords + 1, 0); _featureStore.setupForField(_fieldId, decoder); for (DictionaryTree::Iterator itr = _dict.begin(); itr.valid(); ++itr) { const WordKey & wk = itr.getKey(); diff --git a/searchlib/src/vespa/searchlib/predicate/document_features_store.h b/searchlib/src/vespa/searchlib/predicate/document_features_store.h index 314e7347f27..8d910f8506c 100644 --- a/searchlib/src/vespa/searchlib/predicate/document_features_store.h +++ b/searchlib/src/vespa/searchlib/predicate/document_features_store.h @@ -72,7 +72,7 @@ public: typedef std::unordered_set<uint64_t> FeatureSet; DocumentFeaturesStore(uint32_t arity); - DocumentFeaturesStore(vespalib::MMapDataBuffer &buffer); + DocumentFeaturesStore(vespalib::DataBuffer &buffer); ~DocumentFeaturesStore(); void insert(uint64_t featureId, uint32_t docId); @@ -81,7 +81,7 @@ public: void remove(uint32_t docId); search::MemoryUsage getMemoryUsage() const; - void serialize(vespalib::MMapDataBuffer &buffer) const; + void serialize(vespalib::DataBuffer &buffer) const; }; } // namespace predicate diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp b/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp index 81533c36951..6e597d55f3b 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp +++ b/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp @@ -12,7 +12,7 @@ LOG_SETUP(".predicate_index"); using search::btree::EntryRef; -using vespalib::MMapDataBuffer; +using vespalib::DataBuffer; using std::vector; namespace search { @@ -63,7 +63,7 @@ class IntervalSerializer : public PostingSerializer<EntryRef> { public: IntervalSerializer(const PredicateIntervalStore &store) : _store(store) {} virtual void serialize(const EntryRef &ref, - vespalib::MMapDataBuffer &buffer) const { + vespalib::DataBuffer &buffer) const { uint32_t size; IntervalT single_buf; const IntervalT *interval = _store.get(ref, size, &single_buf); @@ -81,7 +81,7 @@ class IntervalDeserializer : public PostingDeserializer<EntryRef> { PredicateIntervalStore &_store; public: IntervalDeserializer(PredicateIntervalStore &store) : _store(store) {} - virtual EntryRef deserialize(vespalib::MMapDataBuffer &buffer) { + virtual EntryRef deserialize(vespalib::DataBuffer &buffer) { std::vector<IntervalT> intervals; size_t size = buffer.readInt16(); for (uint32_t i = 0; i < size; ++i) { @@ -95,7 +95,7 @@ public: PredicateIndex::PredicateIndex(GenerationHandler &generation_handler, GenerationHolder &genHolder, const DocIdLimitProvider &limit_provider, - const SimpleIndexConfig &simple_index_config, MMapDataBuffer &buffer, + const SimpleIndexConfig &simple_index_config, DataBuffer &buffer, SimpleIndexDeserializeObserver<> & observer, uint32_t version) : _arity(0), _generation_handler(generation_handler), @@ -125,7 +125,7 @@ PredicateIndex::PredicateIndex(GenerationHandler &generation_handler, Generation commit(); } -void PredicateIndex::serialize(MMapDataBuffer &buffer) const { +void PredicateIndex::serialize(DataBuffer &buffer) const { _features_store.serialize(buffer); buffer.writeInt16(_arity); buffer.writeInt32(_zero_constraint_docs.size()); diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_index.h b/searchlib/src/vespa/searchlib/predicate/predicate_index.h index d2e5c1f268e..3673f4378ad 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_index.h +++ b/searchlib/src/vespa/searchlib/predicate/predicate_index.h @@ -82,10 +82,10 @@ public: // The observer can be used to gain some insight into what has been added to the index.. PredicateIndex(GenerationHandler &generation_handler, GenerationHolder &genHolder, const DocIdLimitProvider &limit_provider, - const SimpleIndexConfig &simple_index_config, vespalib::MMapDataBuffer &buffer, + const SimpleIndexConfig &simple_index_config, vespalib::DataBuffer &buffer, SimpleIndexDeserializeObserver<> & observer, uint32_t version); - void serialize(vespalib::MMapDataBuffer &buffer) const; + void serialize(vespalib::DataBuffer &buffer) const; void onDeserializationCompleted(); void indexEmptyDocument(uint32_t doc_id); diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_interval.h b/searchlib/src/vespa/searchlib/predicate/predicate_interval.h index fede659582a..3a288c4aedb 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_interval.h +++ b/searchlib/src/vespa/searchlib/predicate/predicate_interval.h @@ -16,10 +16,10 @@ struct Interval { Interval() : interval(0) {} Interval(uint32_t interval_) : interval(interval_) {} - void serialize(vespalib::MMapDataBuffer &buffer) const { + void serialize(vespalib::DataBuffer &buffer) const { buffer.writeInt32(interval); } - static Interval deserialize(vespalib::MMapDataBuffer &buffer) { + static Interval deserialize(vespalib::DataBuffer &buffer) { return Interval{buffer.readInt32()}; } bool operator==(const Interval &other) const { @@ -42,11 +42,11 @@ struct IntervalWithBounds { IntervalWithBounds() : interval(0), bounds(0) {} IntervalWithBounds(uint32_t interval_, uint32_t bounds_) : interval(interval_), bounds(bounds_) {} - void serialize(vespalib::MMapDataBuffer &buffer) const { + void serialize(vespalib::DataBuffer &buffer) const { buffer.writeInt32(interval); buffer.writeInt32(bounds); } - static IntervalWithBounds deserialize(vespalib::MMapDataBuffer &buffer) { + static IntervalWithBounds deserialize(vespalib::DataBuffer &buffer) { uint32_t interval = buffer.readInt32(); uint32_t bounds = buffer.readInt32(); return IntervalWithBounds{interval, bounds}; diff --git a/searchlib/src/vespa/searchlib/predicate/simple_index.h b/searchlib/src/vespa/searchlib/predicate/simple_index.h index be6fc098682..b61f31f79a0 100644 --- a/searchlib/src/vespa/searchlib/predicate/simple_index.h +++ b/searchlib/src/vespa/searchlib/predicate/simple_index.h @@ -31,13 +31,13 @@ template <typename Posting> struct PostingSerializer { virtual ~PostingSerializer() {} virtual void serialize(const Posting &posting, - vespalib::MMapDataBuffer &buffer) const = 0; + vespalib::DataBuffer &buffer) const = 0; }; template <typename Posting> struct PostingDeserializer { virtual ~PostingDeserializer() {} - virtual Posting deserialize(vespalib::MMapDataBuffer &buffer) = 0; + virtual Posting deserialize(vespalib::DataBuffer &buffer) = 0; }; struct DocIdLimitProvider { @@ -195,9 +195,9 @@ public: : _generation_holder(generation_holder), _config(config), _limit_provider(provider) {} ~SimpleIndex(); - void serialize(vespalib::MMapDataBuffer &buffer, + void serialize(vespalib::DataBuffer &buffer, const PostingSerializer<Posting> &serializer) const; - void deserialize(vespalib::MMapDataBuffer &buffer, + void deserialize(vespalib::DataBuffer &buffer, PostingDeserializer<Posting> &deserializer, SimpleIndexDeserializeObserver<Key, DocId> &observer, uint32_t version); diff --git a/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.cpp index 70903788992..1610267c255 100644 --- a/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.cpp @@ -250,7 +250,7 @@ void PredicateBlueprint::fetchPostings(bool) { } PredicateAttribute::MinFeatureHandle mfh = predicate_attribute().getMinFeatureVector(); - vespalib::DefaultAlloc kv(mfh.second); + vespalib::alloc::Alloc kv(vespalib::DefaultAlloc::create(mfh.second)); _kVBacking.swap(kv); _kV = BitVectorCache::CountVector(static_cast<uint8_t *>(_kVBacking.get()), mfh.second); _index.computeCountVector(_cachedFeatures, _kV); diff --git a/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h b/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h index aeab9d4175f..616460f9e55 100644 --- a/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h +++ b/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h @@ -72,7 +72,7 @@ private: const PredicateAttribute & _attribute; const predicate::PredicateIndex &_index; - vespalib::DefaultAlloc _kVBacking; + vespalib::alloc::Alloc _kVBacking; BitVectorCache::CountVector _kV; BitVectorCache::KeySet _cachedFeatures; diff --git a/searchlib/src/vespa/searchlib/util/fileutil.h b/searchlib/src/vespa/searchlib/util/fileutil.h index 69d2cc557a6..b61c4e9d0ac 100644 --- a/searchlib/src/vespa/searchlib/util/fileutil.h +++ b/searchlib/src/vespa/searchlib/util/fileutil.h @@ -295,11 +295,11 @@ public: virtual void rewind() = 0; }; -template <typename T, typename A=vespalib::HeapAlloc> -class SequentialReadModifyWriteVector : public SequentialReadModifyWriteInterface<T>, public vespalib::Array<T, A> +template <typename T> +class SequentialReadModifyWriteVector : public SequentialReadModifyWriteInterface<T>, public vespalib::Array<T> { private: - typedef vespalib::Array<T, A> Vector; + typedef vespalib::Array<T> Vector; public: SequentialReadModifyWriteVector() : Vector(), _rp(0), _wp(0) { } SequentialReadModifyWriteVector(size_t sz) : Vector(sz), _rp(0), _wp(0) { } |