Skip to content

Commit c4e410a

Browse files
lewingCopilot
andcommitted
Make InterpreterActive mean code runs in the interpreter
InterpreterActive was true for every wasm run, including ReadyToRun, and never true on Apple mobile, which has no JIT. Define it as DOTNET_Interpreter/InterpMode, or no JIT without ReadyToRun, and set TEST_READY_TO_RUN_MODE=1 in Apple mobile runtime-test apps when they are ReadyToRun-compiled so the runtime can tell. Tests this now runs on wasm ReadyToRun: GetGeneration fails there (#134803, quarantined), and ManagedPointers.Validate_GeneratedILStubs_NullByRef hits the interpreter even with ReadyToRun, so it now requires a JIT via Utilities.IsNotCoreClrInterpreter. Co-authored-by: Copilot App <[email protected]>
1 parent 5db12a3 commit c4e410a

5 files changed

Lines changed: 13 additions & 5 deletions

File tree

‎src/tests/Common/CoreCLRTestLibrary/CoreClrConfigurationDetection.cs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System;
66
using System.Globalization;
77
using System.Reflection;
8+
using System.Runtime.CompilerServices;
89
using System.Runtime.InteropServices;
910
using System.Security;
1011
using System.Text;
@@ -27,13 +28,13 @@ public static bool IsCoreClrInterpreter
2728
{
2829
get
2930
{
30-
// WASM-TODO: update when codegen is in place
31-
if (PlatformDetection.IsWasm)
32-
return true;
3331
if (!string.IsNullOrWhiteSpace(GetEnvironmentVariableValue("Interpreter", "")))
3432
return true;
3533
if (int.TryParse(GetEnvironmentVariableValue("InterpMode", "0"), out int mode) && (mode > 0))
3634
return true;
35+
// Without a JIT (WebAssembly, Apple mobile), code that isn't ReadyToRun-compiled runs in the interpreter.
36+
if (RuntimeFeature.IsDynamicCodeSupported && !RuntimeFeature.IsDynamicCodeCompiled && !PlatformDetection.IsReadyToRunCompiled)
37+
return true;
3738
return false;
3839
}
3940
}

‎src/tests/Common/XUnitWrapperGenerator/RuntimeTestModes.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ public enum RuntimeTestModes
4444

4545
HeapVerify = 1 << 9, // DOTNET_HeapVerify (or COMPlus_HeapVerify) is set.
4646

47-
InterpreterActive = 1 << 10, // DOTNET_Interpreter != "" or DOTNET_InterpMode != 0
47+
InterpreterActive = 1 << 10, // DOTNET_Interpreter != "", DOTNET_InterpMode != 0, or no JIT and not ReadyToRun-compiled (TEST_READY_TO_RUN_MODE != 1)
4848
}
4949
}

‎src/tests/Common/mergedrunnermobile.targets‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
<RuntimePackAsset Include="$(TargetingPackPath)/*.dll" AssetType="runtime" />
3232
</ItemGroup>
3333

34+
<!-- Lets PlatformDetection.IsReadyToRunCompiled (and the InterpreterActive test mode) see that test code is precompiled. -->
35+
<ItemGroup Condition="'$(TargetsAppleMobile)' == 'true' and '$(UseMonoRuntime)' != 'true' and '$(UseNativeAOTRuntime)' != 'true' and '$(PublishReadyToRun)' == 'true'">
36+
<EnvironmentVariables Include="TEST_READY_TO_RUN_MODE=1" />
37+
</ItemGroup>
38+
3439
<!-- F# tests load FSharp.Core from CORE_ROOT elsewhere; the app bundle has to carry it. -->
3540
<Target Name="_AddFSharpCoreToMobileRunner"
3641
AfterTargets="ResolveAssemblyReferences"

‎src/tests/GC/API/GC/GetGeneration.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public bool RunTests()
122122
[ActiveIssue("needs triage", TestRuntimes.Mono)]
123123
[SkipOnCoreClr("This test is not compatible with GC stress.", RuntimeTestModes.AnyGCStress)]
124124
[SkipOnCoreClr("Interpreter reports locals as pinned, causing generation demotion that this test does not expect.", RuntimeTestModes.InterpreterActive)]
125+
[ActiveIssue("https://github.com/dotnet/runtime/issues/134803", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmReadyToRun))]
125126
[Fact]
126127
public static int TestEntryPoint()
127128
{

‎src/tests/baseservices/invalid_operations/ManagedPointers.cs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ public static void Validate_BoxingHelpers_NullByRef()
3535
[ActiveIssue("Function mismatch", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
3636
[ActiveIssue("Function mismatch", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoRuntime))]
3737
[ActiveIssue("Doesn't compile with LLVM AOT.", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoAnyAOT))]
38-
[Fact]
38+
// Without a JIT the marshalled calli still reaches the interpreter in ReadyToRun mode (InvalidProgramException on wasm R2R).
39+
[ConditionalFact(typeof(Utilities), nameof(Utilities.IsNotCoreClrInterpreter))]
3940
[Xunit.SkipOnCoreClrAttribute("Depends on marshalled calli", RuntimeTestModes.InterpreterActive)]
4041
public static void Validate_GeneratedILStubs_NullByRef()
4142
{

0 commit comments

Comments
 (0)