Skip to content

Release 0.22.0 - #133

Merged
Mx-Iris merged 85 commits into
mainfrom
next
Oct 8, 2026
Merged

Mx-Iris merged 85 commits into
mainfrom
next

Conversation

@Mx-Iris

@Mx-Iris Mx-Iris commented Oct 8, 2026

Copy link
Copy Markdown
Member

Merges next into main for the 0.22.0 release: 85 commits ahead of main. The user-facing summary is Changelogs/0.22.0.md, which also becomes the GitHub Release body.

What ships

  • New SwiftSectionKit library product: every swift-section subcommand as a request; the CLI is now a thin wrapper over it.
  • evolution --interface --emit-available [--platform <name>] prints genuine @available attributes.
  • SwiftDeclarationPrintConfiguration.marksOptionalContent: print once, mark which option shows each part.
  • Reading APIs unified on ReadingContext; the in machO: and pointer forms are deprecated (removed in 0.23.0), with three behavior changes listed in the changelog.
  • Dyld shared cache reads build sub-caches once (faster, far less memory on macOS 27's split caches); a cache image resolves its dependencies in its own cache; simulator-runtime ObjC classes bound to their own image are read.
  • Fixes: objc crash on macOS 14.4–15.3.2 caches, evolution crash when one build sits in two caches, main-executable symbol offsets, STABS entries supplying a zero address, Optional reads consuming a tag byte.
  • Changelogs for 0.20.0 and 0.21.0 rewritten as one-line entries; build-executable-product.sh builds the universal binary the way each SwiftPM engine allows.

Release checklist

  • Sources/Executables/swift-section/Version.swift = 0.22.0; both agent plugin manifests = 0.22.0
  • Changelogs/0.22.0.md present
  • Proposals 0055–0061 numbered and Implemented
  • Dependency floors: MachOKit 0.54.101, MachOKitExtensions 1.1.2, MachOObjCSection 0.8.110, swift-semantic-string 0.4.0 (all already tagged)
  • Tag 0.22.0 after merge to trigger the release workflow

Verification (local, remote dependencies only)

  • Full suite (swift test --skip IntegrationTests, Xcode 26.6) on next @ 5c8a551f: 2279 tests in 427 suites, raw exit code 0; the one known issue is the recorded SymbolicManglingIndexTests local-type withKnownIssue.
  • Release builds of swift-section on Xcode 26.6: x86_64 and arm64, 0 warnings, both run.
  • claude plugin validate (the marketplace with --strict) passes.

argumentCandidatePathSpecializesNonGenericCandidate failed in about half
of all processes because it picked its Int candidate by
currentName == "Int", and two candidates matched. The specialization
indexer indexes the test binary, which links the library, and since
4c8643c the library declares `enum MemberKey: Hashable` inside
ObjCMemberApplication.inferFromSelectorNames(...) -> Int. That local
type prints as "MemberKey #1 in static ...inferFromSelectorNames(...)
-> Swift.Int", and currentName, the last dot-separated component of the
printed name, reads it as "Int". The candidate order comes from a Set,
so whichever of Swift.Int and MemberKey came first decided whether the
test specialized TestSingleProtocolStruct<Int> or <MemberKey>.

currentName is the display name dump and interface print in a
declaration header, not a lookup key, so the library is unchanged. The
14 standard-library candidate picks now compare the full name
("Swift.Int", "Swift.Array", "Swift.Dictionary"); the 13 other short-name
lookups use a new test-only DefinitionName.declaredNameForTesting in
MachOTestingSupport, which reads the declaration's own name from the
node (identifier, local or private decl name). DeclaredNameForTestingTests
pins it on the exact failing shape, $s4Main3fooSiyF9MemberKeyL_OD. The
withKnownIssue wrapper from f46850b is removed; run alone five times the
test passed every time.
Also drops the unused MachOKitVersion constant.
The 31 targets that sat flat under Sources/ now live in eight layer
directories: Support, MachO, ABI, Analysis, Declaration, Output,
Executables and TestSupport. Each target declares its path in
Package.swift; target, product and module names are unchanged.

Code that found files by a fixed depth under Sources/ moves with it:
the fixture paths in MachOFileName / MachOImageName climb one more
level, PrintFailureEventTests reads the module two levels below
Sources, the coverage invariant points at ABI/MachOSwiftSection/Models,
and the release / version-check workflows point at the new
Version.swift location.

Proposal: 0055-group-sources-by-layer.
MachOKitExtensions 1.0.0 stops exporting UnsafeRawPointer's and
UnsafePointer's throwing init(bitPattern:). As public extension members
they shadowed the standard library's failable initializer in every module
that imported the package, and MachOObjCSection's core target, which now
depends on it, could no longer write UnsafeRawPointer(bitPattern:)!.

This package is their only caller, so Utilities declares them with
package access: same names and behavior, invisible to clients. The
MachOKitExtensions requirement moves to 1.0.0, since an earlier release
still exports them and every call would become ambiguous. MachOReading
had no file importing Utilities, so InProcessContext.swift now does.
SwiftDeclarationPrinter decided at each output point whether to print
from configuration.printX, so its output carried no trace of what
another set of options would add. The layout comments' text can be
rewritten by a transformer and how many lines a member gets depends on
offsets and symbols, so a caller cannot attribute them from text or
position either. RuntimeViewer's Find prints each declaration once for
its search corpus and must show only what the content pane shows under
the user's current options, without reprinting (about two minutes for
SwiftUI) whenever an option changes.

