Skip to content
Permalink
Browse files

8237645: Remove OopsInGenClosure::par_do_barrier

Reviewed-by: sjohanss
  • Loading branch information
stefank committed Jan 24, 2020
1 parent 17106c9 commit b223907794a6f04b4e3984de1230e66241ca9bdc
@@ -244,40 +244,6 @@ void ClearNoncleanCardWrapper::do_MemRegion(MemRegion mr) {
}
}

// clean (by dirty->clean before) ==> cur_younger_gen
// dirty ==> cur_youngergen_and_prev_nonclean_card
// precleaned ==> cur_youngergen_and_prev_nonclean_card
// prev-younger-gen ==> cur_youngergen_and_prev_nonclean_card
// cur-younger-gen ==> cur_younger_gen
// cur_youngergen_and_prev_nonclean_card ==> no change.
void CardTableRS::write_ref_field_gc_par(void* field, oop new_val) {
volatile CardValue* entry = byte_for(field);
do {
CardValue entry_val = *entry;
// We put this first because it's probably the most common case.
if (entry_val == clean_card_val()) {
// No threat of contention with cleaning threads.
*entry = cur_youngergen_card_val();
return;
} else if (card_is_dirty_wrt_gen_iter(entry_val)
|| is_prev_youngergen_card_val(entry_val)) {
// Mark it as both cur and prev youngergen; card cleaning thread will
// eventually remove the previous stuff.
CardValue new_val = cur_youngergen_and_prev_nonclean_card;
CardValue res = Atomic::cmpxchg(entry, entry_val, new_val);
// Did the CAS succeed?
if (res == entry_val) return;
// Otherwise, retry, to see the new value.
continue;
} else {
assert(entry_val == cur_youngergen_and_prev_nonclean_card
|| entry_val == cur_youngergen_card_val(),
"should be only possibilities.");
return;
}
} while (true);
}

void CardTableRS::younger_refs_in_space_iterate(Space* sp,
OopsInGenClosure* cl,
uint n_threads) {
@@ -124,11 +124,6 @@ class CardTableRS: public CardTable {
inline_write_ref_field_gc(field, new_val);
}

// Override. Might want to devirtualize this in the same fashion as
// above. Ensures that the value of the card for field says that it's
// a younger card in the current collection.
virtual void write_ref_field_gc_par(void* field, oop new_val);

bool is_aligned(HeapWord* addr) {
return is_card_aligned(addr);
}
@@ -57,9 +57,6 @@ class OopsInGenClosure : public OopIterateClosure {
// pointers must call the method below.
template <class T> void do_barrier(T* p);

// Version for use by closures that may be called in parallel code.
template <class T> void par_do_barrier(T* p);

public:
OopsInGenClosure() : OopIterateClosure(NULL),
_orig_gen(NULL), _gen(NULL), _gen_boundary(NULL), _rs(NULL) {};
@@ -62,17 +62,6 @@ template <class T> inline void OopsInGenClosure::do_barrier(T* p) {
}
}

template <class T> inline void OopsInGenClosure::par_do_barrier(T* p) {
assert(generation()->is_in_reserved(p), "expected ref in generation");
T heap_oop = RawAccess<>::oop_load(p);
assert(!CompressedOops::is_null(heap_oop), "expected non-null oop");
oop obj = CompressedOops::decode_not_null(heap_oop);
// If p points to a younger generation, mark the card.
if ((HeapWord*)obj < gen_boundary()) {
rs()->write_ref_field_gc_par(p, obj);
}
}

inline BasicOopsInGenClosure::BasicOopsInGenClosure(Generation* gen) : OopsInGenClosure(gen) {
}

0 comments on commit b223907

Please sign in to comment.