Minor nits

This commit is contained in:
Patrick Fontanilla 2026-08-03 22:34:57 +00:00
parent df004747a3
commit 610882cb78
3 changed files with 11 additions and 8 deletions

View File

@ -2467,18 +2467,19 @@ void ShenandoahHeap::unpin_object(JavaThread* thr, oop o) {
}
void ShenandoahHeap::flush_region_pin_cache(JavaThread* thr) {
size_t reg_idx_cached = ShenandoahThreadLocalData::pin_cache_region(thr);
size_t count = ShenandoahThreadLocalData::pin_cache_count(thr);
if (count != 0) {
get_region(ShenandoahThreadLocalData::pin_cache_region(thr))->inc_pin_count(count);
get_region(reg_idx_cached)->inc_pin_count(count);
}
ShenandoahThreadLocalData::pin_cache_set_region(thr, SIZE_MAX);
ShenandoahThreadLocalData::pin_cache_set_count(thr, 0);
}
void ShenandoahHeap::flush_region_pin_cache() {
assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint.");
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) {
flush_region_pin_cache(thread);
assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint");
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) {
flush_region_pin_cache(t);
}
}

View File

@ -686,9 +686,11 @@ public:
void pin_object(JavaThread* thread, oop obj) override;
void unpin_object(JavaThread* thread, oop obj) override;
// Updates each region's pin counts from the per-thread caches and resets them.
// Must be called before any decision based on pin counts.
// Flushes this thread's current pin count to its region's shared counter
// and resets the pin cache.
void flush_region_pin_cache(JavaThread* thread);
// Flushes all Java threads' pin counts.
void flush_region_pin_cache();
void sync_pinned_region_status();

View File

@ -257,8 +257,8 @@ public:
return data(thread)->_pin_count;
}
static void pin_cache_set_region(Thread* thread, size_t reg_idx_pin) {
data(thread)->_pin_region_idx = reg_idx_pin;
static void pin_cache_set_region(Thread* thread, size_t region_idx) {
data(thread)->_pin_region_idx = region_idx;
}
static void pin_cache_set_count(Thread* thread, size_t new_count) {