SwiftDeclarationPrintConfiguration.marksOptionalContent (default false)
turns the options below from deciding whether to print into deciding
the condition of a VisibilityRegion (swift-semantic-string) around what
they control; transformers, memberSortOrder and every other switch act
as before:

- printFieldOffset, printExpandedFieldOffsets, printMemberAddress,
  printVTableOffset, printPWTOffset, printTypeLayout, printEnumLayout
  and printStrippedSymbolicItem, through the printer's
  optionalContent(_:content:) and, for the layout comments, through
  DeclarationRenderConfiguration.marksOptionalContent. Data those
  comments need (field offsets, enum layouts, the static layout
  provider) is always computed when marking (producesContent(for:)).
  The line break that exists only when both the type layout and the
  enum layout comments do is a nested region.
- Opaque type resolution: printOpaqueReturnType writes " <constraints>"
  as before and, when marking, conditions those atoms afterwards with
  SemanticString.markAtoms(from:visibleUnder:), so the text, the atom
  count and the identifiers of type references are unchanged
  (NodePrintableDelegate.marksOptionalContent).
- infersObjCOverridesFromSelectorNames: when the two verdicts yield
  different ResolvedObjCMemberFacts, the declaration is printed under
  each and the two are wrapped in the option's on and off regions,
  since turning it on adds @objc / override / class and drops final
  rather than only adding text (printUnderObjCVerdicts).

SwiftVisibilityOption names the options ("swift.printFieldOffset", …,
"swift.opaqueTypeResolution") and
isVisibilityOptionEnabled(_:resolvesOpaqueTypes:) is the predicate to
project with; opaque resolution is not a configuration property but
whether an opaque type resolver is registered, so the caller supplies
it. Containers need nothing from the printer: swift-semantic-string
carries the members' conditions onto the decorations they emit.

VisibilityRegionProjectionTests asserts, for every top-level type,
protocol and extension of SymbolTestsCore, that the marked print
projected onto a configuration equals printing with that configuration
(text, spans and identifiers): in process (runtime layouts, the path
RuntimeViewer takes) under all options off, all on and each alone on
and off (22 configurations), and from the file (static layouts) under
the four layout options (10). SwiftInterfaceTests, SwiftPrintingTests,
SwiftDumpTests and SwiftDeclarationRenderingTests match a baseline built
from the same commit, and the snapshot tests pass on both sides, so
plain printing is unchanged. Proposal:
Documentations/Evolutions/draft-visibility-regions.md.
The proposal lands on next as 0056, the highest number on every remote
branch being 0055, and moves to Implemented: rebased onto next without
conflicts, `USING_LOCAL_DEPENDENCIES=1 swift test --skip IntegrationTests`
exits 0 against local next dependencies (19 batches, 2146 tests, 406
suites; the one known issue is the existing SymbolicManglingIndexTests
one). The project evolution log gains section 71, the glossary "marking
mode".

The remote floor for swift-semantic-string stays at 0.3.0, which has no
VisibilityRegion, until the release that has it; until then next builds
only with USING_LOCAL_DEPENDENCIES=1. No guide or implementation note:
the use and the two conventions the signatures do not show are in the
documentation of marksOptionalContent and the marking extension.
The marking mode needs VisibilityRegion, which swift-semantic-string ships from 0.4.0; 0.3.0 does not have it, so next built only against local dependencies. Built with remote dependencies only (MachOKit 0.52.103, MachOKitExtensions 1.0.0, MachOObjCSection 0.8.107, swift-semantic-string 0.4.0); SwiftInterfaceTests, SwiftPrintingTests, SwiftDumpTests, SwiftDeclarationRenderingTests and PrintFailureEventTests pass. Ledger section 71 and proposal 0056 record it.
…implementation classes

