diff options
author | Jan Kotas <jkotas@microsoft.com> | 2016-03-30 20:49:26 -0700 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2016-03-30 20:49:26 -0700 |
commit | c4378e7f0773577e9924ff4ebad0cc3af43fb3a8 (patch) | |
tree | af168084053193343e78d9d2cc3852ee1a86c2c2 /tests/src | |
parent | 6a2e3b34c3c9ac32456d38567b9f44ab6aea2f63 (diff) | |
download | coreclr-c4378e7f0773577e9924ff4ebad0cc3af43fb3a8.tar.gz coreclr-c4378e7f0773577e9924ff4ebad0cc3af43fb3a8.tar.bz2 coreclr-c4378e7f0773577e9924ff4ebad0cc3af43fb3a8.zip |
Fix R2R fixups for delegate ctors
- Add getReadyToRunDelegateHelper to JIT-EE interface. This method has an extra argument describing the type of the delegate. This argument is required to emit correct fixups.
- Call the new method in both JIT and JIT32
- Add the new method to superpmi
- Bump minor version of R2R file format
- Add regression test for #3975 to R2R unit test
Fixes https://github.com/dotnet/coreclr/issues/3975
[tfs-changeset: 1591698]
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/readytorun/main.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/src/readytorun/main.cs b/tests/src/readytorun/main.cs index 427ca42340..70157bc278 100644 --- a/tests/src/readytorun/main.cs +++ b/tests/src/readytorun/main.cs @@ -40,6 +40,15 @@ class InheritingFromGrowingBase : GrowingBase public int x; } + +static class OpenClosedDelegateExtension +{ + public static string OpenClosedDelegateTarget(this string x, string foo) + { + return x + ", " + foo; + } +} + class Program { static void TestVirtualMethodCalls() @@ -335,6 +344,18 @@ class Program Assert.AreEqual(o.ChildByte, (byte)67); } + static void TestOpenClosedDelegate() + { + // This test is verifying the the fixups for open vs. closed delegate created against the same target + // method are encoded correctly. + + Func<string, string, object> idOpen = OpenClosedDelegateExtension.OpenClosedDelegateTarget; + Assert.AreEqual(idOpen("World", "foo"), "World, foo"); + + Func<string, object> idClosed = "World".OpenClosedDelegateTarget; + Assert.AreEqual(idClosed("hey"), "World, hey"); + } + static void RunAllTests() { TestVirtualMethodCalls(); @@ -380,6 +401,8 @@ class Program TestCastClassCSE(); TestRangeCheckElimination(); + + TestOpenClosedDelegate(); } static int Main() |