[K/N] Fix GC stats reporting sweep in wrong epoch ^KT-55364

Co-authored-by: Troels Lund <troels@google.com>

Merge-request: KOTLIN-MR-696
Merged-by: Alexander Shabalin <alexander.shabalin@jetbrains.com>
This commit is contained in:
Troels Bjerre Lund
2023-05-25 12:48:30 +00:00
committed by Space Cloud
parent 2fc5316c1b
commit 99e4ca65be
5 changed files with 6 additions and 5 deletions
@@ -37,7 +37,7 @@ class alignas(8) ExtraObjectPage {
public:
using GCSweepScope = gc::GCHandle::GCSweepExtraObjectsScope;
static GCSweepScope currentGCSweepScope() noexcept { return gc::GCHandle::currentEpoch()->sweepExtraObjects(); }
static GCSweepScope currentGCSweepScope(gc::GCHandle& handle) noexcept { return handle.sweepExtraObjects(); }
static ExtraObjectPage* Create(uint32_t ignored) noexcept;
@@ -32,7 +32,7 @@ class alignas(8) FixedBlockPage {
public:
using GCSweepScope = gc::GCHandle::GCSweepScope;
static GCSweepScope currentGCSweepScope() noexcept { return gc::GCHandle::currentEpoch()->sweep(); }
static GCSweepScope currentGCSweepScope(gc::GCHandle& handle) noexcept { return handle.sweep(); }
static FixedBlockPage* Create(uint32_t blockSize) noexcept;
@@ -20,7 +20,7 @@ class alignas(8) NextFitPage {
public:
using GCSweepScope = gc::GCHandle::GCSweepScope;
static GCSweepScope currentGCSweepScope() noexcept { return gc::GCHandle::currentEpoch()->sweep(); }
static GCSweepScope currentGCSweepScope(gc::GCHandle& handle) noexcept { return handle.sweep(); }
static NextFitPage* Create(uint32_t cellCount) noexcept;
@@ -48,9 +48,10 @@ public:
used_.Push(page);
return page;
}
auto handle = gc::GCHandle::currentEpoch();
if ((page = unswept_.Pop())) {
// If there're unswept_ pages, the GC is in progress.
GCSweepScope sweepHandle = T::currentGCSweepScope();
GCSweepScope sweepHandle = T::currentGCSweepScope(*handle);
if ((page = SweepSingle(sweepHandle, page, unswept_, used_, finalizerQueue))) {
return page;
}
@@ -19,7 +19,7 @@ class alignas(8) SingleObjectPage {
public:
using GCSweepScope = gc::GCHandle::GCSweepScope;
static GCSweepScope currentGCSweepScope() noexcept { return gc::GCHandle::currentEpoch()->sweep(); }
static GCSweepScope currentGCSweepScope(gc::GCHandle& handle) noexcept { return handle.sweep(); }
static SingleObjectPage* Create(uint64_t cellCount) noexcept;