A field offset global names its variable through a privateDeclName instead of
an identifier when the property is private or fileprivate, and always for the
storage of a lazy var, which the compiler makes private whatever the
property's own access level. The index accepted only the identifier shape, so
both kinds of ivar stayed untyped even with every symbol present, and their
members printed as { get set } computed properties beside an
unrecoverable-storage comment.

A lazy var's storage now joins its property, by the Swift name or, once the
field offset global is stripped, by the ObjC ivar name, and renders the way a
Swift type's own lazy field does: `lazy var x: <getter type>` in the
interface, `lazy var x: <storage type>` in the dump.

The printer's declared-type fallback read the type child of a variable node,
but a VariableDefinition's node is the symbol root, so it always answered nil;
nothing reached it until the lazy rendering needed the getter's type. It now
uses WrappedPropertyRecovery.declaredTypeNode(of:).
ObjCMemberShape read a member's name from an identifier child only, while a
private or fileprivate member spells it inside a privateDeclName, so such a
member got no shape. No verdict depends on it today (a private member's
implementation symbol and its To thunk are local symbols together, and a
private member is never an override), but it is the same defect as the field
offset parse fixed alongside it.
… could be inferred

The implementation note gains the facts behind the gaps: no field descriptor,
symbol visibility driven by the Swift access level, the ivar encoding rules,
the compiler's restrictions on @implementation storage, and the lazy-storage
join. A new roadmap records the routes left for inference (ObjC metadata, SDK
headers, runtime sampling, disassembly) with the evidence gathered for each.
Evolution log section 72.
…chable in RuntimeViewer

Since proposal 0023, a C typedef promoted to its own type (a typedef'd
anonymous struct such as AppKit's NSSliderDrawingState, a CF class, a
swift_wrapper typedef) demangles to a typeAlias node from its descriptor
as well as from its symbols. The printer gives a typeAlias identifier the
.standard semantic type, and RuntimeViewer colors and links only .type
tokens, so these references lost their color and their link. Searching
fails for two independent reasons: RuntimeViewer indexes with
showCImportedTypes: false, and the ObjC side harvests named structs only.

The report also records how far the 0023 impact assessment across six
frameworks got (prepared, not run) and how to resume it.
Every ABI-layer reading API is written three times — against a Mach-O,
against a raw pointer, and against a ReadingContext — and the copies have
drifted: the ReadingContext copy skips rebase and bind handling on a
MachOFile, and the pointer copy crashes on a null or tagged pointer. The
proposal keeps the ReadingContext copy as the only implementation,
deprecates the other two as one-line forwarders in 0.22.0 and removes them
in 0.23.0; it also covers the 61 read-only upper-layer APIs, for which
ReadingContext gains a cache-scope declaration.
…f every reading API

Every ABI-layer reading API existed in up to three hand-written copies: one
reading a Mach-O by offset, one reading process memory through a raw
pointer, and one reading through a ReadingContext. The ReadingContext copy
now carries the only implementation; the Mach-O and pointer copies are
deprecated one-line forwarders to machO.context and InProcessContext.shared,
kept on the same types and in equally constrained extensions so overload
resolution picks the same declaration as before.

The context copies had drifted, and now carry what the Mach-O copies did:
- Pointer.resolve(at:in:) reads a rebased slot as its rebase target
  instead of the chained-fixup bytes the file stores.
- TypeMetadataRecord.contextDescriptor(in:) answers nil for an indirect
  record whose slot is a bind, as the Mach-O copy has since the iOS 26.5
  simulator's libswiftSynchronization lost its whole type list to one.
- An optional SymbolOrElementPointer element stored as only tag bits is a
  null element in every context.
- MangledName keeps every offset on the start address's base, so a tagged
  start no longer skews the name's size.
Bind and rebase checks go through bindRebaseResolver, so a wrapper reader
conforming to MachOBindRebaseResolving gets them too.

