mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8376356
Hi all, please review this change to convert `PSCardTable` to use `Atomic<T>`. Testing: gha Thanks, Thomas
This commit is contained in:
parent
37cb22826a
commit
2235287548
@ -108,7 +108,7 @@ void PSCardTable::scan_obj_with_limit(PSPromotionManager* pm,
|
||||
}
|
||||
|
||||
void PSCardTable::pre_scavenge(uint active_workers) {
|
||||
_preprocessing_active_workers = active_workers;
|
||||
_preprocessing_active_workers.store_relaxed(active_workers);
|
||||
}
|
||||
|
||||
// The "shadow" table is a copy of the card table entries of the current stripe.
|
||||
@ -382,9 +382,9 @@ void PSCardTable::scavenge_contents_parallel(ObjectStartArray* start_array,
|
||||
preprocess_card_table_parallel(object_start, old_gen_bottom, old_gen_top, stripe_index, n_stripes);
|
||||
|
||||
// Sync with other workers.
|
||||
AtomicAccess::dec(&_preprocessing_active_workers);
|
||||
_preprocessing_active_workers.sub_then_fetch(1);
|
||||
SpinYield spin_yield;
|
||||
while (AtomicAccess::load_acquire(&_preprocessing_active_workers) > 0) {
|
||||
while (_preprocessing_active_workers.load_acquire() > 0) {
|
||||
spin_yield.wait();
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,6 +27,7 @@
|
||||
|
||||
#include "gc/shared/cardTable.hpp"
|
||||
#include "oops/oop.hpp"
|
||||
#include "runtime/atomic.hpp"
|
||||
|
||||
class MutableSpace;
|
||||
class ObjectStartArray;
|
||||
@ -37,7 +38,7 @@ class PSCardTable: public CardTable {
|
||||
static constexpr size_t num_cards_in_stripe = 128;
|
||||
static_assert(num_cards_in_stripe >= 1, "progress");
|
||||
|
||||
volatile int _preprocessing_active_workers;
|
||||
Atomic<int> _preprocessing_active_workers;
|
||||
|
||||
bool is_dirty(CardValue* card) {
|
||||
return !is_clean(card);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user