[K/N] Use already dereferenced weakReferee (KT-66371)

And prevent weak barriers from execution during STW

Merge-request: KT-MR-14797
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
This commit is contained in:
Aleksei.Glushko
2024-03-13 14:43:59 +00:00
committed by Space Team
parent 284d5437e5
commit f2501ad424
2 changed files with 10 additions and 1 deletions
@@ -87,6 +87,9 @@ void gc::mark::ConcurrentMark::runMainInSTW() {
gc::processWeaks<DefaultProcessWeaksTraits>(gcHandle(), mm::SpecialRefRegistry::instance());
if (!terminateInSTW) {
// Mutator threads execute weak barrier in "native" state. This hack maes them stop with the rest of the world.
std::unique_lock markTerminationGuard(markTerminationMutex_);
stopTheWorld(gcHandle(), "GC stop the world #2: prepare to sweep");
}