InProcessContext computes its tag mask once instead of per read, and
MachOContext no longer strips tags a second time before resolveOffset(at:).
ResilientWitness.implementationAddress(in: machO), which formats a string,
is renamed implementationAddressString(in:).
Every call of a deprecated Mach-O or pointer reading form above the ABI
layer — in the analysis, declaration and output modules, the test support
targets and the test suites — now calls the ReadingContext form directly:
in: machO.context for a Mach-O reader, .inProcess for process memory.
The rewrite inlines the forwarders, so behavior is unchanged; every fixture
baseline regenerates byte-identical.

Fixture suites read through their fileContext, imageContext and
inProcessContext and assert across acrossAllContexts; an assertion that
became a duplicate of the context assertion beside it was dropped.
ResilientWitness registers implementationAddressString with a test of its
own, and a new suite checks that the deprecated forms still land on the
context forms — including the pointer form of a bound symbol, which
trapped before.
Many fixture tests compared a Mach-O form against its ReadingContext form.
They were two implementations then; now the Mach-O form forwards, so both
sides run the same code and the comparison cannot fail. Such duplicates are
removed, keeping the stronger check of each pair. Where a test was left
asserting nothing, it now checks what the removed comparison stood in for:
the metadata kind literal, the picked descriptor's offset, or the
in-process reading of the same value witness table.
…ly upper-layer APIs onto it

ReadingContext now declares a cache scope (image, process or uncached),
which exposes the identity per-image caches key on without handing out
the Mach-O. SharedCacheKey gains an image-identifier initializer, and
SymbolicDemangler and InternedNodeReferenceCache choose their cache layer
from the scope.

The pure-reading APIs above the ABI layer take a context: SymbolicDemangler's
type and node demangling, the SwiftDeclaration naming extensions, the
NamedDumpable / ConformedDumpable requirements and the rendering helpers
that only read. Their Mach-O and pointer forms remain as deprecated
one-line forwarders, so each keeps a single implementation. Call sites in
the upper layers, the test support and the tests pass machO.context.

AGENTS.md, ReadingContextAbstraction.md, the glossary and the proposal
describe the single-implementation rule and the cache scope.
The cache scope's image case carried an AnyHashable, and SharedCacheKey's
reader initializer was rewritten to box the reader's identifier into one
and unbox it again. A file's identifier, a path plus a UUID, does not fit
an existential's inline buffer, so that brought back the per-lookup heap
allocation SharedCacheKey was written to remove, on every per-image cache
lookup and on every memo lookup through a context.

The image case now carries the reader's MachOTargetIdentifier, and the two
memos build their key with the existing SharedCacheKey(identifier:), the
same key SharedCacheKey(machO) gives. SharedCacheKey is back to its
previous form. A reader whose identifier is of another type, which none
is today, is read unmemoized through a context.
…f state

The evolution log gains the migration's section with the verification
done so far: the full suite matching the baseline, no new warnings and
90 byte-identical rendering pairs. The performance acceptance is still
open, because this machine is too loaded to measure it. The proposal
records that decision and a hand-off section: what is done, how to run
the timings on another machine, the traps met on this one, and the
questions left for the maintainer.
The timings the loaded 10-core Mac Studio could not settle were taken on
the 28-core Studio: the dyld-cache, simulator-file and MachOImage paths
are all at parity with next (retired instructions -0.48% and -0.21%, user
time +0.2% and +0.57% with overlapping ranges, and -1.2%).

The branch was never pushed from the first machine, so it was rebuilt
there from the session transcripts; each commit's file list and line
counts match the original's. The proposal's progress section now lists
the rebuilt commits, the verification rerun on the new machine, and the
three questions left open.
The proposal planned two pull requests, one for the ABI layer and one for
the cache scope and the upper-layer APIs. The ABI part's documentation was
committed with the second part, and the commits are already split by
concern, so the migration lands as a single pull request. The pre-existing
Optional-read trap, the stdout print in ContextDescriptorWrapper and the
rendering harness's --skip-build option go to branches of their own.
The harness looks for the archived caches in fixed 26.6.2 and 15.5
directories, and the 28-core machine only has 26.6, so its run silently
lacked that leg. It was rendered by hand with the harness's arguments:
all 12 pairs are byte-identical, 96 pairs in total on that machine.
…uild

The harness always built both sides itself: `swift build -c release` for
the CLI, both sides at once, then `swift test -c release` for the
MachOImage part, neither through the machine's build queue. On the
throttled 10-core Mac Studio the queue caps a release build at --jobs 8,
which reaches swiftc as -num-threads 8, so the harness's uncapped command
line reused nothing: on 2026-09-30, prebuilding through the queue still
ended in two concurrent full release builds outside it.

