Skip to content

Conversation

@pavelsavara
Copy link
Member

@pavelsavara pavelsavara commented Jan 19, 2026

Contributes to #123224

@pavelsavara pavelsavara added this to the 11.0.0 milestone Jan 19, 2026
@pavelsavara pavelsavara self-assigned this Jan 19, 2026
@pavelsavara pavelsavara added arch-wasm WebAssembly architecture os-browser Browser variant of arch-wasm area-CodeGen-Interpreter-coreclr labels Jan 19, 2026
@pavelsavara pavelsavara changed the title [browser][coreCLR] [browser][coreCLR] IsCoreCLRInterpreter and runtimeVariant: coreclrinterpreter Jan 19, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @BrzVlad, @janvorli, @kg
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@jkoritzinsky jkoritzinsky left a comment

Choose a reason for hiding this comment

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

runtimevariant was added for Mono because the runtime would be built fundamentally differently depending on variant. That's not the case for how we build CoreCLR, so I don't think using it applies in the same way.

@pavelsavara pavelsavara changed the title [browser][coreCLR] IsCoreCLRInterpreter and runtimeVariant: coreclrinterpreter [browser][coreCLR] use IsCoreCLRInterpreter Jan 19, 2026
@pavelsavara pavelsavara marked this pull request as ready for review January 19, 2026 18:46
Copilot AI review requested due to automatic review settings January 19, 2026 18:46
@pavelsavara pavelsavara enabled auto-merge (squash) January 19, 2026 18:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR contributes to issue #123224 by introducing a unified IsInterpreter property in PlatformDetection that combines checks for both Mono and CoreCLR interpreters, and updates test code to use this new property where appropriate.

Changes:

  • Introduces IsInterpreter and IsNotInterpreter properties in PlatformDetection.cs that combine both IsMonoInterpreter and IsCoreClrInterpreter checks
  • Updates test files to use the new IsInterpreter property or add IsCoreClrInterpreter checks where appropriate
  • Improves consistency in interpreter detection across the test suite

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs Adds IsInterpreter and IsNotInterpreter properties that combine both interpreter types
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.cs Updates TestDepth test to use IsInterpreter instead of IsMonoInterpreter
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/AssemblyInfo.cs Updates ActiveIssue attribute to use IsInterpreter instead of IsMonoInterpreter
src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/JitInfoTests.cs Adds IsCoreClrInterpreter checks alongside existing IsMonoInterpreter checks

pavelsavara and others added 2 commits January 20, 2026 20:49
…/Runtime/JitInfoTests.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
…/Runtime/JitInfoTests.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@pavelsavara
Copy link
Member Author

It seems Mono interpreter has similar issues with time on other platforms too, not just browser.

Build linux-x64 Debug Mono_Interpreter_LibrariesTests

System.Runtime.Tests.JitInfoTests.JitInfoIsPopulated [FAIL]
      CompilationTime: after not greater than before! (after: 00:00:00.0059694, before: 00:00:00.0059694)
      Stack Trace:
        /_/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/JitInfoTests.cs(75,0): at System.Runtime.Tests.JitInfoTests.JitInfoIsPopulated()
        /_/src/mono/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.Mono.cs(22,0): at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
        /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs(57,0): at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

maccatalyst-arm64 Release AllSubsets_Mono_Smoke
maccatalyst-x64 Release AllSubsets_Mono_Smoke

[02:35:51] dbug: 2026-01-21 02:35:26.697 Df System.Runtime.Tests[73939:10814a] 	[FAIL] System.Runtime.Tests.JitInfoTests.JitInfoIsPopulated
[02:35:51] dbug: CompilationTime: after not greater than before! (after: 00:00:00, before: 00:00:00)
[02:35:51] dbug: at System.Runtime.Tests.JitInfoTests.JitInfoIsPopulated()
[02:35:51] dbug: 2026-01-21 02:35:26.697 Df System.Runtime.Tests[73939:10814a]    at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
[02:35:51] dbug: at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
[02:35:51] dbug: 2026-01-21 02:35:26.698 Df System.Runtime.Tests[73939:10814a] System.Runtime.Tests.JitInfoTests 0.0011335 ms
[02:35:51] dbug: 2026-01-21 02:35:26.698 Df System.Runtime.Tests[73939:10814a]
[02:35:51] dbug: Test collection for System.Diagnostics.CodeAnalysis.Tests.FeatureSwitchDefinitionAttributeTests

@jkotas
Copy link
Member

jkotas commented Jan 21, 2026

It seems Mono interpreter has similar issues with time on other platforms too, not just browser.

It looks more like this API is broken with Mono interpreter (it does not track time spent by JITing the methods to interpreter bytecode), nothing to do with timers.

@kg
Copy link
Member

kg commented Jan 21, 2026

It seems Mono interpreter has similar issues with time on other platforms too, not just browser.

It looks more like this API is broken with Mono interpreter (it does not track time spent by JITing the methods to interpreter bytecode), nothing to do with timers.

We may have intentionally disabled it because sampling the current time in emscripten is extremely expensive. I vaguely recall doing something like that while optimizing startup in the past, though I can't guarantee that's what's going on here

@pavelsavara
Copy link
Member Author

linux-x64 Debug Mono_Interpreter_LibrariesTests

System.Runtime.Tests.JitInfoTests.JitInfoIsPopulated [FAIL]
      Compiled IL bytes: after not greater than before! (after: 1341, before: 1341)
      Stack Trace:
        /_/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/JitInfoTests.cs(78,0): at System.Runtime.Tests.JitInfoTests.JitInfoIsPopulated()
        /_/src/mono/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.Mono.cs(22,0): at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
        /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs(57,0): at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

@pavelsavara pavelsavara changed the title [browser][coreCLR] use IsCoreCLRInterpreter [browser][coreCLR] JitInfoIsPopulated Jan 21, 2026
pavelsavara and others added 2 commits January 21, 2026 18:12
…/Runtime/JitInfoTests.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
…/Runtime/JitInfoTests.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@pavelsavara pavelsavara merged commit 3fa6e43 into dotnet:main Jan 22, 2026
86 of 88 checks passed
@pavelsavara pavelsavara deleted the browser_clr_fix_JitInfoIsPopulated branch January 22, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-CodeGen-Interpreter-coreclr os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants