Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make LambdaCompiler prefer interpretation to compilation on iOS #54970

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f4d448c
Make LambdaCompiler prefer interpretation to compilation on iOS
MaximLipnin Jun 30, 2021
c05dfd5
Simplify the condition
MaximLipnin Jun 30, 2021
bdac243
Merge branch 'main' into prefer_interp_for_lambda_compiler_on_ios
MaximLipnin Jul 1, 2021
c6ebcfd
Extend the IsInterpreting condition to the other apple mobile platforms
MaximLipnin Jul 1, 2021
dac905e
Extract a separate functional test
MaximLipnin Jul 1, 2021
0987d1f
Set the right condition for IsInterpreting property in the test cspro…
MaximLipnin Jul 2, 2021
ae5d13d
Merge branch 'main' into prefer_interp_for_lambda_compiler_on_ios
MaximLipnin Jul 2, 2021
79e2afd
Disable a couple of tests
MaximLipnin Jul 2, 2021
4f94240
Use PlatformDetection to check that System.Linq.Expressions was compi…
MaximLipnin Jul 2, 2021
01068dd
Disable failing System.Dynamic.Runtime library tests
MaximLipnin Jul 3, 2021
21e7084
Merge branch 'main' into prefer_interp_for_lambda_compiler_on_ios
MaximLipnin Jul 3, 2021
2520971
Address issue with Microsoft.VisualBasic.CompilerServices.Tests
MaximLipnin Jul 5, 2021
bb5abac
Merge branch 'main' into prefer_interp_for_lambda_compiler_on_ios
MaximLipnin Jul 5, 2021
9fa02a6
Fix build issue
MaximLipnin Jul 5, 2021
940a10d
Merge branch 'main' into prefer_interp_for_lambda_compiler_on_ios
MaximLipnin Jul 5, 2021
a4813f9
Revert the test
MaximLipnin Jul 5, 2021
c3a3530
Update the invariant functional test for ios simulator
MaximLipnin Jul 6, 2021
ab03032
Re-enable some SLE tests on tvOS
MaximLipnin Jul 6, 2021
7c6ee4f
Merge branch 'main' into prefer_interp_for_lambda_compiler_on_ios
MaximLipnin Jul 6, 2021
038b4d5
Disable Microsoft.CSharp library test suite due to app crash in CI
MaximLipnin Jul 6, 2021
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 @@ -3,6 +3,7 @@

using System.Diagnostics;
using System.IO;
using System.Linq.Expressions;
using System.Security;
using System.Security.Authentication;
using System.Reflection;
Expand Down Expand Up @@ -66,6 +67,22 @@ public static partial class PlatformDetection
public static bool IsUsingLimitedCultures => !IsNotMobile;
public static bool IsNotUsingLimitedCultures => IsNotMobile;

public static bool IsLinqExpressionsBuiltWithIsInterpretingOnly => s_LinqExpressionsBuiltWithIsInterpretingOnly.Value;
public static bool IsNotLinqExpressionsBuiltWithIsInterpretingOnly => !IsLinqExpressionsBuiltWithIsInterpretingOnly;
private static readonly Lazy<bool> s_LinqExpressionsBuiltWithIsInterpretingOnly = new Lazy<bool>(GetLinqExpressionsBuiltWithIsInterpretingOnly);
private static bool GetLinqExpressionsBuiltWithIsInterpretingOnly()
{
Type type = typeof(LambdaExpression);
if (type != null)
{
// The "Accept" method is under FEATURE_COMPILE conditional so it should not exist
MethodInfo methodInfo = type.GetMethod("Accept", BindingFlags.NonPublic | BindingFlags.Static);
return methodInfo == null;
}

return false;
}