--skip-build builds nothing:

- the CLI is each side's <scratch>/release/swift-section; a missing one
  stops the run before any render, naming the path and the prebuild that
  side needs;
- the MachOImage part's `swift test` gets --skip-build and runs the
  prebuilt release test bundles; a missing bundle fails that invocation
  ("<bundle>.xctest doesn't exist in file system"), which the existing
  hard-failure path turns into a failed run.

One prebuild per side is enough. `swift test -c release --filter
NoSuchTestForPrebuild` builds every product, the CLI included, and the
filter matches no test. Running it and `swift build -c release` on one
scratch path recompiles the package twice (swift test turns testability
on for the whole build, swift build -c release leaves it off), so the
suggested prebuild is `swift build` only when the MachOImage part does
not run.

compare_all_pairs and the skip-marker writing are untouched. Six new
harness tests pin the flag's behavior and the default path; all 15 pass.
Checked on the 28-core Mac Studio Ultra: after one `swift test` prebuild,
a --skip-build run over Combine (macOS 15.5 cache + MachOImage) launched
no build, left both products' timestamps unchanged, and compared 6 pairs,
all byte-identical; with the CLI missing on one side it exited 1 before
rendering anything.
FunctionTypeMetadata.extendedFlags(in:),
EnumMetadataProtocol.payloadSize(descriptor:in:) and the class-flag read
in SwiftClassObjectIndex asked the generic readElement for an Optional:
by returning it straight from an optional-returning function, or through
`guard let flags: UInt32 = try?`. The generic was then inferred as
Optional<Field> and read the Optional's in-memory shape, the field plus
one tag byte, so a non-zero byte after the field made the answer nil.

For extendedFlags that byte is the padding before the thrown error type,
which the runtime leaves unwritten. A typed-throws function lost its
extended flags and its thrown error type whenever the allocator handed
out dirty memory, which is why three FunctionTypeMetadataTests passed
alone and failed in a full run. After the class flags comes
instanceAddressPoint, which the compiler always writes as zero, so that
read never misfired on a real binary.

Each read now goes into an annotated non-optional local, or `as UInt32`,
before it is wrapped. The regression tests lay the records out by hand
with the Optional's "no value" tag right after the field; the class-flag
test patches a copy of the renamed-class fixture, its UUID changed too
so the per-image caches do not answer from the original.
The optional resolve forms of ContextDescriptorWrapper,
TypeContextDescriptorWrapper and ValueTypeDescriptorWrapper printed to
stdout when a descriptor failed to resolve, and SubstitutionMap printed
there when it met a cycle. Library code must not write to a process
stream: stdout is the CLI's product output, and a GUI host such as
RuntimeViewer only sees the unified log.

They now log through @loggable + #log. The ABI layer reaches
FoundationToolbox through Utilities, as MachOSymbols already does.
SubstitutionMap is generic, so it takes the protocol form. The value-type
wrapper's message named ContextDescriptorWrapper; it names its own type
now.

The four files leave the stream-write scan's baseline debt list, which
turned the scan red until the writes were gone. What remains on the list
prints on purpose: the spare-bit analyzer's table and a fixture-support
dump helper.
Mx-Iris added 27 commits October 5, 2026 12:27
…as Implemented

Number the draft 0060 and mark it Implemented; record the landing in its
decision log (the rebase, moving the command-line half into SwiftSectionKit,
the verification) and as ProjectEvolutionLog section 79.

Point the proposal and the task report at the current source layout, and
document the new surface where readers look for it: the SwiftInterface and
SwiftSectionKit module references, the SwiftSectionKit caller guide's errors
(English and Chinese), README's evolution section, the swift-section-cli
plugin skill (a late flag to check for, and how to read an absent
attribute), and the glossary's lifecycle annotation entry.
…sion

DyldSharedCachePath was a String-backed enum, so every archived cache a
test wanted took a new case with its full path spelled out. Make it a
String-backed struct with static members instead, in the shape of
SymbolicManglingReference.Kind, and add macOS(_:) and iOS(_:), which build
/Volumes/DyldSharedCaches/<platform>/<version>/dyld_shared_cache_arm64e from
the version's directory name.

