Convert out-of-line metadata into inline metadata storage - #76
Open
mingxwa wants to merge 2 commits into
Open
Conversation
compact_facade_meta_traits holds metadata inline when it fits in a pointer and out of line otherwise, so two facades can differ in the storage their metadata lands in. Both storages converted only from a storage of their own kind, so a conversion from an out-of-line source to an inline destination did not exist. Give inplace_meta_storage a converting assignment from static_meta_storage that copies the converted metadata into itself, and define static_meta_storage first so that it can be named there. The reverse direction stays absent: static_meta_storage holds a pointer to the static metadata of a facade, and a metadata reached from an inline storage lives inside a proxy rather than in static storage. Remove the converting constructors of both storages and the copy members of inplace_meta_storage. No caller constructs one storage from another, and the copy members only restated what is implicitly declared, since a constructor template is never a copy constructor and an assignment template is never a copy assignment operator. Cover a substitution whose two facades land in different storages. On this branch the substitution translates the metadata through an indirect call and does not reach the new conversion, so the test passes either way. It is the case that starts exercising the conversion once a proxy carries metadata across facades directly.
The two converting assignments of inplace_meta_storage reached the base subobject with static_cast<M&>(*this) and assigned to the resulting lvalue. The only job of that cast was to name the base, and the qualified call M::operator= names it without a cast. The shape static_cast<X&>(*this) already means something else in this codebase. The cast accessor uses static_cast<const P&>(*this) to reach the pointer type from the accessor, a downcast, so reusing the shape for an upcast made a reader stop and work out the direction. Naming M also matches the using M::M above it, which already pulls in members of M by name. The two forms are equivalent. The implicitly declared copy assignment of proxy_meta hides the one in its base, so member lookup yields the same single candidate either way, and the conversion of the argument to const M& happens in the same place. A translation unit that forces both overloads to instantiate produces byte identical assembly under GCC 15.2 at -O2.
mingxwa
force-pushed
the
user/mingxwa/meta-storage-conversion
branch
from
September 9, 2026 23:24
c084afe to
138e861
Compare
guominrui
approved these changes
Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
inplace_meta_storagefromstatic_meta_storage, so metadata held out of line can be carried into a proxy whose own metadata is held inline.static_meta_storageahead ofinplace_meta_storage, which is what lets the new assignment name it.Resolves #75