From 4f8dad3e4ba00e23b4182ef4c50194b20bd43c8f Mon Sep 17 00:00:00 2001 From: Pavel Kunyavskiy Date: Tue, 20 Dec 2022 15:41:34 +0100 Subject: [PATCH] [K/N] Fix notification order in finalizers In before thread waiting for finalizers done could be unsuspended before statistics about finalization is written. Probably it doesn't affect real code, but it can lead to test failures. --- kotlin-native/runtime/src/gc/cms/cpp/ConcurrentMarkAndSweep.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kotlin-native/runtime/src/gc/cms/cpp/ConcurrentMarkAndSweep.cpp b/kotlin-native/runtime/src/gc/cms/cpp/ConcurrentMarkAndSweep.cpp index c0a9ba07464..644ae6f3d71 100644 --- a/kotlin-native/runtime/src/gc/cms/cpp/ConcurrentMarkAndSweep.cpp +++ b/kotlin-native/runtime/src/gc/cms/cpp/ConcurrentMarkAndSweep.cpp @@ -103,8 +103,8 @@ gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep( #endif gcScheduler_(gcScheduler), finalizerProcessor_(std_support::make_unique([this](int64_t epoch) { - state_.finalized(epoch); GCHandle::getByEpoch(epoch).finalizersDone(); + state_.finalized(epoch); })) { gcScheduler_.SetScheduleGC([this]() NO_INLINE { RuntimeLogDebug({kTagGC}, "Scheduling GC by thread %d", konan::currentThreadId());