// Please make sure that you have the libgdiplus dependency installed.
// For details, see https://docs.microsoft.com/dotnet/core/install/dependencies?pivots=os-macos&tabs=netcore31#libgdiplus
public static bool IsDrawingSupported
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static IEnumerable<object[]> LateCall_OptionalValues_Data()
static object[] CreateData(string memberName, object[] arguments, Type[] typeArguments, string expectedValue) => new object[] { memberName, arguments, typeArguments, expectedValue };
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotLinqExpressionsBuiltWithIsInterpretingOnly))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51834", typeof(PlatformDetection), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsBrowser))]
[MemberData(nameof(LateCall_OptionalValues_Data))]
public void LateCall_OptionalValues(string memberName, object[] arguments, Type[] typeArguments, string expectedValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,7 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.context.indexer.genclas
public class Test
{
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55118", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))]
public static void TryCatchFinally()
{
dynamic dy = new MemberClass<int>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,12 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.context.operate.compoun
// <RelatedBugs></RelatedBugs>
// <Expects Status=success></Expects>
// <Code>
using System;

public class Test
{
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55117", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))]
public static void DynamicCSharpRunTest()
{
Assert.Equal(0, MainMethod(null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public static int MainMethod(string[] args)

namespace ManagedTests.DynamicCSharp.Conformance.dynamic.declarations.formalParameter.Methods.extensionmethod006.extensionmethod006
{
using System;

static // <Title>Extension method that extends dynamic</Title>
// <Description>
// </Description>
Expand All @@ -115,6 +117,7 @@ public static string Foo(this object x, dynamic d)
public class Test
{
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55117", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))]
public static void DynamicCSharpRunTest()
{
Assert.Equal(0, MainMethod(null));
Expand Down Expand Up @@ -189,6 +192,8 @@ public static int Method(this Test t, int value)

namespace ManagedTests.DynamicCSharp.Conformance.dynamic.declarations.formalParameter.Methods.method001.method001
{
using System;

public class Test
{
private static bool s_ok = false;
Expand All @@ -203,6 +208,7 @@ public void Foo(dynamic d)
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55117", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))]
public static void DynamicCSharpRunTest()
{
Assert.Equal(0, MainMethod(null));
Expand Down Expand Up @@ -260,6 +266,8 @@ public static int MainMethod(string[] args)

namespace ManagedTests.DynamicCSharp.Conformance.dynamic.declarations.formalParameter.Methods.method003.method003
{
using System;

public class Test
{
private static bool s_ok = false;
Expand All @@ -273,6 +281,7 @@ public void Foo(dynamic d)
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55117", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))]
public static void DynamicCSharpRunTest()
{
Assert.Equal(0, MainMethod(null));
Expand All @@ -294,6 +303,8 @@ public static int MainMethod(string[] args)

namespace ManagedTests.DynamicCSharp.Conformance.dynamic.declarations.formalParameter.Methods.method004.method004
{
using System;

public class Test
{
private static bool s_ok = false;
Expand All @@ -306,6 +317,7 @@ public void Foo(ref dynamic d)
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55117", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))]
public static void DynamicCSharpRunTest()
{
Assert.Equal(0, MainMethod(null));
Expand All @@ -330,6 +342,8 @@ public static int MainMethod(string[] args)

namespace ManagedTests.DynamicCSharp.Conformance.dynamic.declarations.formalParameter.Methods.method005.method005
{
using System;

public class Test
{
private static bool s_ok = false;
Expand All @@ -345,6 +359,7 @@ public void Foo(params dynamic[] d)
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55117", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))]
public static void DynamicCSharpRunTest()
{
Assert.Equal(0, MainMethod(null));
Expand All @@ -367,6 +382,8 @@ public static int MainMethod(string[] args)

namespace ManagedTests.DynamicCSharp.Conformance.dynamic.declarations.formalParameter.Methods.method007.method007
{
using System;

public class Test
{
private static bool s_ok = false;
Expand All @@ -380,6 +397,7 @@ public void Foo(dynamic d, dynamic d2)
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55117", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))]
public static void DynamicCSharpRunTest()
{
Assert.Equal(0, MainMethod(null));
Expand All @@ -403,6 +421,8 @@ public static int MainMethod(string[] args)

namespace ManagedTests.DynamicCSharp.Conformance.dynamic.declarations.formalParameter.Methods.method008.method008
{
using System;

public class Test
{
private static bool s_ok = false;
Expand All @@ -416,6 +436,7 @@ public void Foo(dynamic d, int d2)
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55117", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))]
public static void DynamicCSharpRunTest()
{
Assert.Equal(0, MainMethod(null));
Expand All @@ -438,6 +459,8 @@ public static int MainMethod(string[] args)

namespace ManagedTests.DynamicCSharp.Conformance.dynamic.declarations.formalParameter.Methods.method009.method009
{
using System;

public class Test
{
private static bool s_ok = false;
Expand All @@ -451,6 +474,7 @@ public void Foo(dynamic d, dynamic d2, dynamic d3)
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55117", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))]
public static void DynamicCSharpRunTest()
{
Assert.Equal(0, MainMethod(null));
Expand All @@ -473,6 +497,8 @@ public static int MainMethod(string[] args)

namespace ManagedTests.DynamicCSharp.Conformance.dynamic.declarations.formalParameter.Methods.method010.method010
{
using System;

public class Test
{
private static bool s_ok = false;
Expand All @@ -488,6 +514,7 @@ public MyClass(params dynamic[] d)
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55117", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))]
public static void DynamicCSharpRunTest()
{
Assert.Equal(0, MainMethod(null));
Expand All @@ -509,6 +536,8 @@ public static int MainMethod(string[] args)

namespace ManagedTests.DynamicCSharp.Conformance.dynamic.declarations.formalParameter.Methods.method011.method011
{
using System;

public class Test
{
private static bool s_ok = false;
Expand All @@ -523,6 +552,7 @@ public static void Foo(dynamic d)
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55117", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))]
public static void DynamicCSharpRunTest()
{
Assert.Equal(0, MainMethod(null));
Expand All @@ -543,6 +573,8 @@ public static int MainMethod(string[] args)

namespace ManagedTests.DynamicCSharp.Conformance.dynamic.declarations.formalParameter.Methods.method012.method012
{
using System;

public class Test
{
private static bool s_ok = false;
Expand All @@ -555,6 +587,7 @@ public void Foo<T>(ref dynamic d)
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55117", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))]
public static void DynamicCSharpRunTest()
{
Assert.Equal(0, MainMethod(null));
Expand All @@ -579,6 +612,8 @@ public static int MainMethod(string[] args)

namespace ManagedTests.DynamicCSharp.Conformance.dynamic.declarations.formalParameter.Methods.method013.method013
{
using System;

public class Test
{
private static bool s_ok = false;
Expand All @@ -591,6 +626,7 @@ public void Foo<T>(T d)
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55117", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))]
public static void DynamicCSharpRunTest()
{
Assert.Equal(0, MainMethod(null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1189,9 +1189,12 @@ from d in numbers

namespace ManagedTests.DynamicCSharp.Conformance.dynamic.declarations.localVariable.blockVariable.trycatch002.trycatch002
{
using System;

public class Test
{
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55117", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))]
public static void DynamicCSharpRunTest()
{
Assert.Equal(0, MainMethod(null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4356,6 +4356,8 @@ public static int MainMethod()

namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.conversions.dlgate003.dlgate003
{
using System;

// <Title>Delegate conversions</Title>
// <Description>
// Tests to figure out if the right conversion from method groups to delegates are applied
Expand All @@ -4375,6 +4377,7 @@ public static object Foo()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55117", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))]
public static void DynamicCSharpRunTest()
{
Assert.Equal(0, MainMethod());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,8 @@ public static int MainMethod(string[] args)

namespace ManagedTests.DynamicCSharp.Conformance.dynamic.overloadResolution.Indexers.Oneclass2indexers.onedynamicparam004.onedynamicparam004
{
using System;

// <Title> Tests overload resolution for 1 class and 2 methods</Title>
// <Description>
// </Description>
Expand Down Expand Up @@ -720,6 +722,7 @@ public object this[object x]
public class Test
{
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55117", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))]
public static void DynamicCSharpRunTest()
{
Assert.Equal(0, MainMethod(null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,8 @@ public static int MainMethod(string[] args)

namespace ManagedTests.DynamicCSharp.Conformance.dynamic.overloadResolution.Methods.Oneclass2methods.onedynamicparam004.onedynamicparam004
{
using System;

// <Title> Tests overload resolution for 1 class and 2 methods</Title>
// <Description>
// </Description>
Expand Down Expand Up @@ -530,6 +532,7 @@ public void Method(object x)
public class Test
{
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55117", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))]
public static void DynamicCSharpRunTest()
{
Assert.Equal(0, MainMethod(null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,8 @@ public static int MainMethod()

namespace ManagedTests.DynamicCSharp.Conformance.dynamic.Variance.assign.assignment07.assignment07
{
using System;

// <Area>variance</Area>
// <Title> assignment Contravariant delegates</Title>
// <Description> contravariance on delegates assigned to arrays</Description>
Expand All @@ -499,6 +501,7 @@ public class C
private static dynamic s_array3;

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55119", typeof(PlatformDetection), nameof(PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly))]
public static void DynamicCSharpRunTest()
{
Assert.Equal(0, MainMethod());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>67,168,219,414,162,184,458,464,78,169,114,693,108,1981,649,109,1066,3021,3026,3002,3014,3022,660,661,429;xUnit1013</NoWarn>
<TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-MacCatalyst</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<AssembliesBeingTested Include="Microsoft.CSharp" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<FeatureInterpret>true</FeatureInterpret>
<TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-MacCatalyst</TargetFrameworks>
<Nullable>enable</Nullable>
<IsInterpreting>false</IsInterpreting>
<IsInterpreting Condition="'$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true' or '$(TargetsMacCatalyst)' == 'true'">true</IsInterpreting>
MaximLipnin marked this conversation as resolved.
Show resolved Hide resolved
<DefineConstants> $(DefineConstants);FEATURE_DLG_INVOKE;FEATURE_FAST_CREATE</DefineConstants>
<DefineConstants Condition=" '$(IsInterpreting)' != 'true' ">$(DefineConstants);FEATURE_COMPILE</DefineConstants>
<DefineConstants Condition=" '$(FeatureInterpret)' == 'true' ">$(DefineConstants);FEATURE_INTERPRET</DefineConstants>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ internal static Expression<TDelegate> Create(Expression body, string? name, bool

#if !FEATURE_COMPILE
// Separate expression creation class to hide the CreateExpressionFunc function from users reflecting on Expression<T>
public class ExpressionCreator<TDelegate>
internal static class ExpressionCreator<TDelegate>
{
public static Expression<TDelegate> CreateExpressionFunc(Expression body, string? name, bool tailCall, ReadOnlyCollection<ParameterExpression> parameters)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

namespace System.Linq.Expressions.Tests
{
[ActiveIssue("https://github.com/dotnet/runtime/issues/51952", TestPlatforms.tvOS)]
public static class ArrayArrayIndexTests
{
#region Boolean tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

namespace System.Linq.Expressions.Tests
{
[ActiveIssue("https://github.com/dotnet/runtime/issues/51952", TestPlatforms.tvOS)]
public static class ArrayIndexTests
{
#region Boolean tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

namespace System.Linq.Expressions.Tests
{
[ActiveIssue("https://github.com/dotnet/runtime/issues/51952", TestPlatforms.tvOS)]
public static class NullableArrayIndexTests
{
#region NullableBool tests
Expand Down
Loading