diff --git a/src/steam/engine/buffer-local-key.hpp b/src/steam/engine/buffer-local-key.hpp index c21c85af4..84c5513ce 100644 --- a/src/steam/engine/buffer-local-key.hpp +++ b/src/steam/engine/buffer-local-key.hpp @@ -50,12 +50,12 @@ namespace engine { /** - * an opaque ID to be used by the BufferProvider implementation. + * an opaque mark to be used by the BufferProvider implementation. * Typically this will be used, to set apart some pre-registered * kinds of buffers. It is treated as being part of the buffer type. - * LocalKey objects may be copied but not re-assigned or changed. + * LocalTag objects may be copied but not re-assigned or changed. */ - class LocalKey + class LocalTag { union OpaqueData { @@ -67,17 +67,19 @@ namespace engine { public: explicit - LocalKey (uint64_t opaqueValue=0) + LocalTag (uint64_t opaqueValue=0) { privateID_._as_number = opaqueValue; } - LocalKey (void* impl_related_ptr) + LocalTag (void* impl_related_ptr) { privateID_._as_number = 0; privateID_._as_pointer = impl_related_ptr; } + /** Marker when no distinct local key is given */ + static const LocalTag UNKNOWN; operator uint64_t() const { @@ -89,26 +91,26 @@ namespace engine { return privateID_._as_pointer; } - bool - isDefined() const + explicit + operator bool() const { return bool(privateID_._as_number); } friend size_t - hash_value (LocalKey const& lkey) + hash_value (LocalTag const& lkey) { boost::hash hashFunction; return hashFunction(lkey.privateID_._as_number); } friend bool - operator== (LocalKey const& left, LocalKey const& right) + operator== (LocalTag const& left, LocalTag const& right) { return uint64_t(left) == uint64_t(right); } friend bool - operator!= (LocalKey const& left, LocalKey const& right) + operator!= (LocalTag const& left, LocalTag const& right) { return uint64_t(left) != uint64_t(right); } @@ -116,7 +118,7 @@ namespace engine { private: /** assignment usually prohibited */ - LocalKey& operator= (LocalKey const& o) + LocalTag& operator= (LocalTag const& o) { privateID_ = o.privateID_; return *this; diff --git a/src/steam/engine/buffer-metadata.hpp b/src/steam/engine/buffer-metadata.hpp index b42097e63..484dbd6af 100644 --- a/src/steam/engine/buffer-metadata.hpp +++ b/src/steam/engine/buffer-metadata.hpp @@ -104,19 +104,16 @@ namespace engine { namespace { // internal constants to mark the default case - const LocalKey UNSPECIFIC; - const TypeHandler RAW_BUFFER; - inline bool nontrivial (TypeHandler const& toVerify) { - return RAW_BUFFER != toVerify; + return TypeHandler::RAW != toVerify; } inline bool - nontrivial (LocalKey const& toVerify) + nontrivial (LocalTag const& toVerify) { - return UNSPECIFIC != toVerify; + return LocalTag::UNKNOWN != toVerify; } } @@ -151,7 +148,7 @@ namespace engine { protected: size_t storageSize_; TypeHandler instanceFunc_; - LocalKey specifics_; + LocalTag specifics_; public: @@ -165,8 +162,8 @@ namespace engine { : parent_(familyID) , hashID_(chainedHash (familyID, storageSize)) , storageSize_(storageSize) - , instanceFunc_(RAW_BUFFER) - , specifics_(UNSPECIFIC) + , instanceFunc_(TypeHandler::RAW) + , specifics_(LocalTag::UNKNOWN) { } // standard copy operations permitted @@ -201,12 +198,12 @@ namespace engine { * Using a different private ID than the parent type, * all else remaining the same */ - Key (Key const& parent, LocalKey anotherTypeSpecificInternalID) + Key (Key const& parent, LocalTag anotherTypeSpecificInternalTag) : parent_(parent.hashID_) - , hashID_(chainedHash (parent_, anotherTypeSpecificInternalID)) + , hashID_(chainedHash (parent_, anotherTypeSpecificInternalTag)) , storageSize_(parent.storageSize_) , instanceFunc_(parent.instanceFunc_) - , specifics_(anotherTypeSpecificInternalID) // differing from parent + , specifics_(anotherTypeSpecificInternalTag) // differing from parent { } @@ -217,19 +214,19 @@ namespace engine { * For NULL buffer a copy of the parent is returned. */ static Key - forEntry (Key const& parent, const void* bufferAddr, LocalKey const& implID =UNSPECIFIC) + forEntry (Key const& parent, const void* bufferAddr, LocalTag const& localTag =LocalTag::UNKNOWN) { - Key newKey(parent); + Key newKey{parent}; // copy of parent as baseline if (bufferAddr) { newKey.parent_ = HashVal(parent); newKey.hashID_ = chainedHash(parent, bufferAddr); - if (nontrivial(implID)) + if (nontrivial(localTag)) { - REQUIRE (!newKey.specifics_.isDefined(), - "Implementation defined local key should not be overridden. " - "Underlying buffer type already defines a nontrivial LocalKey"); - newKey.specifics_ = implID; + if (nontrivial(parent.specifics_)) + throw error::Logic{"Implementation defined local key should not be overridden. " + "Underlying buffer type already defines a nontrivial LocalTag"}; + newKey.specifics_ = localTag; } } return newKey; } @@ -244,7 +241,7 @@ namespace engine { } - LocalKey const& localKey() const { return specifics_;} + LocalTag const& localTag() const { return specifics_;} size_t storageSize() const { return storageSize_; } HashVal parentKey() const { return parent_;} @@ -273,10 +270,13 @@ namespace engine { void* buffer_; protected: - Entry (Key const& parent, void* bufferPtr =0, LocalKey const& implID =UNSPECIFIC) - : Key (Key::forEntry (parent, bufferPtr, implID)) - , state_(bufferPtr? LOCKED:NIL) - , buffer_(bufferPtr) + Entry (Key const& parent + ,void* bufferPtr =nullptr + ,LocalTag const& specialTag =LocalTag::UNKNOWN + ) + : Key{Key::forEntry (parent, bufferPtr, specialTag)} + , state_{bufferPtr? LOCKED:NIL} + , buffer_{bufferPtr} { } /// BufferMetadata is allowed to create @@ -290,7 +290,7 @@ namespace engine { bool isLocked() const { - ASSERT (!buffer_ || (NIL != state_ && FREE != state_)); + ASSERT (!buffer_ or (NIL != state_ and FREE != state_)); return bool(buffer_); } @@ -300,7 +300,7 @@ namespace engine { bool isTypeKey() const { - return NIL == state_ && !buffer_; + return NIL == state_ and not buffer_; } @@ -326,13 +326,13 @@ namespace engine { { __must_not_be_NIL(); - if ( (state_ == FREE && newState == LOCKED) - ||(state_ == LOCKED && newState == EMITTED) - ||(state_ == LOCKED && newState == BLOCKED) - ||(state_ == LOCKED && newState == FREE) - ||(state_ == EMITTED && newState == BLOCKED) - ||(state_ == EMITTED && newState == FREE) - ||(state_ == BLOCKED && newState == FREE)) + if ( (state_ == FREE and newState == LOCKED) + or (state_ == LOCKED and newState == EMITTED) + or (state_ == LOCKED and newState == BLOCKED) + or (state_ == LOCKED and newState == FREE) + or (state_ == EMITTED and newState == BLOCKED) + or (state_ == EMITTED and newState == FREE) + or (state_ == BLOCKED and newState == FREE)) { // allowed transition if (newState == FREE) @@ -357,7 +357,7 @@ namespace engine { Entry& invalidate (bool invokeDtor =true) { - if (buffer_ && invokeDtor) + if (buffer_ and invokeDtor) invokeEmbeddedDtor_and_clear(); buffer_ = 0; state_ = FREE; @@ -546,8 +546,8 @@ namespace engine { ///////////////////////////TICKET #854 : ensure proper locking happens "somewhere" when mutating metadata public: - typedef metadata::Key Key; - typedef metadata::Entry Entry; + using Key = metadata::Key; + using Entry = metadata::Entry; /** establish a metadata registry. * Such will maintain a family of buffer type entries @@ -566,15 +566,15 @@ namespace engine { * from that point on. Properties are combined according to * a fixed type specialisation order, with the buffer size * forming the base level, possible TypeHandler functors the - * second level, and implementation defined LocalKey entries + * second level, and implementation defined LocalTag entries * the third level. All these levels describe abstract type * keys, not entries for concrete buffers. The latter are * always created as children of a known type key. */ Key key ( size_t storageSize - , TypeHandler instanceFunc =RAW_BUFFER - , LocalKey specifics =UNSPECIFIC) + , TypeHandler instanceFunc =TypeHandler::RAW + , LocalTag specifics =LocalTag::UNKNOWN) { REQUIRE (storageSize); Key typeKey = trackKey (family_, storageSize); @@ -598,7 +598,7 @@ namespace engine { /** create a sub-type, * using a different private-ID (implementation defined) */ Key - key (Key const& parentKey, LocalKey specifics) + key (Key const& parentKey, LocalTag specifics) { return trackKey (parentKey, specifics); } @@ -608,13 +608,13 @@ namespace engine { * @note might create/register a new Entry as a side-effect */ Key const& - key (Key const& parentKey, void* concreteBuffer, LocalKey const& implID =UNSPECIFIC) + key (Key const& parentKey, void* concreteBuffer, LocalTag const& specifics =LocalTag::UNKNOWN) { Key derivedKey = Key::forEntry (parentKey, concreteBuffer); Entry* existing = table_.fetch (derivedKey); return existing? *existing - : markLocked (parentKey,concreteBuffer,implID); + : markLocked (parentKey,concreteBuffer,specifics); } /** core operation to access or create a concrete buffer metadata entry. @@ -642,21 +642,21 @@ namespace engine { Entry& lock (Key const& parentKey ,void* concreteBuffer - ,LocalKey const& implID =UNSPECIFIC + ,LocalTag const& specifics =LocalTag::UNKNOWN ,bool onlyNew =false) { if (!concreteBuffer) throw error::Invalid{"Attempt to lock a slot for a NULL buffer" , LERR_(BOTTOM_VALUE)}; - Entry newEntry(parentKey, concreteBuffer, implID); + Entry newEntry{parentKey, concreteBuffer, specifics}; Entry* existing = table_.fetch (newEntry); - if (existing && onlyNew) + if (existing and onlyNew) throw error::Logic{"Attempt to lock a slot for a new buffer, " "while actually the old buffer is still locked" , LERR_(LIFECYCLE)}; - if (existing && existing->isLocked()) + if (existing and existing->isLocked()) throw error::Logic{"Attempt to re-lock a buffer still in use" , LERR_(LIFECYCLE)}; @@ -695,7 +695,7 @@ namespace engine { { const Entry* entry = table_.fetch (key); return entry - && entry->isLocked(); + and entry->isLocked(); } @@ -713,13 +713,13 @@ namespace engine { * created, but is marked as FREE */ Entry& - markLocked (Key const& parentKey, void* buffer, LocalKey const& implID =UNSPECIFIC) + markLocked (Key const& parentKey, void* buffer, LocalTag const& specifics =LocalTag::UNKNOWN) { if (!buffer) throw error::Fatal{"Attempt to lock for a NULL buffer. Allocation floundered?" , LERR_(BOTTOM_VALUE)}; - return this->lock(parentKey, buffer, implID, true); // force creation of a new entry + return this->lock (parentKey, buffer, specifics, true); // force creation of a new entry } /** purge the bare metadata Entry from the metadata tables. @@ -731,7 +731,7 @@ namespace engine { Entry* entry = table_.fetch (key); if (!entry) return; - ASSERT (entry && (key == HashVal(*entry))); + ASSERT (entry and (key == HashVal(*entry))); release (*entry); } @@ -787,6 +787,5 @@ namespace engine { - }} // namespace steam::engine -#endif +#endif /*STEAM_ENGINE_BUFFR_METADATA_H*/ diff --git a/src/steam/engine/buffer-provider.cpp b/src/steam/engine/buffer-provider.cpp index b714f903d..2c759e6a3 100644 --- a/src/steam/engine/buffer-provider.cpp +++ b/src/steam/engine/buffer-provider.cpp @@ -36,6 +36,10 @@ using util::isSameObject; namespace steam { namespace engine { + // storage for the default-marker constants + const TypeHandler TypeHandler::RAW{}; + const LocalTag LocalTag::UNKNOWN{}; + namespace { // impl. details and definitions @@ -98,10 +102,10 @@ namespace engine { * actual buffer, which is locked for exclusive use by one client. */ BuffHandle - BufferProvider::buildHandle (HashVal typeID, void* storage, LocalKey const& implID) + BufferProvider::buildHandle (HashVal typeID, void* storage, LocalTag const& localTag) { metadata::Key& typeKey = meta_->get (typeID); - metadata::Entry& entry = meta_->markLocked(typeKey, storage, implID); + metadata::Entry& entry = meta_->markLocked(typeKey, storage, localTag); return BuffHandle (BuffDescr(*this, entry), storage); } @@ -167,7 +171,7 @@ namespace engine { BufferProvider::emitBuffer (BuffHandle const& handle) { metadata::Entry& metaEntry = meta_->get (handle.entryID()); - mark_emitted (metaEntry.parentKey(), metaEntry.localKey()); + mark_emitted (metaEntry.parentKey(), metaEntry.localTag()); metaEntry.mark(EMITTED); } @@ -185,7 +189,7 @@ namespace engine { try { metadata::Entry& metaEntry = meta_->get (handle.entryID()); metaEntry.mark(FREE); // might invoke embedded dtor function - detachBuffer (metaEntry.parentKey(), metaEntry.localKey()); + detachBuffer (metaEntry.parentKey(), metaEntry.localTag()); meta_->release (metaEntry); } ERROR_LOG_AND_IGNORE (engine, "releasing a buffer from BufferProvider") @@ -229,7 +233,7 @@ namespace engine { try { metadata::Entry& metaEntry = meta_->get (target.entryID()); metaEntry.invalidate (invokeDtor); - detachBuffer (metaEntry.parentKey(), metaEntry.localKey()); + detachBuffer (metaEntry.parentKey(), metaEntry.localTag()); meta_->release (metaEntry); } ERROR_LOG_AND_IGNORE (engine, "cleanup of buffer metadata while handling an error") diff --git a/src/steam/engine/buffer-provider.hpp b/src/steam/engine/buffer-provider.hpp index d365b9819..be0ced686 100644 --- a/src/steam/engine/buffer-provider.hpp +++ b/src/steam/engine/buffer-provider.hpp @@ -73,7 +73,7 @@ namespace engine { * The pointer to actual buffer storage can be retrieved by * - optionally announcing the required buffer(s) beforehand * - "locking" a buffer to yield a buffer handle - * - dereferencing this smart-handle class + * - then dereferencing the obtained smart-handle * * @warning all of BufferProvider is assumed to run within a threadsafe environment. * @@ -93,8 +93,8 @@ namespace engine { virtual uint prepareBuffers (uint count, HashVal typeID) =0; virtual BuffHandle provideLockedBuffer (HashVal typeID) =0; - virtual void mark_emitted (HashVal typeID, LocalKey const&) =0; - virtual void detachBuffer (HashVal typeID, LocalKey const&) =0; + virtual void mark_emitted (HashVal typeID, LocalTag const&) =0; + virtual void detachBuffer (HashVal typeID, LocalTag const&) =0; public: @@ -131,7 +131,7 @@ namespace engine { size_t getBufferSize (HashVal typeID) const; protected: - BuffHandle buildHandle (HashVal typeID, void* storage, LocalKey const&); + BuffHandle buildHandle (HashVal typeID, void* storage, LocalTag const& =LocalTag::UNKNOWN); bool was_created_by_this_provider (BuffDescr const&) const; }; diff --git a/src/steam/engine/buffhandle-attach.hpp b/src/steam/engine/buffhandle-attach.hpp index 805eda284..a6f9d6f44 100644 --- a/src/steam/engine/buffhandle-attach.hpp +++ b/src/steam/engine/buffhandle-attach.hpp @@ -111,7 +111,7 @@ namespace engine { /** convenience shortcut: access the buffer contents casted to a specific type. * @warning this is a \em blind cast, there is no type safety. - * @note clients can utilise the metadata::LocalKey to keep track of some + * @note clients can utilise the metadata::LocalTag to keep track of some * specific property of the buffer, like e.g. the type of object. */ template diff --git a/src/steam/engine/tracking-heap-block-provider.cpp b/src/steam/engine/tracking-heap-block-provider.cpp index eca0e0d4b..8bc7137b5 100644 --- a/src/steam/engine/tracking-heap-block-provider.cpp +++ b/src/steam/engine/tracking-heap-block-provider.cpp @@ -252,9 +252,9 @@ namespace engine { void - TrackingHeapBlockProvider::mark_emitted (HashVal typeID, LocalKey const& implID) + TrackingHeapBlockProvider::mark_emitted (HashVal typeID, LocalTag const& specifics) { - diagn::Block* block4buffer = locateBlock (typeID, implID); + diagn::Block* block4buffer = locateBlock (typeID, specifics); if (!block4buffer) throw error::Logic ("Attempt to emit a buffer not known to this BufferProvider" , LUMIERA_ERROR_BUFFER_MANAGEMENT); @@ -265,9 +265,9 @@ namespace engine { /** mark a buffer as officially discarded */ void - TrackingHeapBlockProvider::detachBuffer (HashVal typeID, LocalKey const& implID) + TrackingHeapBlockProvider::detachBuffer (HashVal typeID, LocalTag const& specifics) { - diagn::Block* block4buffer = locateBlock (typeID, implID); + diagn::Block* block4buffer = locateBlock (typeID, specifics); REQUIRE (block4buffer, "releasing a buffer not allocated through this provider"); block4buffer->markReleased(); } diff --git a/src/steam/engine/tracking-heap-block-provider.hpp b/src/steam/engine/tracking-heap-block-provider.hpp index 9d40fa822..f0e30671b 100644 --- a/src/steam/engine/tracking-heap-block-provider.hpp +++ b/src/steam/engine/tracking-heap-block-provider.hpp @@ -28,7 +28,7 @@ ** the fact. ** ** The allocated buffers are numbered with a simple ascending sequence of integers, - ** used as LocalKey (see BufferMetadata). Clients can just request a Buffer with the + ** used as LocalTag (see BufferMetadata). Clients can just request a Buffer with the ** given number, causing that block to be allocated. There is a "backdoor", allowing ** to access any allocated block, even if it is considered "released" by the terms ** of the usual lifecycle. Only when the provider object itself gets destroyed, @@ -136,8 +136,8 @@ namespace engine { virtual uint prepareBuffers (uint count, HashVal typeID); virtual BuffHandle provideLockedBuffer (HashVal typeID); - virtual void mark_emitted (HashVal entryID, LocalKey const&); - virtual void detachBuffer (HashVal entryID, LocalKey const&); + virtual void mark_emitted (HashVal entryID, LocalTag const&); + virtual void detachBuffer (HashVal entryID, LocalTag const&); public: TrackingHeapBlockProvider(); diff --git a/src/steam/engine/type-handler.hpp b/src/steam/engine/type-handler.hpp index 455e288d5..7d516a763 100644 --- a/src/steam/engine/type-handler.hpp +++ b/src/steam/engine/type-handler.hpp @@ -118,6 +118,9 @@ namespace engine { DoInBuffer destroyAttached; HashVal identity; + /** Marker for the default case: raw buffer without type handling */ + static const TypeHandler RAW; + /** build an invalid NIL TypeHandler */ TypeHandler() : createAttached() diff --git a/tests/core/steam/engine/buffer-metadata-key-test.cpp b/tests/core/steam/engine/buffer-metadata-key-test.cpp index 230ad3f3a..d55cb5efb 100644 --- a/tests/core/steam/engine/buffer-metadata-key-test.cpp +++ b/tests/core/steam/engine/buffer-metadata-key-test.cpp @@ -120,7 +120,7 @@ namespace test { { size_t const& investigateSize() const { return this->storageSize_; } TypeHandler const& investigateHandler() const { return this->instanceFunc_; } - LocalKey const& investigateSpecifics() const { return this->specifics_; } + LocalTag const& investigateSpecifics() const { return this->specifics_; } KeyTypeSpecialisationDiagnostics (Key const& toInvestigate) : Key(toInvestigate) @@ -140,7 +140,7 @@ namespace test { return KeyTypeSpecialisationDiagnostics(subject).investigateHandler(); } - inline const LocalKey + inline const LocalTag verifySpecifics (Key const& subject) { return KeyTypeSpecialisationDiagnostics(subject).investigateSpecifics(); @@ -191,7 +191,7 @@ namespace test { HashVal family(123); Key k1(family, SIZE_A); Key k12(k1, SIZE_B); - Key k123(k12, LocalKey(56)); + Key k123(k12, LocalTag(56)); CHECK (HashVal (k1)); CHECK (HashVal (k12)); @@ -257,8 +257,8 @@ namespace test { TypeHandler placeMarker = TypeHandler::create(); TypeHandler noHandler; - LocalKey opaque1 (rand() % 1000); - LocalKey opaque2 (1000 + rand() % 1000); + LocalTag opaque1 (rand() % 1000); + LocalTag opaque2 (1000 + rand() % 1000); Key k_siz (kb, SIZE_B); // sub-key to "root": use a different buffer size Key k_han0(kb, noHandler); // sub-key to "root": use a locally defined type functor @@ -305,19 +305,19 @@ namespace test { CHECK (SIZE_A == verifySize(k_loc1)); CHECK (SIZE_A == verifySize(k_loc2)); - CHECK (RAW_BUFFER == verifyHandler(kb )); - CHECK (RAW_BUFFER == verifyHandler(k_siz )); - CHECK (noHandler == verifyHandler(k_han0)); - CHECK (placeMarker == verifyHandler(k_han1)); - CHECK (RAW_BUFFER == verifyHandler(k_loc1)); - CHECK (RAW_BUFFER == verifyHandler(k_loc2)); + CHECK (TypeHandler::RAW == verifyHandler(kb )); + CHECK (TypeHandler::RAW == verifyHandler(k_siz )); + CHECK ( noHandler == verifyHandler(k_han0)); + CHECK ( placeMarker == verifyHandler(k_han1)); + CHECK (TypeHandler::RAW == verifyHandler(k_loc1)); + CHECK (TypeHandler::RAW == verifyHandler(k_loc2)); - CHECK (UNSPECIFIC == verifySpecifics(kb )); - CHECK (UNSPECIFIC == verifySpecifics(k_siz )); - CHECK (UNSPECIFIC == verifySpecifics(k_han0)); - CHECK (UNSPECIFIC == verifySpecifics(k_han1)); - CHECK (opaque1 == verifySpecifics(k_loc1)); - CHECK (opaque2 == verifySpecifics(k_loc2)); + CHECK (LocalTag::UNKNOWN == verifySpecifics(kb )); + CHECK (LocalTag::UNKNOWN == verifySpecifics(k_siz )); + CHECK (LocalTag::UNKNOWN == verifySpecifics(k_han0)); + CHECK (LocalTag::UNKNOWN == verifySpecifics(k_han1)); + CHECK ( opaque1 == verifySpecifics(k_loc1)); + CHECK ( opaque2 == verifySpecifics(k_loc2)); // Verify 2nd level specialisation (some examples) @@ -338,8 +338,8 @@ namespace test { CHECK (placeMarker == verifyHandler(k_han1_siz_loc2)); CHECK (placeMarker == verifyHandler(k_loc2_han1_siz)); - CHECK (UNSPECIFIC == verifySpecifics(k_han1_siz )); - CHECK (UNSPECIFIC == verifySpecifics(k_siz_han1 )); + CHECK (LocalTag::UNKNOWN == verifySpecifics(k_han1_siz )); + CHECK (LocalTag::UNKNOWN == verifySpecifics(k_siz_han1 )); CHECK (opaque2 == verifySpecifics(k_han1_siz_loc2)); CHECK (opaque2 == verifySpecifics(k_loc2_han1_siz)); diff --git a/tests/core/steam/engine/buffer-metadata-test.cpp b/tests/core/steam/engine/buffer-metadata-test.cpp index 5ff7ffff7..52cb796be 100644 --- a/tests/core/steam/engine/buffer-metadata-test.cpp +++ b/tests/core/steam/engine/buffer-metadata-test.cpp @@ -193,7 +193,7 @@ namespace test { * BufferProviderProtocol_test#verifyStandardCase() * This testcase here performs precisely the metadata related * operations necessary to carry out the standard case - * outlined on a higher level in the mentioned test. + * outlined at a higher level in the aforementioned test. */ void verifyStandardCase() @@ -206,8 +206,8 @@ namespace test { metadata::Key rawBuffType = meta_->key(SIZE_B); // to announce using a number of buffers of this type - LocalKey transaction1(1); - LocalKey transaction2(2); + LocalTag transaction1(1); + LocalTag transaction2(2); bufferType1 = meta_->key(bufferType1, transaction1); rawBuffType = meta_->key(rawBuffType, transaction2); // these type keys are now handed over to the client, @@ -235,11 +235,11 @@ namespace test { CHECK (LOCKED == r0.state()); CHECK (LOCKED == r1.state()); - CHECK (transaction1 == f0.localKey()); - CHECK (transaction1 == f1.localKey()); - CHECK (transaction1 == f2.localKey()); - CHECK (transaction2 == r0.localKey()); - CHECK (transaction2 == r1.localKey()); + CHECK (transaction1 == f0.localTag()); + CHECK (transaction1 == f1.localTag()); + CHECK (transaction1 == f2.localTag()); + CHECK (transaction2 == r0.localTag()); + CHECK (transaction2 == r1.localTag()); CHECK (f0.access() == frames+0); diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 39a5785c6..f10810761 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -4369,9 +4369,7 @@ - - - +

....das ist schon mehr ein Meta-Ticket, @@ -4442,9 +4440,7 @@ - - - +

das Lock sorgt hier für konsistenten Zustand und Sichtbarkeit (memory barrier) @@ -4454,9 +4450,7 @@ - - - +

Lock ist hier das Dispatcher-Lock @@ -5092,9 +5086,7 @@ - - - +

8/2018 there is some overlap with the (not yet fully functional)  @@ -5825,9 +5817,7 @@ - - - +

TestControl Dialogbox @@ -7555,9 +7545,7 @@ - - - +

...der beim Erstellen des Elements @@ -10053,9 +10041,7 @@ - - - +

wir hatten bisher eine auto-Aufräum-Routine in iterNext(), @@ -13742,9 +13728,7 @@ - - - +

bleibt dem Charakter nach imperativ @@ -52706,9 +52690,7 @@ - - - +

aber: Parametrisierung könnte partiell sein @@ -52757,9 +52739,7 @@ - - - +

sie wird nicht zum Parameter-Sammeln verwendet @@ -52774,9 +52754,7 @@ - - - +

...eine Instanz wird dann erzeugt, wenn sie notwendig wird. @@ -80753,6 +80731,13 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + @@ -88404,8 +88389,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
was bis jetzt feststeht: dem Weaving-Pattern werden BufferDescriptors gegeben

- -
+
@@ -88416,8 +88400,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
Begründung: der Aufrufer legt das zusammen mit der konkreten Funktion fest

- - + @@ -88425,8 +88408,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
Der Aufrufer ist Code im Kontext der Domain-Ontology, und nur von dort kann bekannt sein, was die eingebundene Funktion konkret auf jedem »output slot« liefert

- -
+
@@ -88436,8 +88418,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
Einschränkung: der Aufrufer kennt den benötigten Typ des Buffers

- -
+ @@ -88481,8 +88462,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
heißt konkret, ein BufferProdiver könnte einen BufferDescriptor eines anderen Providers übernehmen und re-interpretieren

- - +
@@ -88537,8 +88517,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
  BufferProvider::getDescriptor (ARGS  ...args)

- - + @@ -88561,8 +88540,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
⟹ das müßte dann in den shed()-Aufruf gehen

- - +
@@ -88582,8 +88560,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
...im aktuellen Stand brauchen wir die Info nur während dem Build-Vorgang; sobald man aber später übergeht zu einem ctor-λ, müßte man die Info in die Node (in den Turnout) materialisieren. Nun könnte man aktuell „einfach“ einen std::vector nehmen — oder aber, genauso „einfach“ einen weiteren SeveralBuilder mitlaufen lassen. Vorteil: der Speicher liegt im AllocationCluster / Nachteil: der Speicher wird verschwendet

- - + @@ -88648,6 +88625,213 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + +

+ im Codepfad des konkreten Aufrufs erfolgt ein lockBuffer() — und dieser muß exakt den Ausgabe-Puffer für diesen Aufruf liefern +

+ +
+
+ + + + + + +

+ heißt: wir vergeben diese nulläre Optimierung und legen fest, daß das Ergebnis einfach in einem Buffer im Arbeitsspeicher liegt. Jeder Render-Job bekommt dann einen explizit gecodeten Kopier-Schritt +

+ + +
+
+ + + + +

+ das müßte eine Marke sein, die die spezielle BufferProvider-Implementierung — also der OutputBufferProvider — erkennt und daraufhin den konkreten extrnen Output-Buffer herausgibt +

+ + +
+ +
+ + + + +

+ Das würde bedeuten, eine spezielle Ausnahme in die shed()-Funktion einzubauen, um das lockBuffer() fürden tatsächlichen »output-slot« zu unterdrücken und stattdessen hier einen aus dem Kontext bezogenen Buffer einzusetzen. Im Gegenzug würde der Rückgabewert wegfallen und das Ergebnis würde stattdessen per Seiteneffekt herausgeführt. +

+ +
+
+ + + + +

+ Diese Annahme kann man ziemlich sicher machen; eine Abweichung davon wäre nur möglich bei einem ziemlich speziellen Setup, bei dem dann setets mehrere Ergebnise auf verschiedenen Ebenen aber im gleichen Rechenprozeß anfallen +

+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ dieser assoziiert den Buffer-Header als LocalTag +

+ +
+
+ + + + + +

+ ...dieser eigentliche Buffer kann auch nochmal per TypeHandler einen »Inlay-Type« bekommen; aber hier beim TrackingHeapBlockProvider ist ja der entscheidenden Punkt, jede Allokation nochmal sekundär zu verzeichnen und nachzuverfolgen, um entsprechende Verifikationen in den Tests zu ermöglichen +

+ + +
+
+
+ + + + +

+ siehe Key::forEntry +

+

+ Das heißt, entweder man setzt ihn schon beim BufferDescriptor, oder man setzt ihn erst mit dem sub-Entry für den konkreten Buffer beim lock() — aber beides zusammen ist nicht erlaubt +

+ +
+ +
+
+ + + + + + + + + +

+ deshalb habe ich genau für diesen Zweck bereits einen Mechanismus geschaffen +

+ + +
+
+ + + + +

+ dieses LocalTag ist aber nicht überall auf das Buffer-Provider-API herausgeführt +

+ + +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + +

+ im Besonderen an die Reihenfolge denken ... mir fällt auf, daß ich chainedHash  verwende; damit wäre der Hash-Key pfadabhängig +

+ + +
+ +
+
+ + + + + + + + + + + + + + +

+ nebenbei: umbenennen ⟶ LocalTag +

+ +
+ +
+
+
+
+
+
@@ -88956,7 +89140,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + +