Skip to content

Commit 0823bee

Browse files
committed
* ayang review: _initiate_conc_mark_if_possible does not need to be volatile or Atomic at all
1 parent 4e8814d commit 0823bee

5 files changed

Lines changed: 6 additions & 21 deletions

File tree

src/hotspot/share/gc/g1/g1CollectorState.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,6 @@
2626
#include "runtime/safepoint.hpp"
2727
#include "utilities/debug.hpp"
2828

29-
G1CollectorState::G1CollectorState(const G1CollectorState& other) :
30-
_phase(other._phase), _initiate_conc_mark_if_possible(other.initiate_conc_mark_if_possible()) { }
31-
32-
G1CollectorState& G1CollectorState::operator=(const G1CollectorState& other) {
33-
if (this != &other) {
34-
_phase = other._phase;
35-
set_initiate_conc_mark_if_possible(other.initiate_conc_mark_if_possible());
36-
}
37-
return *this;
38-
}
39-
4029
G1CollectorState::Pause G1CollectorState::gc_pause_type(bool concurrent_operation_is_full_mark) const {
4130
assert(SafepointSynchronize::is_at_safepoint(), "must be");
4231
switch (_phase) {

src/hotspot/share/gc/g1/g1CollectorState.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#ifndef SHARE_GC_G1_G1COLLECTORSTATE_HPP
2626
#define SHARE_GC_G1_G1COLLECTORSTATE_HPP
2727

28-
#include "runtime/atomic.hpp"
2928
#include "utilities/debug.hpp"
3029
#include "utilities/enumIterator.hpp"
3130
#include "utilities/globalDefinitions.hpp"
@@ -60,16 +59,13 @@ class G1CollectorState {
6059
// has been in progress when the request came in.
6160
//
6261
// This flag remembers that there is an unfullfilled request.
63-
Atomic<bool> _initiate_conc_mark_if_possible;
62+
bool _initiate_conc_mark_if_possible;
6463

6564
public:
6665
G1CollectorState() :
6766
_phase(Phase::YoungNormal),
6867
_initiate_conc_mark_if_possible(false) { }
6968

70-
G1CollectorState(const G1CollectorState& other);
71-
G1CollectorState& operator=(const G1CollectorState& other);
72-
7369
// Phase setters
7470
inline void set_in_normal_young_gc();
7571
inline void set_in_space_reclamation_phase();

src/hotspot/share/gc/g1/g1CollectorState.inline.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ inline void G1CollectorState::set_in_prepare_mixed_gc() {
4949
}
5050

5151
inline void G1CollectorState::set_initiate_conc_mark_if_possible(bool v) {
52-
_initiate_conc_mark_if_possible.store_relaxed(v);
52+
_initiate_conc_mark_if_possible = v;
5353
}
5454

5555
inline bool G1CollectorState::is_in_young_only_phase() const {
@@ -72,7 +72,7 @@ inline bool G1CollectorState::is_in_concurrent_start_gc() const {
7272
}
7373

7474
inline bool G1CollectorState::initiate_conc_mark_if_possible() const {
75-
return _initiate_conc_mark_if_possible.load_relaxed();
75+
return _initiate_conc_mark_if_possible;
7676
}
7777

7878
inline bool G1CollectorState::is_in_concurrent_cycle() const {

src/hotspot/share/gc/g1/g1Policy.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,6 +1253,7 @@ void G1Policy::update_survivors_policy() {
12531253
}
12541254

12551255
bool G1Policy::force_concurrent_start_if_outside_cycle(GCCause::Cause gc_cause) {
1256+
assert_at_safepoint_on_vm_thread();
12561257
// We actually check whether we are marking here and not if we are in a
12571258
// reclamation phase. This means that we will schedule a concurrent mark
12581259
// even while we are still in the process of reclaiming memory.

src/hotspot/share/gc/g1/g1Policy.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,8 @@ class G1Policy: public CHeapObj<mtGC> {
335335

336336
public:
337337
// This sets the initiate_conc_mark_if_possible() flag to start a
338-
// new cycle, as long as we are not already in one. It's best if it
339-
// is called during a safepoint when the test whether a cycle is in
340-
// progress or not is stable.
338+
// new cycle, as long as we are not already in one. It is called
339+
// at a safepoint.
341340
bool force_concurrent_start_if_outside_cycle(GCCause::Cause gc_cause);
342341

343342
// Decide whether this garbage collection pause should be a concurrent start

0 commit comments

Comments
 (0)