From 75cda5ebc654ea901772cba5e7710719831ca3f1 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Thu, 12 Feb 2026 23:43:35 +0100 Subject: [PATCH] BufferProvider: consolidate information passed to BufferStore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change largely resolves the problems with the storage API, so that the implementation can now be split in two disjoint segments. One operation, `mark_emitted()`, is still misplaced on that API, yet must be retained until the refactoring on the metadata side is complete (this latter refactoring can not be started sensibly, before the old »tracking« implementation is cleaned up to care for allocation solely). With this change, the existing implementation, which combines the tracking functionality and the allocation, has been squeezed down into the heap-memory implementation class, yet the tracking functionality is already detached. The remaining code down there is a huge pile of mess, that can hopefully be dismantled soon. But at least all of this code passes the compiler again, and so it should be possible now to focus on getting the `DiagnosticBufferProvider` up and running, thereby providing a new clean re-implementation of the diagnostic functions. --- src/steam/engine/buffer-provider.cpp | 15 ++- src/steam/engine/buffer-provider.hpp | 10 +- src/steam/engine/heap-mem-buffer-store.cpp | 10 +- src/steam/engine/heap-mem-buffer-store.hpp | 8 +- wiki/thinkPad.ichthyo.mm | 126 +++++++++++++++------ 5 files changed, 116 insertions(+), 53 deletions(-) diff --git a/src/steam/engine/buffer-provider.cpp b/src/steam/engine/buffer-provider.cpp index 53c56d856..dd7883799 100644 --- a/src/steam/engine/buffer-provider.cpp +++ b/src/steam/engine/buffer-provider.cpp @@ -78,17 +78,20 @@ namespace engine { } - /** callback from implementation to build and enrol a BufferHandle, + /** + * Callback from implementation to build and enrol a BufferHandle, * to be returned to the client as result of the #lockBuffer call. * Performs the necessary metadata state transition leading from an * abstract buffer type to a metadata::Entry corresponding to an * actual buffer, which is locked for exclusive use by one client. + * @note the implementation is free to provide an opaque \a implMarker, + * which becomes part of the key to designate this specific buffer. */ BuffHandle - BufferProvider::buildHandle (HashVal typeID, Buff* storage, LocalTag const& localTag) + BufferProvider::buildHandle (HashVal typeID, Buff* storage, LocalTag implMarker) { metadata::Key& typeKey = bufferStage_->get (typeID); - metadata::Entry& entry = bufferStage_->markLocked(typeKey, storage, localTag); + metadata::Entry& entry = bufferStage_->markLocked (typeKey, storage, implMarker); return BuffHandle (BuffDescr(*this, entry), storage); } @@ -136,8 +139,10 @@ namespace engine { { REQUIRE (was_created_by_this_provider (type)); size_t buffSiz = getBufferSize (type); - return bufferStore_->provideBuffer (buffSiz, type); - } // is expected to call buildHandle() --> state transition + LocalTag implMarker; + Buff& storage = bufferStore_->provideBuffer (buffSiz, type, implMarker); + return buildHandle (type, &storage, implMarker); + } /** BufferProvider API: state transition to \em emitted state. diff --git a/src/steam/engine/buffer-provider.hpp b/src/steam/engine/buffer-provider.hpp index 7a2f93c85..4261a94e1 100644 --- a/src/steam/engine/buffer-provider.hpp +++ b/src/steam/engine/buffer-provider.hpp @@ -183,7 +183,7 @@ namespace engine { /// placeholder marker type for an actual data buffer using Buff = StreamType::ImplFacade::DataBuffer; - BuffHandle buildHandle (HashVal typeID, Buff* storage, LocalTag const& =LocalTag::UNKNOWN); + BuffHandle buildHandle (HashVal typeID, Buff* storage, LocalTag =LocalTag::UNKNOWN); bool was_created_by_this_provider (BuffDescr const&) const; @@ -203,10 +203,10 @@ namespace engine { public: virtual ~BufferStore() { } ///< this is an interface - virtual uint prepareBuffers (uint cnt, size_t,HashVal typeID) =0; - virtual BuffHandle provideBuffer (size_t,HashVal typeID) =0; - virtual void mark_emitted (size_t,HashVal, LocalTag const&) =0; - virtual void detachBuffer (size_t,HashVal, LocalTag const&, Buff&) =0; + virtual uint prepareBuffers (uint cnt, size_t,HashVal typeID) =0; + virtual Buff& provideBuffer (size_t,HashVal typeID, LocalTag&) =0; + virtual void mark_emitted (size_t,HashVal, LocalTag const&) =0; + virtual void detachBuffer (size_t,HashVal, LocalTag, Buff&) =0; }; unique_ptr bufferStage_; ///////////////////////////////////////////////////////////TICKET #1410 : must be turned into an internal interface diff --git a/src/steam/engine/heap-mem-buffer-store.cpp b/src/steam/engine/heap-mem-buffer-store.cpp index b6f590185..2cd66fe32 100644 --- a/src/steam/engine/heap-mem-buffer-store.cpp +++ b/src/steam/engine/heap-mem-buffer-store.cpp @@ -288,13 +288,13 @@ namespace engine { } - BuffHandle - HeapMemProvider::provideBuffer (size_t buffSiz, HashVal typeID) + Buff& + HeapMemProvider::provideBuffer (size_t buffSiz, HashVal typeID, LocalTag&) { BlockPool& blocks = getBlockPoolFor (buffSiz, typeID); Block& newBlock = blocks.createBlock(); - UNIMPLEMENTED ("Separate tasks into two distinct APIs"); -// return buildHandle (typeID, asBuffer(newBlock.accessMemory()), &newBlock); /////////////////////////////OOO instead return a tuple (buffer, localTag) + LocalTag specifics{&newBlock}; // used by this implementation to find the storage to release later + return * asBuffer(newBlock.accessMemory()); } @@ -320,7 +320,7 @@ namespace engine { /** mark a buffer as officially discarded */ void - HeapMemProvider::detachBuffer (size_t buffSiz, HashVal typeID, LocalTag const& specifics, Buff& storage) + HeapMemProvider::detachBuffer (size_t buffSiz, HashVal typeID, LocalTag specifics, Buff& storage) { Block* block4buffer = locateBlock (buffSiz, typeID, specifics); REQUIRE (block4buffer, "releasing a buffer not allocated through this provider"); diff --git a/src/steam/engine/heap-mem-buffer-store.hpp b/src/steam/engine/heap-mem-buffer-store.hpp index 148a47a8c..18272f24e 100644 --- a/src/steam/engine/heap-mem-buffer-store.hpp +++ b/src/steam/engine/heap-mem-buffer-store.hpp @@ -83,10 +83,10 @@ namespace engine { public: /* === BufferStore interface === */ - virtual uint prepareBuffers (uint cnt, size_t,HashVal typeID) override; - virtual BuffHandle provideBuffer (size_t,HashVal typeID) override; - virtual void mark_emitted (size_t,HashVal, LocalTag const&) override; - virtual void detachBuffer (size_t,HashVal, LocalTag const&, Buff&) override; + virtual uint prepareBuffers (uint cnt, size_t,HashVal typeID) override; + virtual Buff& provideBuffer (size_t,HashVal, LocalTag&) override; + virtual void mark_emitted (size_t,HashVal, LocalTag const&) override; + virtual void detachBuffer (size_t,HashVal, LocalTag, Buff&) override; public: ~HeapMemProvider(); diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index c76f0719b..bbee40bd1 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -111530,8 +111530,9 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + + @@ -111541,8 +111542,9 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + + @@ -111567,6 +111569,9 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) + + + @@ -111650,20 +111655,33 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + - - + + + + + + + +

+ zumal das nirgends im Code dokumentiert ist, und diese implizite Annahme nichts zum Begreifen beiträgt (da sich hier zwei Layer vermischen, und man Informationen durch den Implementierungs-Call durchfädeln muß) +

+ + +
+ +
- - + + - - + + @@ -111685,13 +111703,19 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + - + + + + + + + - - + + @@ -111753,7 +111777,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -111783,9 +111807,9 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + - + @@ -111817,6 +111841,9 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) + + + @@ -111829,8 +111856,8 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + @@ -111841,23 +111868,26 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - - + + - - - - + + + + + + + + - + - + @@ -111890,10 +111920,18 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + - + + + + + + + + + @@ -112252,7 +112290,9 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + + + @@ -112288,7 +112328,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -112304,6 +112344,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) + @@ -112629,8 +112670,25 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + + + + + + + + + + + +

+ auf dem BufferStore-API werden lediglich drei Aufrufe übrig bleiben. Von denen zudem zwei speziell sind. Und jede Implementierung wird lediglich dieses Tupel wieder auseinandernehmen... +

+ + +
+