Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,45 @@ migration), *Added*, *Changed*, *Fixed*, *Performance*, and *Documentation and t

### Breaking changes

- `MappedMemorySource.Read` (`IMemorySource.Read`) now returns a positive short count at a mapping boundary instead
of filling the whole destination from successive mappings. Migration: callers that invoke `Read` directly must
continue from the returned count, or use `MemoryRegion.ReadExactly` or `ReadPartial`, which assemble complete
transfers. Bytes from completed mappings stay confirmed when a later mapping or backing extent is missing,
including through nested mappings, and failures keep their original coordinates.
- `StructValue.Add`, `ContainsKey`, `Remove` and `TryGetValue` name their first parameter `key`, matching the
dictionary interfaces they implement and `UnionValue`. Migration: callers that pass it as a named argument write
`key:` instead of `name:`; positional calls are unchanged.

### Added

- Import native ISF 6.1.0 documents alongside 6.2.0 without changing their declared version.
- Preserve flattened native member aliases. Only members whose physical bits overlap are grouped into a generated
union, held by a promoted `__overlay_{offset}` member, so every original member path still resolves and unrelated
members keep struct semantics. A whole-value write supplies each group as a `UnionValue`. Native descriptions keep
their original kind and fields. Ordinary struct validation remains strict.
- Prepare native MSF 7/CodeView V70 and V80 Windows PDB metadata as deterministic ISF 6.2.0 with `PdbMetadata`, without
a debugger or network dependency. Selected stream reads and per-table record limits bound loading; `WriteIsf` has its
own `maxTraversalSteps` limit. Public/global/file-local image-relative addresses, absolute symbol values, both native
age fields and ambiguous type identities stay distinct; file-local names with several addresses are reported in
`Diagnostics` instead of being exported. C++ classes export their instance members and skip methods, base classes,
nested types, static members and vtable entries. A PDB without a symbol stream still provides its types.
- `PdbMetadata` reads pointer storage from CodeView itself: explicit 32-bit and 64-bit pointers keep their own widths
(also when legacy records omit the size bits), and the ISF `pointer` base records the target machine's width. When
the DBI machine is zero, construction requires an explicit `targetMachine`; `Machine` keeps the original value and
a nonzero original machine cannot be overridden.
- Keep every original complete type when a forward declaration has several same-extent definitions. Prepared metadata
exposes an explicit union of those views instead of silently selecting a definition by its display name.
- The Inspector recognizes Apple Core Audio Format (`.caf`) and DSDIFF (`.dff`) files, newly detected by `file-type`
22.3.0, and shows each file header with its required first chunk (`desc` and `FVER`).

### Fixed

- Honor an ISF pointer's explicit integer storage base independently of the default target pointer width, including
that base's byte order. Native and WOW64 representations can coexist in one schema and in field-directed imports
without widening, truncating or byte-swapping stored addresses.
- `CachedMemorySource` stores positive short reads with their confirmed count, so repeated transfers that cross a
mapped boundary are answered from the cache. Eviction releases the bytes each entry actually retained.

### Documentation and tooling

- Update build, test, documentation, benchmark and app dependencies to their latest compatible releases, including
Expand Down
52 changes: 52 additions & 0 deletions PERFORMANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,55 @@ The 16-byte text comparison includes raw ownership, ASCII decoding and all NUL c
The recorded campaign retains library-samples.jsonl (48 cases, 480 measured samples plus 96 warmup samples), text-samples.jsonl (20 measured samples plus four warmups), immutable-manifest.json and summary JSON files. The reproduction guide generates new samples without requiring that local archive. Read-set output memory is bounded by its prepared envelope; matching scratch is pooled and operation-local. Unknown-input coverage, gap recovery, final unsigned addresses and cancellation are correctness tests, not timing claims.

The repository-wide Impact screen and targeted SerializeScalar confirmation retained unstable/canary warnings. Those results are inconclusive and establish neither improvement nor equivalence. Reports remain under artifacts/perf/development/runs/2026-10-28T13-23-03-743Z-babed2 and 2026-10-28T13-25-11-044Z-83f8d1. Client complete-operation findings, rejected indexes/shared filters, sparse coverage and cancellation are in the client's PERFORMANCE.md.

## Native ISF compatibility controls (4 November 2026)

Windows x64, Ryzen 9 9950X, SDK 10.0.403/runtime 10.0.14, hyperfine 1.20.0.
The reference assembly is the immutable `windows-isf-before` bundle from clean revision
`334bb8990138cdb5071e187d4312a822a3036fc5`; the candidate contains native 6.1.0 acceptance and alias-view import.
Both run the same independently authored, nonoverlapping 6.2.0 control: a 16-byte record with a `uint32` and
a recursive eight-byte pointer. Each process warms 16 imports, then performs 1,000 fresh parse/import/selected-read
operations and verifies every result, with checksum 42,000. The allocation counter covers those 1,000 operations,
not startup or output. Process timings include startup and warmup.

One process warmup precedes five measured processes in each before-JIT, after-JIT, before-AOT and after-AOT group.
Default tiering/PGO and OS caching are retained; affinity is unrestricted. No owned build, test, UI or source edit
overlaps timing. Allocation values are single observed counter samples, not an allocation distribution.

| Build | Mean ms | Standard deviation ms | Minimum–maximum ms | Allocated B / 1,000 operations |
| --- | ---: | ---: | ---: | ---: |
| Reference JIT | 165.54 | 1.88 | 163.40–168.05 | 39,340,496 |
| Candidate JIT | 165.63 | 3.34 | 161.35–169.62 | 39,180,496 |
| Reference Native AOT | 32.78 | 4.33 | 29.43–39.42 | 39,452,000 |
| Candidate Native AOT | 29.27 | 1.09 | 28.43–31.17 | 39,290,952 |

Hyperfine reported statistical outliers. Ranges overlap; these controls establish neither a speed improvement nor
equivalence, and do not isolate the allocation difference. Native 6.1.0/overlaid imports had no successful reference
implementation, so their new functionality is verified separately rather than compared with a failing baseline.
All four publications emitted no IL diagnostics. The ignored local qualification payloads and raw samples are
`artifacts/qualification/windows-isf-perf/` and the client's `dist/windows-isf-control-performance.json`.


## Portable native PDB preparation (4 November 2026)

Windows x64, Ryzen 9 9950X, SDK 10.0.403/runtime 10.0.14, hyperfine 1.20.0.
The ignored native-PDB consumer reads an explicitly acquired 8,571,904-byte Microsoft PDB,
writes deterministic ISF, strictly imports seven native/WOW64 roots, then decodes and
round-trips a complete independently exported 2,624-byte captured record. Timings include
startup, selected metadata reads, output, imports and complete byte verification. Neither
the original input nor recovered record values are stored in this repository.

One process warmup precedes five measured fresh processes in each JIT and Native AOT group.
Default tiering/PGO and OS caching remain enabled; affinity is unrestricted. No owned build,
test or UI job overlaps timing.

| Runtime | Mean ms | Standard deviation ms | Minimum–maximum ms |
| --- | ---: | ---: | ---: |
| Release JIT | 315.18 | 7.76 | 308.70–324.77 |
| Native AOT | 69.53 | 5.37 | 66.43–79.10 |