The eight cases become static members of the same names, so no call site
changes; the four macOS ones are now built from their versions. Only the
integration dumps open those, and nothing runs them automatically, so
DyldSharedCachePathTests pins them to the paths they spelled before. The
iOS 27.0 simulator cache stays spelled out: its runtime volume is named
after the build, which no version alone gives.
The interface, diff and evolution suites each gain an
ArchivedDyldCacheTests whose caches are named by version alone
(cacheVersion, oldCacheVersion / newCacheVersion, cacheVersions), on the
base class each suite already uses. The evolution one labels its axis
with those versions, so every label is numeric and it renders the
@available(macOS, …) lines too; the two dump helpers take the platform as
a parameter that defaults to nil, leaving the existing dumps unchanged.
…nted

The lightweight proposal for naming archived test caches by version and
the version-driven integration dumps, numbered at landing, its row in the
proposal index, and ProjectEvolutionLog section 80.
… label

The evolution dumps listed their caches and, in a second array that had to
stay in step, the label of each. DyldSharedCachePath now carries the label
itself: macOS(_:) and iOS(_:) label a cache with the version it was named
by, and the other named caches state theirs (current is labeled
"current"; a label need not be a system version). Every value carries one,
so the type no longer conforms to RawRepresentable, which would have to
build a value from a path alone; rawValue stays the path.

MultiVersionDyldCacheImageTests drops cacheLabels and labels its axis with
each cache's versionLabel. The default caches give the labels it wrote out
before, which DyldSharedCachePathTests now pins too, so the existing
evolution dumps print the same axis. The archived evolution dump lists its
caches and nothing else.

The label is not read from the cache file: its header's osVersion keeps
only the major and minor version (26.5.2 reads 26.5.0) and is zero in
macOS 11 caches.
Update the proposal's summary and plan for versionLabel, log the follow-up
and why the label is passed in rather than read from the cache header, and
add the follow-up to ProjectEvolutionLog section 80.
…cOS minor

SwiftEvolutionInterfaceBuilderTestSuite.ArchivedDyldCacheTests now lists
cacheVersions, one archived cache per macOS minor from 11.0.1 to 27.0
(51 in all; 11.0 and 12.0 exist only as 11.0.1 and 12.0.1), derives
cachePaths from it, and reads SwiftUI.

MultiVersionDyldCacheImageTests leaves a version off the axis when its
cache lacks the image or the image has no __swift5_* section, instead of
indexing it: AppKit kept its Swift API in libswiftAppKit.dylib until
macOS 14, and indexing an image without Swift sections logs four
extraction failures per version. A cache that cannot be opened still
throws.

Docs: the follow-ups in proposal 0061 and ProjectEvolutionLog section
80, with the measured cost — an AppKit axis of 51 versions peaks at
0.78 GB, SwiftUI from 14.4 on (23 versions) at 4.64 GB — and the doc
comments of the suite and its protocol.
An evolution interface over every archived macOS cache trapped in
MachOKit while reading SwiftUI's ObjC class data. The macOS 13.5 and
13.6 caches carry the same SwiftUI build, LC_UUID included, at different
addresses, and a cache image's identifier was uuidFile(path:uuid:), so
the two copies shared every SharedCache entry. ObjCClassMethodIndex,
built for 13.6 first, gave the 13.5 image the 13.6 offset of
_ViewList_ID.JoinedViews; the slot at that offset in the 13.5 cache
holds the integer 0xa9, and decoding it as a pointer subtracted the
region start from a smaller value.

MachOKitExtensions keys an image read from a dyld cache by its cache's
UUID as well (dyldCacheImage), and MachOKit reports no rebase target
instead of trapping on such a slot. SharedCacheKey hashes the new case
on its two UUIDs, as it hashes uuidFile on its one.

DyldCacheTwinImageTests reproduces both on the archived 13.5 and 13.6
caches and skips when they are absent: against MachOKitExtensions 1.0.0
the 13.5 index answers the 13.6 offset and then traps, and against
MachOKit 0.52.103 resolving the 0xa9 slot traps. SharedCacheKeyTests
pins the new hash and the keys of one build in two caches.

Docs: ProjectEvolutionLog section 81, Modules/MachOCaches.md and the
module list in AGENTS.md.
MachOKitExtensions 1.1.0 keys an image read from a dyld cache by its
cache as well, which SharedCacheKey now hashes; MachOKit 0.52.104
answers no rebase target for a slot that holds no pointer instead of
trapping on it. Both were released for the crash of an evolution over
every archived macOS cache.

