Skip to content

Support recursive types#2415

Open
eboasson wants to merge 30 commits into
eclipse-cyclonedds:masterfrom
eboasson:recursive-types-devel
Open

Support recursive types#2415
eboasson wants to merge 30 commits into
eclipse-cyclonedds:masterfrom
eboasson:recursive-types-devel

Conversation

@eboasson

Copy link
Copy Markdown
Contributor

The title is the high-level summary. In detail, there are of course various small other matters (a tweak to .gitignore, some CMake stuff, etc.) that happened while working on this and that I couldn't be bothered to turn into separate commits.

eboasson and others added 30 commits June 12, 2026 17:54
Some generated files are committed in the repository, and for those the
generated file contains hashes of the exact input version so we can
ensure things stay in sync. In some cases it appended spaces, this
commit fixes that.
Load MurmurHash3 32-bit blocks via memcpy instead of casting arbitrary
byte input to uint32_t*. The public ddsrt_mh3 API accepts const void*
data with no alignment precondition, so callers may pass byte buffers
that are not 4-byte aligned.
Accept octet as the XML spelling for byte and report unknown non-basic
types instead of dereferencing a failed lookup.

Fix pre-existing sample layout calculations for int8, sequences, arrays,
external members, and union data alignment. Also fix loading multiple
XML type libraries and clean up parsed DOM trees, topic descriptors and
raw sample buffers once they are no longer needed.
Add a pause option for discovery-sensitive experiments and an option to
load and print the minimal TypeObject alongside the complete one.
Treat a final empty aggregate as FINAL when determining type
extensibility from the CDR stream descriptor, allowing empty top-level
structs without ADR/DLC/PLC instructions before RTS.

Reuse the member-id hash table while walking descriptor MID operations
and free duplicate MID records instead of leaking them.
Add a dedicated type-library trace category to the logging mask and
configuration tables, plus a local TYPELIB_TRACE helper for the
recursive type-library work.
Add recursive type-library support for strongly connected components,
including received-SCC graph validation, transactional SCC installation,
shared type-identifier identity helpers and hardened TypeLookup SCC
reply handling.
Add configuration plumbing for disabling recursive types.

When recursive dynamic type construction is rejected, abort partially
built unidentified graphs cleanly and preserve the public dynamic-type
error state.
Collect XML type declarations before materializing them, allowing struct
and union predeclarations and typedef aliases to participate in
recursive type graphs.

Teach the dynsub type cache, type printing, sample scanning, sample
printing, sample comparison and cleanup paths to follow SCC
TypeIdentifiers and recursive references.
Clean up rejected TypeObjects, failed type-info and type-map generation,
canonicalized dynamic-type graphs and SCC activation when recursive type
graphs are rejected or only partially resolved.

Hold TypeMap SCC members during import so components can refer to later
slots without duplicate slot creation or use-after-free during failed
cleanup.
Complete TypeObject import now copies type, collection and discriminator
annotations back into xt_type storage, matching the TypeObject generator
so regenerated complete TypeIdentifiers remain stable after import.

Also make annotation ownership symmetric in copy/fini paths, deep-copy
enum literal details for assignability temporaries, validate bitset
member flags, and classify/generate plain collection TypeIdentifiers
from their effective equivalence kind.
Reject invalid struct base chains, accept KeyHolder(T) for non-aggregate
union case member types, and return BAD_PARAMETER instead of aborting
when externally supplied TypeObjects cannot be encoded for hashing.
Gate fuzz target discovery only on LIB_FUZZING_ENGINE so local and
OSS-Fuzz-compatible builds can expose fuzzer targets without building
idlc.
This eliminates warnings from recent CMake versions.
Add generated assignability pairs and fix the fuzzer preconditions by
keeping synthetic generated graph nodes in PARTIAL_RESOLVED state so
validation still walks their nested hash references.
Build TypeInfo/TypeMap directly from validated generated type graphs,
mutate them through existing corruption hooks, and exercise
TypeInfo/TypeMap accessors and roundtrip fallback paths.
Extend the LPM type graph model with bitsets and annotation controls,
and exercise imported type accessors, TypeIdentifier/TypeObject helpers,
TypeInfo/TypeMap import paths and resolved typelib assignability.
Exercise collection TypeIdentifiers and collection TypeObjects directly,
bias generated TypeInfo/TypeMap roots toward DDS top-level types with
collection dependencies, and add focused invalid mutations for map keys,
collection headers and stale collection TypeIdentifier references.
Registering equivalent recursive dynamic types in a different order
could canonicalize a constructed type to an existing type-library entry
while copying a full XTypes graph over an entry that already had
one. For duplicate collection types this left an extra owned dependency
reference behind, which showed up as a non-empty type library at
shutdown. xmltype/dyntypelib exposed the ordering, but the bug is in the
core dynamic type/type-library lifecycle.

Only copy the constructed XTypes definition into an existing entry when
that entry is a missing-definition placeholder, and reset the
placeholder id to the canonical id computed during finalization. Add a
direct dynamic type regression that registers the duplicate recursive
sequence shape in the xmltype-exposed order.
If a char8 input is longer than 1 byte - assume user is trying to input char as an integer value
On behalf of test code on Windows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants