[cDAC] Add Apple to RuntimeInfoOperatingSystem#127289
Merged
max-charlamb merged 1 commit intodotnet:mainfrom Apr 22, 2026
Merged
[cDAC] Add Apple to RuntimeInfoOperatingSystem#127289max-charlamb merged 1 commit intodotnet:mainfrom
max-charlamb merged 1 commit intodotnet:mainfrom
Conversation
Adds a dedicated Apple value to the RuntimeInfoOperatingSystem enum in IRuntimeInfo so that cDAC consumers can distinguish Apple platforms (macOS / iOS / tvOS / MacCatalyst) from other Unix targets. The native data descriptor emits the new Apple string whenever TARGET_APPLE is defined, which is checked before the generic TARGET_UNIX arm. This is needed by CallingConventionInfo (see dotnet#127282) to reliably set IsAppleArm64ABI for Apple ARM64 stack-argument alignment rules, which differ from Linux ARM64. Existing != Windows callers (unwinders, SOSDacImpl) continue to behave correctly for Apple targets since Apple platforms are still POSIX for their purposes. The enum is parsed with Enum.TryParse(ignoreCase: true), so older cDACs reading dumps from updated runtimes will simply see Unknown, and newer cDACs reading dumps from older runtimes will still see Unix (no behavioral regression). No RuntimeInfo contract version bump is required. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an Apple operating system discriminator to the cDAC RuntimeInfo contract so consumers can reliably distinguish Apple targets (macOS/iOS/tvOS/MacCatalyst) from other Unix platforms.
Changes:
- Added
RuntimeInfoOperatingSystem.Appleto the managed contract enum. - Updated the CoreCLR data descriptor to emit
OperatingSystem = "Apple"whenTARGET_APPLEis defined (checked beforeTARGET_UNIX). - Updated dump-based tests and contract documentation to account for the new OS value.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/native/managed/cdac/tests/DumpTests/RuntimeInfoDumpTests.cs | Maps dump metadata "osx" to the new RuntimeInfoOperatingSystem.Apple. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IRuntimeInfo.cs | Adds the Apple enum value for RuntimeInfoOperatingSystem. |
| src/coreclr/vm/datadescriptor/datadescriptor.inc | Emits OperatingSystem=Apple under TARGET_APPLE before the TARGET_UNIX arm. |
| docs/design/datacontracts/RuntimeInfo.md | Documents the new Apple value and intended semantics. |
rcj1
approved these changes
Apr 22, 2026
Member
Author
|
/ba-g cDAC only change and cDAC legs pass |
This was referenced Apr 22, 2026
Open
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.
Note
This PR description was drafted with AI (Copilot CLI) assistance.
Summary
Adds a dedicated
Applevalue toRuntimeInfoOperatingSystemso the cDAC can distinguish Apple platforms (macOS / iOS / tvOS / MacCatalyst) from other Unix targets. The native data descriptor emits the newApplestring wheneverTARGET_APPLEis defined, checked before the genericTARGET_UNIXarm.Fixes #127282.
Motivation
CallingConventionInfoin #126408 needs to setIsAppleArm64ABIonly on Apple platforms, because Apple ARM64 uses different stack-argument alignment than Linux ARM64 (natural alignment for primitives, 4-byte alignment for float HFAs, vs. Linux's uniform 8-byte slots). With today's enum collapsing everything non-Windows/non-Browser intoUnix, that check cannot be expressed andIsAppleArm64ABIis effectively hardcoded.Changes
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IRuntimeInfo.cs— addAppleto the enum.src/coreclr/vm/datadescriptor/datadescriptor.inc— emitCDAC_GLOBAL_STRING(OperatingSystem, Apple)whenTARGET_APPLEis defined, before theTARGET_UNIXarm. Follows the existing#ifdefguard pattern.docs/design/datacontracts/RuntimeInfo.md— document the new value and clarify thatAppleis still POSIX for!= Windowschecks.src/native/managed/cdac/tests/DumpTests/RuntimeInfoDumpTests.cs— map dump metadata"osx"toApple(wasUnix);"linux"/"freebsd"stayUnix.Compatibility
The enum is parsed via
Enum.TryParse(ignoreCase: true):"Unix"on macOS, so dumps look identical to today."Apple"and returnUnknown; every production check is== Windows/!= Windows, which is unaffected.No
RuntimeInfocontract version bump is needed — V1 is defined in terms of parsing, not the specific token set.Where the enum is used
All usages are inside
src/native/managed/cdac; an org-wide GitHub search found no references outsidedotnet/runtimeand thedotnet/dotnetVMR mirror, anddotnet/diagnosticshas zero references.Definition
Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IRuntimeInfo.cs— enum +IRuntimeInfo.GetTargetOperatingSystem().Production (parser + consumers)
Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/RuntimeInfo_1.cs—Enum.TryParse(ignoreCase: true)of theOperatingSystemglobal, fallback toUnknown.Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs—!= Windows.…/StackWalk/Context/AMD64/AMD64Unwinder.cs(2 sites) —!= Windows→_unixAMD64ABI, and aDebug.Assert(... == Windows)on the Windows-only path.…/StackWalk/Context/X86/X86Unwinder.cs—!= Windows.Tests
tests/RuntimeInfoTests.cs— theory data auto-generated from the enum; picks upAppleautomatically.tests/DumpTests/RuntimeInfoDumpTests.cs— dump-metadata → enum map (updated by this PR).Call-site audit
All current
GetTargetOperatingSystem()consumers compare againstWindows, notUnix, so addingApplechanges no runtime behavior:AMD64Unwinder.cs:34!= Windows→ sets_unixAMD64ABI. Apple x64 is Unix AMD64 ABI ✓AMD64Unwinder.cs:853Debug.Assert(... == Windows)on Windows path ✓X86Unwinder.cs:37!= Windows(x86 has no Apple target) ✓SOSDacImpl.cs:745!= Windows✓Follow-up in #126408 will flip
IsAppleArm64ABI = os == Unixtoos == Apple.Testing
Microsoft.Diagnostics.DataContractReader.Tests— all 1751 tests pass, including the auto-generated"apple"round-trip case inRuntimeInfoTests.GetTargetOperatingSystemTest.Apple.datadescriptor.incchange is a preprocessor-only addition following the existing pattern and is inert on non-Apple builds.