Resolved from the remote releases, MachOCachesTests (46) and
SwiftInspectionTests (140, with the registered SymbolicManglingIndexTests
known issue) pass. ProjectEvolutionLog section 81 records the releases.
MachOKitExtensions 1.1.1 builds each dyld sub-cache once. Until now
every read of an image in a split dyld cache that crossed into another
cache file built the sub-caches afresh: through FullDyldCache all of
them for each entry tried, from the main file alone the file opened
again, every new DyldCache autoreleasing once and every new instance
mapping the file again through DyldCache.fileIO. On a large-stack
executor job the pool only drains when a version's index is done.

Over SwiftUI 26.7 and 27.0 the evolution interface now takes 198 s
instead of 376 s and peaks at 427 MB instead of 3.2 GB, with
byte-identical output; over all 51 archived macOS minors it completes
at a 4.86 GB peak, where the earlier estimate was 6-8 GB.

With the fix as a local edit the full suite (--skip IntegrationTests)
passes; resolved from the release, MachOCachesTests,
SwiftInspectionTests, SwiftPrintingTests and MachOSwiftSectionTests
pass. ProjectEvolutionLog section 82 records the cause, the numbers and
what is left: every version's index still stays resident until the
union is rendered.
The evolution integration test over all 51 archived macOS minors ran
past 5 GB, while the command line, over the same caches, stayed under.
The test opened each cache from its main file alone. On that path
MachOObjCSection opened another sub-cache, and mapped its file once
more, on every read that crossed into one; with MachOKit and
MachOObjCSection both holding per-identity state in weak-to-strong
NSMapTables, which keep a dropped key's value until they resize, those
mappings stayed. At 4.0 GB the process had 4,453 file mappings - 250 of
one 14.4 sub-cache file - and 445 MB of page tables. Every version also
opened the system cache for dependency lookups, 82 files at a time.

- Require MachOObjCSection 0.8.109, which reads through
  MachOKitExtensions' per-file sub-cache table, and MachOKit 0.52.105,
  which releases a file handle's identity with the handle.
- Require MachOKitExtensions 1.1.2 and resolve the system cache through
  FullDyldCache.cachedHost, opened once per process, in
  FileDependencyLocator and MachOSource.
- MultiVersionDyldCacheImageTests opens each cache through
  FullDyldCache, as swift-section --dyld-shared-cache does.

FileDependencyLocatorTests.locatorsShareOneOpeningOfTheSystemCache
failed before and passes now. The integration test passes at a 4,456 MB
peak, its output byte-identical to the command line's. The full suite
(--skip IntegrationTests) passes but for one Arm64eSignedVWTPointerTests
probe run that read slotCarriesTagBits=0 and passed three reruns. See
ProjectEvolutionLog section 82.
0.54.101 is the fork's release over upstream 0.54.0. The requirement
drops the `..< 0.53.0` cap so that this package, MachOObjCSection and
MachOKitExtensions ask for the same MachOKit line.

0.54.100 trapped on an image without an export trie, an LC_DYLD_INFO
image whose export offset and size are 0 (the iOS 15.5 simulator's
UIKit is one). The ObjC ancestor lookup reads the exports of every image
it walks, so dump and interface crashed on that runtime's SwiftUI and
WidgetKit. 0.54.101 carries upstream's fix (p-x9/MachOKit@17ff04e) and a
regression test in the fork.

Verified on remote dependencies: the full suite (2275 tests, without
IntegrationTests) passes on 0.54.100 and on 0.54.101. The rendering A/B
against next at 91b6c20 (MachOKit 0.52.105) caught the four crashing
pairs on 0.54.100 and is byte-identical on all 96 pairs with 0.54.101.
dyld resolves the dependencies of an image in a dyld shared cache within
that cache. The dependency closure looked only through the search paths
it was handed, whose default is the running system's cache, so an image
read out of an archived cache was laid out against the host's
frameworks: `swift-section dump --dyld-shared-cache` on macOS 15.5's
SwiftUICore printed `Foundation.URL` as 16 bytes, macOS 26's size, where
15.5's URL is 24, and judged property wrappers against the host's
SwiftUICore.

- DependencyClosure(root: MachOFile, ...) searches the root's own cache
  before every search path. It is the one place a FileDependencyLocator
  is built, so static layout, the ObjC ancestor resolver, the thunk
  reader, the property wrapper catalog, interface dependencies and the
  indexer all follow.
