Skip to content

Commit 1c1e323

Browse files
authored
Fix CoreLib trimming substitutions for interpreter-only CoreCLR (dotnet#133639)
## Summary Fixes dotnet#133615. Only include CoreCLR's JIT-specific `IsDynamicCodeCompiled` trimming substitution when `FeatureDynamicCodeCompiled` is enabled. This matches the condition used by the original getter: interpreter-only CoreCLR can support dynamic code without compiling it. Normal JIT-enabled substitution behavior is unchanged. Reenable `RuntimeFeatureTests.DynamicCode` and `DynamicCode_Jit` on Apple-mobile CoreCLR by removing their dotnet#124344 exclusions. Narrow the existing dotnet#123011 interpreter exclusion to non-Apple platforms so the corrected result does not simply cause `DynamicCode_Jit` to be skipped. Retain `SkipOnMono`, the non-Apple interpreter exclusion, and all existing assertions. This is a standalone trimming fix. It does not depend on dotnet#133378 or include WASM library-test, CI, or stack-walk workaround changes. ## Validation Built clean baselines and rebuilt the modified CoreLib for macOS arm64 and iOS simulator arm64 using **Checked CoreCLR / Release libraries**. All builds completed without warnings or errors. On an **iOS 26.5 simulator**, ran the same `RuntimeFeatureTests` class selection with `PublishReadyToRun=false`. Test-selection changes were applied before the pre-fix run and remained identical afterward. | Configuration | Executed | Passed | Failed | |---|---:|---:|---:| | Pre-fix, aggressively trimmed iOS | 11 | 9 | 2 | | Pre-fix, untrimmed iOS control | 11 | 11 | 0 | | Post-fix, aggressively trimmed iOS | 11 | 11 | 0 | | Post-fix, normal macOS JIT | 13 | 13 | 0 | The two pre-fix failures were exactly `DynamicCode_Jit` (`IsDynamicCodeCompiled` unexpectedly true) and `DynamicCode` (direct getter disagrees with `IsSupported`). Both explicitly pass after the fix. Each iOS run has one unavailable RemoteExecutor context-switch case skipped; filtered cases are not counted as executed. Results were read from application logs, rather than relying on the local `xharness apple run` exit status. Additional controls: - Two fully trimmed desktop CoreLib/probe executions pass: dynamic-code support enabled preserves compiled=true; disabled preserves compiled=false. - ILLink direct-caller inspection confirms iOS compiled=false for either feature-switch value after the fix, while desktop true/false folding remains unchanged. No device, tvOS, MacCatalyst, or release-branch execution is claimed. ## Compatibility and servicing This corrects a public return value for affected trimmed interpreter-only CoreCLR applications; compatibility documentation should follow once the PR is merged. `release/11.0` and `release/11.0-rc1` have the same getter/substitution mismatch and are candidates for a targeted .NET 11 backport after main lands. `release/10.0` lacks the same no-JIT getter implementation, so this should not be mechanically backported there. > [!NOTE] > This pull request description and code changes were generated with GitHub Copilot. --------- Co-authored-by: Copilot App <[email protected]>
1 parent 3898c71 commit 1c1e323

3 files changed

Lines changed: 3 additions & 5 deletions

File tree

‎src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</PropertyGroup>
2222

2323
<ItemGroup>
24-
<ILLinkSubstitutionsXmls Include="$(ILLinkDirectory)ILLink.Substitutions.xml" />
24+
<ILLinkSubstitutionsXmls Include="$(ILLinkDirectory)ILLink.Substitutions.DynamicCodeCompiled.xml" Condition="'$(FeatureDynamicCodeCompiled)' == 'true'" />
2525
</ItemGroup>
2626

2727
<!-- Note that various places in SPCL depend on this resource name i.e. TplEventSource -->

src/coreclr/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.xml renamed to src/coreclr/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.DynamicCodeCompiled.xml

File renamed without changes.

‎src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/CompilerServices/RuntimeFeatureTests.cs‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public static void PortablePdb()
1919
}
2020

2121
[Fact]
22-
[ActiveIssue("https://github.com/dotnet/runtime/issues/124344", typeof(PlatformDetection), nameof(PlatformDetection.IsAppleMobile), nameof(PlatformDetection.IsCoreCLR))]
2322
public static void DynamicCode()
2423
{
2524
Assert.Equal(RuntimeFeature.IsDynamicCodeSupported, RuntimeFeature.IsSupported("IsDynamicCodeSupported"));
@@ -33,9 +32,8 @@ public static void DynamicCode()
3332

3433
[Fact]
3534
[SkipOnMono("IsDynamicCodeCompiled returns false in cases where mono doesn't support these features")]
36-
[ActiveIssue("https://github.com/dotnet/runtime/issues/124344", typeof(PlatformDetection), nameof(PlatformDetection.IsAppleMobile), nameof(PlatformDetection.IsCoreCLR))]
37-
// The CoreCLR interpreter is not a JIT, so RuntimeFeature.IsDynamicCodeCompiled is false.
38-
[ActiveIssue("https://github.com/dotnet/runtime/issues/123011", typeof(PlatformDetection), nameof(PlatformDetection.IsCoreClrInterpreter))]
35+
// Apple mobile has interpreter-specific expectations below.
36+
[ActiveIssue("https://github.com/dotnet/runtime/issues/123011", typeof(PlatformDetection), nameof(PlatformDetection.IsCoreClrInterpreter), nameof(PlatformDetection.IsNotAppleMobile))]
3937
public static void DynamicCode_Jit()
4038
{
4139
if (PlatformDetection.IsNativeAot)

0 commit comments

Comments
 (0)