From 5ea2a733e466fd10143583747a2eddf0ccad8666 Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Mon, 25 Feb 2019 15:50:03 -0800 Subject: [PATCH] Fix and re-enable some finalizer tests (dotnet/coreclr#22771) 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 dotnet/coreclr#19218. Commit migrated from https://github.com/dotnet/coreclr/commit/268a6b777febf10e97badede96dcddd54b54c4e1 --- src/coreclr/tests/issues.targets | 6 ------ .../tests/src/GC/Features/Finalizer/finalizeother/finalizearray.cs | 2 ++ .../src/GC/Features/Finalizer/finalizeother/finalizearraysleep.cs | 2 ++ .../tests/src/GC/Features/Finalizer/finalizeother/finalizedest.cs | 2 ++ .../tests/src/GC/Features/Finalizer/finalizeother/finalizeexcep.cs | 2 ++ .../src/GC/Features/Finalizer/finalizeother/finalizeinherit.cs | 2 ++ 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/coreclr/tests/issues.targets b/src/coreclr/tests/issues.targets index b56b85c..e72ea7d 100644 --- a/src/coreclr/tests/issues.targets +++ b/src/coreclr/tests/issues.targets @@ -115,12 +115,6 @@ needs triage - - 19218 - - - 19218 - needs triage diff --git a/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizearray.cs b/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizearray.cs index 7b540c4..ef76dd7 100644 --- a/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizearray.cs +++ b/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizearray.cs @@ -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++) { diff --git a/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizearraysleep.cs b/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizearraysleep.cs index 80a8ed2..bf6cba9 100644 --- a/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizearraysleep.cs +++ b/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizearraysleep.cs @@ -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]; diff --git a/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizedest.cs b/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizedest.cs index a736ff9..cf132a0 100644 --- a/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizedest.cs +++ b/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizedest.cs @@ -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(); diff --git a/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizeexcep.cs b/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizeexcep.cs index eed1395..c680b0d 100644 --- a/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizeexcep.cs +++ b/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizeexcep.cs @@ -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(); } diff --git a/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizeinherit.cs b/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizeinherit.cs index c24f0be..533f752 100644 --- a/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizeinherit.cs +++ b/src/coreclr/tests/src/GC/Features/Finalizer/finalizeother/finalizeinherit.cs @@ -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(); -- 2.7.4