- A root read through a FullDyldCache hands that instance over
  (FileDependencyLocator(rootDyldCache:)); a search path naming the same
  cache file, or the host's cache when the root came from it, is not
  opened again. A root read from one cache file names the cache's main
  file as the first search path. root.fullCache is not used: it opens
  the cache on first use and stores it on the MachOFile unguarded, and
  closures over one root are built on several threads.
- The --dependency-search-path help, the agent plugin's skill and
  AGENTS.md say an image read out of a cache needs no path named.

CacheRootDependencyClosureTests (the closure finds 15.5's Foundation by
LC_UUID, for both ways of opening the cache, and reuses the root's cache
instance) and CacheRootDependencyLayoutTests (URL is 24 bytes) were red
before and are green, skipped without the archived 15.5 cache. The full
suite passes (2,279 tests). In the rendering A/B against next, the cache
legs differ only in property wrappers now judged against the cache's own
SwiftUICore. See ProjectEvolutionLog section 84.
The frameworks of an iOS 26 or earlier simulator runtime are linked
-interposable, so every exported Objective-C class is reached through a
bind to the image itself: its class list entry, its isa and the
superclass slot of each exported subclass. MachOObjCSection read only
rebases and lost those classes. 1,586 of UIKitCore's 5,017 class list
entries in iOS 18.5 were among them, and libobjc's NSObject. The static
layout engine therefore could not start a Swift subclass's fields after
UIDocument (`// Field offset: unknown (Objective-C ancestor UIDocument
unresolved)`, 392 times in SwiftUI's dump), and ObjC ancestor chains
broke at NSObject.

- Require MachOObjCSection 0.8.110, which resolves those binds through
  MachOKitExtensions 1.2.0 and names a legacy LC_DYLD_INFO file's bound
  superclass itself.
- ObjCImplementationClassIndex no longer reads the bind stream for a
  superclass or category class name: the reader now gives it for both
  fixup formats. LegacyDyldInfoBindTests and the legacy cases of
  ObjCMemberRecoveryTests cover what the removed code did.

SimulatorRuntimeObjCAncestorLayoutTests pins PlatformDocument's first
field at 0xc8 after UIDocument (instance size 0xc4) in the iOS 18.5
simulator's SwiftUI: red on MachOObjCSection 0.8.109, green on the fix,
skipped without that runtime. In the rendering A/B the simulator legs of
iOS 16.4 through 26.5 gain the ancestor chains, override keywords and
custom ObjC class names those classes carry; six SwiftUI accessibility
members now meet the known boundary of a category in an image outside
the closure (UIAccessibility). See ProjectEvolutionLog section 85.
Each entry is now one sentence stating the user-visible change, under
Breaking / New / Fixed. Causes, implementation notes, measurements,
the Compatibility and Requirements sections, and the links to proposals
and internal notes are dropped; they live in the evolution log and the
proposals.
Once macro plugins (MemberwiseInit, FrameworkToolbox) are in the graph,
the two build engines fail in opposite ways. Swift Build (the default
from SwiftPM 6.4) never builds the plugins for the host in a separate
`--arch x86_64` build on an arm64 Mac, but builds them in one invocation
with both `--arch` flags and links the universal binary itself. The
native engine (SwiftPM 6.3 and earlier) sends a two-arch build through
XCBuild, which drops the plugin targets, but separate builds work.

The script now reads the Swift version and takes the matching path,
runs `swift package update` first, and verifies each architecture with
its own `lipo -verify_arch` call, since Xcode 27's lipo reads a second
architecture name as a second input file.
Bumps BundledVersion and both agent plugin manifests to 0.22.0, adds
Changelogs/0.22.0.md in the one-sentence-per-entry style, and points
the README's package snippet at 0.22.0.

The evolution log gains section 86 for the release and marks sections
69-85 as shipping in 0.22.0. Verification of next @ 5c8a551 with
remote dependencies only (MachOKit 0.54.101, MachOKitExtensions 1.2.0,
MachOObjCSection 0.8.110, swift-demangling 0.7.1, swift-semantic-string
0.4.0, swift-capstone 6.0.1) on Xcode 26.6: full suite 2279 tests / 427
suites, raw exit code 0, one recorded known issue; release builds for
x86_64 and arm64 with 0 warnings; Claude Code plugin validation passes.
Copilot AI balanced review requested due to automatic review settings October 8, 2026 15:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Mx-Iris
Mx-Iris merged commit f2dfcf5 into main Oct 8, 2026
3 checks passed
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