Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public static partial class PlatformDetection
public static bool IsNetCore => Environment.Version.Major >= 5 || RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase);
public static bool IsMonoRuntime => Type.GetType("Mono.RuntimeStructs") != null;
public static bool IsNotMonoRuntime => !IsMonoRuntime;
public static bool IsInterpreter => IsMonoInterpreter || IsCoreClrInterpreter;
public static bool IsNotInterpreter => !IsInterpreter;
public static bool IsMonoInterpreter => GetIsRunningOnMonoInterpreter();
public static bool IsNotMonoInterpreter => !IsMonoInterpreter;
public static bool IsMonoAOT => Environment.GetEnvironmentVariable("MONO_AOT_MODE") == "aot";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,26 @@ public void JitInfoIsPopulated()
Assert.True(beforeCompiledMethodCount > 0, $"Compiled method count not greater than 0! ({beforeCompiledMethodCount})");
}

if (PlatformDetection.IsMonoInterpreter)
//
// Mono does not include compilation of IL into interpreter byte code in these counters
//
if (PlatformDetection.IsMonoInterpreter || PlatformDetection.IsBrowser)
{
// Before and after will most likely be the same with the interpreter
// Before and after can be same in browser because of low precision timers
Assert.True(afterCompilationTime >= beforeCompilationTime, $"CompilationTime: after not greater than before! (after: {afterCompilationTime}, before: {beforeCompilationTime})");
}
else
{
Assert.True(afterCompilationTime > beforeCompilationTime, $"CompilationTime: after not greater than before! (after: {afterCompilationTime}, before: {beforeCompilationTime})");
}

if (PlatformDetection.IsMonoInterpreter)
{
Assert.True(afterCompiledILBytes >= beforeCompiledILBytes, $"Compiled IL bytes: after not greater than before! (after: {afterCompiledILBytes}, before: {beforeCompiledILBytes})");
Assert.True(afterCompiledMethodCount >= beforeCompiledMethodCount, $"Compiled method count: after not greater than before! (after: {afterCompiledMethodCount}, before: {beforeCompiledMethodCount})");
}
else
{
Assert.True(afterCompilationTime > beforeCompilationTime, $"CompilationTime: after not greater than before! (after: {afterCompilationTime}, before: {beforeCompilationTime})");
Assert.True(afterCompiledILBytes > beforeCompiledILBytes, $"Compiled IL bytes: after not greater than before! (after: {afterCompiledILBytes}, before: {beforeCompiledILBytes})");
Assert.True(afterCompiledMethodCount > beforeCompiledMethodCount, $"Compiled method count: after not greater than before! (after: {afterCompiledMethodCount}, before: {beforeCompiledMethodCount})");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
using System;
using Xunit;

[assembly: ActiveIssue("Interpreter with debug runtime can be very slow", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter), nameof(PlatformDetection.IsDebugRuntime))]
[assembly: ActiveIssue("Interpreter with debug runtime can be very slow", typeof(PlatformDetection), nameof(PlatformDetection.IsInterpreter), nameof(PlatformDetection.IsDebugRuntime))]
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,7 @@ public static void TestPartialJsonReaderSlicesSpecialNumbers(TestCaseType type,
[InlineData(512)]
public static void TestDepth(int depth)
{
if (PlatformDetection.IsMonoInterpreter && depth >= 256)
if (PlatformDetection.IsInterpreter && depth >= 256)
{
throw new SkipTestException("Takes very long to run on interpreter.");
}
Expand Down