Fix and re-enable some finalizer tests (#22771)
authorAndy Ayers <andya@microsoft.com>
Mon, 25 Feb 2019 23:50:03 +0000 (15:50 -0800)
committerGitHub <noreply@github.com>
Mon, 25 Feb 2019 23:50:03 +0000 (15:50 -0800)
Mark key allocating methods noinline, otherwise they may get inlined
under jit stress and leave jit temps referring to allocations that the test
expects should be collectible.

Resolves #19218.

tests/issues.targets
tests/src/GC/Features/Finalizer/finalizeother/finalizearray.cs
tests/src/GC/Features/Finalizer/finalizeother/finalizearraysleep.cs
tests/src/GC/Features/Finalizer/finalizeother/finalizedest.cs
tests/src/GC/Features/Finalizer/finalizeother/finalizeexcep.cs
tests/src/GC/Features/Finalizer/finalizeother/finalizeinherit.cs

index b56b85c..e72ea7d 100644 (file)
         <ExcludeList Include="$(XunitTestBinBase)/GC/Features/HeapExpansion/pluggaps/*">
             <Issue>needs triage</Issue>
         </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/GC/Features/Finalizer/finalizeother/finalizearray/*">
-            <Issue>19218</Issue>
-        </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/GC/Features/Finalizer/finalizeother/finalizearraysleep/*">
-            <Issue>19218</Issue>
-        </ExcludeList>
         <ExcludeList Include="$(XunitTestBinBase)/GC/Regressions/v2.0-beta2/460373/460373/*">
             <Issue>needs triage</Issue>
         </ExcludeList>
index 7b540c4..ef76dd7 100644 (file)
@@ -22,6 +22,8 @@ public class Test
     {
         public Dummy[] obj;
 
+        // No inline to ensure no stray refs to the new array
+        [MethodImplAttribute(MethodImplOptions.NoInlining)]
         public CreateObj() {
             obj = new Dummy[10000];
             for(int i=0;i<10000;i++) {
index 80a8ed2..bf6cba9 100644 (file)
@@ -22,6 +22,8 @@ public class Test {
         public Dummy[] obj;
         public int ExitCode = 0;               
 
+        // No inline to ensure no stray refs to the new array
+        [MethodImplAttribute(MethodImplOptions.NoInlining)]
         public CreateObj() {
             obj = new Dummy[10];
 
index a736ff9..cf132a0 100644 (file)
@@ -29,6 +29,8 @@ public class Test
         Dummy obj;
 #pragma warning restore 0414
 
+        // No inline to ensure no stray refs to the Dummy object
+        [MethodImplAttribute(MethodImplOptions.NoInlining)]
         public CreateObj()
         {
             obj = new Dummy();
index eed1395..c680b0d 100644 (file)
@@ -32,6 +32,8 @@ public class Test {
     public class CreateObj {
         public Dummy obj;
 
+        // No inline to ensure no stray refs to the Dummy object
+        [MethodImplAttribute(MethodImplOptions.NoInlining)]
         public CreateObj() {
             obj = new Dummy();
         }
index c24f0be..533f752 100644 (file)
@@ -55,6 +55,8 @@ namespace Three {
 #pragma warning restore 0414
         C c;
 
+        // No inline to ensure no stray refs to the B, C, D objects.
+        [MethodImplAttribute(MethodImplOptions.NoInlining)]
         public CreateObj()
         {
             b = new B();