Fix WeakReference tests depending on JIT not extending lifetimes
authorRuss Keldorph <Russ.Keldorph@microsoft.com>
Thu, 9 Jun 2016 17:36:44 +0000 (10:36 -0700)
committerRuss Keldorph <Russ.Keldorph@microsoft.com>
Thu, 9 Jun 2016 17:41:08 +0000 (10:41 -0700)
commite784d4d1c82adea07d6e5e118b1ae6624c7e0d8b
tree59e8a559423cd07f55b9028a0a1c8cb1bdad5d49
parent20fcbd02607d1d768061f2be4702d55b45d9920c
Fix WeakReference tests depending on JIT not extending lifetimes

Target and IsAlive_neg are failing in some cases when JIT optimization is
disabled because the JIT (legally) generates code that holds a reference
to an object longer than expected.  Instead of forcing optimization on for
these tests, I'm using the pattern of moving the problematic object
reference to a non-inlined helper method.

Fixes #5555
tests/src/GC/API/WeakReference/IsAlive_neg.cs
tests/src/GC/API/WeakReference/Target.cs