Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordotnet-bot <dotnet-bot@microsoft.com>2017-08-26 23:46:42 +0300
committerdotnet-bot <dotnet-bot@microsoft.com>2017-08-26 23:46:42 +0300
commite522eee8239cd50fed6571f7d485e77930461a0c (patch)
tree034726a962b73ca4efde90d415a6b24988e5cad5 /src/Native
parentc9b68da855f46b02aeb3540b812078da1ca40b17 (diff)
Fixing a bug in the GCStress implementation where RhpGcStressProbe trashes the last error value . This is done by saving the last error value (using GetLastError) before calling GarbageCollect and then restoring it (using SetLastError). Therefore, re-enabling the tests that were disabled for GC runs in response of Bug 477586 and 477587. Changing StressGc method to have a single return point.
[tfs-changeset: 1671927]
Diffstat (limited to 'src/Native')
-rw-r--r--src/Native/Runtime/gcrhenv.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Native/Runtime/gcrhenv.cpp b/src/Native/Runtime/gcrhenv.cpp
index 477661a68..8a50a25cf 100644
--- a/src/Native/Runtime/gcrhenv.cpp
+++ b/src/Native/Runtime/gcrhenv.cpp
@@ -598,12 +598,17 @@ EXTERN_C UInt32_BOOL g_fGcStressStarted = UInt32_FALSE; // UInt32_BOOL because a
// static
void RedhawkGCInterface::StressGc()
{
- if (!g_fGcStressStarted || GetThread()->IsSuppressGcStressSet() || GetThread()->IsDoNotTriggerGcSet())
+ // The GarbageCollect operation below may trash the last win32 error. We save the error here so that it can be
+ // restored after the GC operation;
+ Int32 lastErrorOnEntry = PalGetLastError();
+
+ if (g_fGcStressStarted && !GetThread()->IsSuppressGcStressSet() && !GetThread()->IsDoNotTriggerGcSet())
{
- return;
+ GCHeapUtilities::GetGCHeap()->GarbageCollect();
}
- GCHeapUtilities::GetGCHeap()->GarbageCollect();
+ // Restore the saved error
+ PalSetLastError(lastErrorOnEntry);
}
#endif // FEATURE_GC_STRESS