These are feature costs, not a before/after optimization or allocation comparison.
Hyperfine flags an AOT outlier; the original samples remain intact. The native publication
emits no IL diagnostics. Qualification source and payloads are under the ignored
`artifacts/qualification/native-pdb/` and `artifacts/qualification/native-pdb-aot/`;
raw timing samples are in the client's `dist/windows-native-pdb-performance.json`.
4 changes: 2 additions & 2 deletions apps/explorer/tests/catalog-baseline.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"totalTests": 2288,
"totalTests": 2330,
"runnableTests": 160,
"testInputsSha256": "69cc2d873d740eb06c328d74dbba00ae55dfbdee3c39562da3ed324974f1e4d9",
"testInputsSha256": "bacbaaf6c87c4e5586b493e30e1654d75a772cf2e80a1997cab900bc96a41d65",
"lessonIds": [
"header",
"header-serialize",
Expand Down
17 changes: 17 additions & 0 deletions contracts/api/managed/CStructSharp.public-api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1287,6 +1287,23 @@ namespace CStructSharp.Memory.Metadata
public CStructSharp.Memory.MemorySchema Schema { get; init; }
public System.Collections.Generic.IReadOnlyList<string>? SelectedPaths { get; }
}
public sealed class PdbMetadata
{
public PdbMetadata(System.IO.Stream input, int maxMetadataBytes = 67108864, int maxRecords = 1000000, System.Threading.CancellationToken cancellationToken = default, ushort? targetMachine = default) { }
public System.Collections.Generic.IReadOnlyDictionary<string, ulong> AbsoluteSymbols { get; }
public uint DbiAge { get; }
public System.Collections.Generic.IReadOnlyList<string> Diagnostics { get; }
public System.Guid Guid { get; }
public uint InformationAge { get; }
public ushort Machine { get; }
public int PointerSize { get; }
public System.Collections.Generic.IReadOnlyDictionary<ushort, int> SymbolRecordKinds { get; }
public System.Collections.Generic.IReadOnlyDictionary<string, ulong> Symbols { get; }
public ushort TargetMachine { get; }
public int UnmappedSymbolCount { get; }
public System.Collections.Generic.IReadOnlyList<string> UserTypeNames { get; }
public void WriteIsf(System.IO.Stream output, string pdbName, long maxTraversalSteps = 100000000, System.Threading.CancellationToken cancellationToken = default) { }
}
}
namespace CStructSharp.Values
{
Expand Down
26 changes: 16 additions & 10 deletions contracts/api/managed/manifest.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
{
"schemaVersion": 1,
"baselineId": "managed",
"baselineRevision": 75,
"baselineRevision": 76,
"packageVersion": "0.18.0",
"assembly": "CStructSharp.dll",
"exportedTypes": 123,
"exportedTypes": 124,
"generator": {
"package": "PublicApiGenerator.Tool",
"version": "11.5.4",
"command": "generate-public-api"
},
"canonical": {
"path": "contracts/api/managed/CStructSharp.public-api.txt",
"lines": 1413,
"normalizedSha256": "C334414B441F5637211CEED1915C04CB8EB0564C0345F1B5185253E9119A5461"
"lines": 1430,
"normalizedSha256": "9822F28D7857C63B6B31660EF84CD79A66A8860DD41262722073E49E0FBFAE2F"
},
"frameworks": [
{
"tfm": "net8.0",
"targetFramework": ".NETCoreApp,Version=v8.0",
"frameworkDisplayName": ".NET 8.0",
"normalizedSha256": "49064DC87A53B52E0FAF9344CBCA55DDE26A9725D2983B5C7F8466BE357B75D9",
"normalizedSha256": "45F04E06D18DB365124E000593C00D790D5E4162C7D726BB0C16C7D09C5E4630",
"aotCompatible": false
},
{
"tfm": "net10.0",
"targetFramework": ".NETCoreApp,Version=v10.0",
"frameworkDisplayName": ".NET 10.0",
"normalizedSha256": "A45655BD92BBA4C5D1A93A8FE0077C91CC7C89EF94EE6E77C0BAFCAFF6ED413A",
"normalizedSha256": "E6C79AF222633D271885E4090D4B7BC1BFC585EE431B59BE8324EBAA83C36981",
"aotCompatible": true
}
],
Expand Down Expand Up @@ -478,12 +478,18 @@
},
{
"revision": 75,
"kind": "breaking",
"date": "2026-11-16",
"packageVersion": "0.18.0",
"combinedSha256": "5B21A03B4C63AB91716225141B90F2F074DFC76CC177D594FAFF53DEC3CC35FF",
"rationale": "StyleCop.Analyzers 1.3 enforces SA1315: StructValue's IDictionary/IReadOnlyDictionary implementations now use the inherited parameter name key, matching UnionValue.",
"releaseImpact": "Callers that pass these StructValue arguments by name (name:) must use key: instead; positional calls are unaffected."
"combinedSha256": "5B21A03B4C63AB91716225141B90F2F074DFC76CC177D594FAFF53DEC3CC35FF"
},
{
"revision": 76,
"kind": "additive",
"date": "2026-11-16",
"packageVersion": "0.18.0",
"combinedSha256": "C11023D63BF06FE730F563B95E6AA5331B09F8B2955593EF180077013D95B293",
"rationale": "Memory metadata preparation: PdbMetadata reads MSF 7/CodeView PDB metadata (with an explicit targetMachine when the DBI machine is zero) and writes ISF 6.2.0 through WriteIsf with a maxTraversalSteps export limit.",
"releaseImpact": "No released API changes; PdbMetadata is new."
}
]
}
4 changes: 2 additions & 2 deletions contracts/memory/v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{ "kind": "RawBytes", "read": "raw byte[] of the declared size", "inspect": true, "resolve": "whole value only; no members", "serialize": "exact-size raw byte[]", "plan-update": "raw bytes", "commit": "requires writable backing", "select": true, "bind": false, "read-exact": "finite region operation, independent of type", "read-array": false }
],
"failureRules": ["never zero-fill holes", "checked unsigned extent arithmetic", "cancellation propagates", "budgets shared across nested operations", "no ownership transfer", "source changes invalidate cached bytes", "patch expectations prevalidated", "commit failure identifies completed prefix and uncertain fragment", "no atomicity or rollback promise", "MemoryAccessException is a CStructReadException: ReadLimitExceeded for BudgetExceeded, otherwise ReadFailed", "source coordinates are null when a failure has no source address", "path errors are CStructPathException, value errors CStructWriteException, definition and metadata errors CStructLayoutException", "MemoryPatchCommitException is a CStructWriteException", "parameter-contract violations, read-only sources, and cancellation keep .NET exception types"],
"metadata": { "btf": "v1 reachable or field-directed value types and split tables; no ELF extraction", "isf": "6.2.0 reachable or field-directed type subsets; shallow user-type descriptions; document-owned bounded successful scalar compilation; no profile matching or relocations", "portable": "fixed compiled layouts only" },
"metadata": { "btf": "v1 reachable or field-directed value types and split tables; no ELF extraction", "isf": "6.1.0 and 6.2.0 reachable or field-directed type subsets; members with overlapping physical bits are grouped into promoted generated unions while every original path resolves; explicit integer pointer storage retains its own width and byte order; shallow descriptions retain native kind; document-owned bounded successful scalar compilation; no profile matching or relocations", "pdb": "MSF 7 / CodeView V70 and V80 headers with supported explicit storage; offline ISF preparation from selected metadata streams; zero pointer size bits retain near32/near64 widths; unknown DBI machine requires explicit targetMachine while Machine and exported machine_type preserve the original zero; nonzero machine contradictions reject; original information/DBI ages, public/global RVAs, absolute values and ambiguous type identities remain distinct; file-local names with several coordinates are omitted with diagnostics; a missing symbol stream yields empty symbol tables; C++ field lists export instance members only; maxRecords bounds input tables while WriteIsf maxTraversalSteps bounds export work; cancellation; no capture opening or network acquisition", "portable": "fixed compiled layouts only" },
"projection": { "paths": "explicit member/index/pointer paths; terminal composites and arrays include by-value closure; pointer targets require an explicit value path or another selected by-value use", "placement": "original IDs, root sizes, array stride, field offsets, byte order and bit slices are preserved", "availability": "IsProjected and UnselectedMembers describe omitted composite members; IsUnselected distinguishes deliberately address-only target identities from missing metadata; schemas never expand implicitly", "validation": "selected descriptors and placements, direct names and promoted ambiguity candidates; omitted ordinary descriptors are not validated; full Import keeps full reachable validation", "limits": "MaxTypes bounds distinct planning and emitted descriptors; MaxProjectionWork bounds path-text/path-step/native-member/promotion/closure work; promotion search memoizes shared DAGs and stops after two matches", "writes": "whole-value encoding rejects composites with omitted members; selected-field updates preserve unrelated bytes" },
"prepared": { "schemaIdentity": "identical schema instance required", "lifetime": "immutable schema decisions only; no retained source bytes, pointer values or operation contexts", "fixedOffset": "root-relative byte offset only without a pointer value step", "typed": "8/16/24/32/64-bit integers, bool, float32/float64, enum results, bit slices and StoredPointer; other scalar codecs bind as object", "failure": "Try operations distinguish schema, path, type, pointer, extent, codec and storage failures; cancellation and budgets terminate" },
"exactReads": "destination must fit the finite region before transport; positive short reads continue; zero length checks cancellation without requests; copied prefix remains and unread bytes stay untouched",
Expand All @@ -26,5 +26,5 @@
"resolver": "Func<PointerRequest, MemoryAccessContext, MemoryRegion>; pointer storage, translation and target reads share the active context; no context retention",
"traversalIdentity": "source object and address by default; an explicit caller callback may canonicalize aliased views while returned nodes retain their original sources",
"discovery": {"buffer":"fixed scalar fields use exact selected extents and explicit validity; predicates never see unknown bytes","bytes":"prepared one-byte arrays preserve raw bits and bypass custom codecs; text policy is application-owned","scan":"borrowed bounded windows, owned starts, same-source adjacency only, no holes joined, explicit stride and stop reasons","snapshot":"bounded fixed field selections; elementwise default; coalescing opt-in with independent gap recovery; owned validity and generation observations","provenance":"optional dynamic mapping descriptions; source identity and unsigned coordinates; no atomicity; patch flattening remains static","graph":"ordered streaming BFS/DFS; caller canonical identity; bounded nodes, edges, depth and frontier; explicit partial stop reasons"},
"tests": ["MemoryDiscoveryTests", "MemoryReadSetAndGraphTests", "PreparedMatcherTests", "MemoryProjectionTests", "MemoryPreparedReaderTests", "MemoryAnalysisTests", "MemoryMetadataTests", "MemoryBtfCoverageTests", "MemoryBtfBoundaryTests", "MemoryIsfCoverageTests", "MemoryAdapterTests", "MemoryFailureTests", "MemoryExplicitLayoutTests", "MemoryValidationTests", "MemoryOperationMatrixTests", "MemorySourceContractTests", "MemoryPortableProjectionTests", "MemoryAcceptanceBoundaryTests", "MemoryFuzzTests", "MemoryPathAndCodecTests"]
"tests": ["MemoryDiscoveryTests", "MemoryReadSetAndGraphTests", "PreparedMatcherTests", "MemoryProjectionTests", "MemoryPreparedReaderTests", "MemoryAnalysisTests", "MemoryMetadataTests", "MemoryBtfCoverageTests", "MemoryBtfBoundaryTests", "MemoryIsfCoverageTests", "MemoryIsfOverlayTests", "MemoryIsfPointerStorageTests", "MemoryPdbMetadataTests", "MemoryAdapterTests", "MemoryFailureTests", "MemoryExplicitLayoutTests", "MemoryValidationTests", "MemoryOperationMatrixTests", "MemorySourceContractTests", "MemoryPortableProjectionTests", "MemoryAcceptanceBoundaryTests", "MemoryFuzzTests", "MemoryPathAndCodecTests"]
}
2 changes: 2 additions & 0 deletions docs/config/cspell-terms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,5 @@ ifdef
offsetof
PWSTR
LINQ
OMAP
discontiguous
Loading
Loading