Skip to content

Commit

Permalink
8293023: Change CardTable::is_in_young signature
Browse files Browse the repository at this point in the history
Reviewed-by: kbarrett, iwalulya
  • Loading branch information
albertnetymk committed Sep 2, 2022
1 parent 26cac08 commit ce06a3b
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 25 deletions.
6 changes: 3 additions & 3 deletions src/hotspot/share/gc/g1/g1CardTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void G1CardTable::initialize(G1RegionToSpaceMapper* mapper) {
log_trace(gc, barrier)(" _byte_map_base: " INTPTR_FORMAT, p2i(_byte_map_base));
}

bool G1CardTable::is_in_young(oop obj) const {
volatile CardValue* p = byte_for(obj);
return *p == G1CardTable::g1_young_card_val();
bool G1CardTable::is_in_young(const void* p) const {
volatile CardValue* card = byte_for(p);
return *card == G1CardTable::g1_young_card_val();
}
8 changes: 4 additions & 4 deletions src/hotspot/share/gc/g1/g1CardTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class G1CardTableChangedListener : public G1MappingChangedListener {

void set_card_table(G1CardTable* card_table) { _card_table = card_table; }

virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled);
void on_commit(uint start_idx, size_t num_regions, bool zero_filled) override;
};

class G1CardTable : public CardTable {
Expand Down Expand Up @@ -117,12 +117,12 @@ class G1CardTable : public CardTable {
// Returns how many bytes of the heap a single byte of the Card Table corresponds to.
static size_t heap_map_factor() { return _card_size; }

void initialize() {}
void initialize() override {}
void initialize(G1RegionToSpaceMapper* mapper);

virtual void resize_covered_region(MemRegion new_region) { ShouldNotReachHere(); }
void resize_covered_region(MemRegion new_region) override { ShouldNotReachHere(); }

virtual bool is_in_young(oop obj) const;
bool is_in_young(const void* p) const override;
};

#endif // SHARE_GC_G1_G1CARDTABLE_HPP
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class ParallelScavengeHeap : public CollectedHeap {

bool is_in_reserved(const void* p) const;

bool is_in_young(const oop p) const;
bool is_in_young(const void* p) const;

virtual bool requires_barriers(stackChunkOop obj) const;

Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/gc/parallel/parallelScavengeHeap.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ inline void ParallelScavengeHeap::invoke_scavenge() {
PSScavenge::invoke();
}

inline bool ParallelScavengeHeap::is_in_young(const oop p) const {
inline bool ParallelScavengeHeap::is_in_young(const void* p) const {
// Assumes the old gen address range is lower than that of the young gen.
bool result = cast_from_oop<HeapWord*>(p) >= young_gen()->reserved().start();
bool result = p >= young_gen()->reserved().start();
assert(result == young_gen()->is_in_reserved(p),
"incorrect test - result=%d, p=" PTR_FORMAT, result, p2i((void*)p));
"incorrect test - result=%d, p=" PTR_FORMAT, result, p2i(p));
return result;
}
#endif // SHARE_GC_PARALLEL_PARALLELSCAVENGEHEAP_INLINE_HPP
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/parallel/psCardTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,6 @@ bool PSCardTable::addr_is_marked_precise(void *addr) {
return false;
}

bool PSCardTable::is_in_young(oop obj) const {
return ParallelScavengeHeap::heap()->is_in_young(obj);
bool PSCardTable::is_in_young(const void* p) const {
return ParallelScavengeHeap::heap()->is_in_young(p);
}
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/parallel/psCardTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class PSCardTable: public CardTable {
}

// ReduceInitialCardMarks support
bool is_in_young(oop obj) const;
bool is_in_young(const void* p) const override;

#ifdef ASSERT
bool is_valid_card_address(CardValue* addr) {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shared/cardTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class CardTable: public CHeapObj<mtGC> {
// before the beginning of the actual _byte_map.
CardValue* byte_map_base() const { return _byte_map_base; }

virtual bool is_in_young(oop obj) const = 0;
virtual bool is_in_young(const void* p) const = 0;

// Print a description of the memory for the card table
virtual void print_on(outputStream* st) const;
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/shared/cardTableRS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,6 @@ void CardTableRS::non_clean_card_iterate(Space* sp,
clear_cl.do_MemRegion(mr);
}

bool CardTableRS::is_in_young(oop obj) const {
return GenCollectedHeap::heap()->is_in_young(obj);
bool CardTableRS::is_in_young(const void* p) const {
return GenCollectedHeap::heap()->is_in_young(p);
}
6 changes: 3 additions & 3 deletions src/hotspot/share/gc/shared/cardTableRS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class CardTableRS : public CardTable {
}

void verify();
void initialize();
void initialize() override;

void clear_into_younger(Generation* old_gen);

Expand All @@ -76,7 +76,7 @@ class CardTableRS : public CardTable {
OopIterateClosure* cl,
CardTableRS* ct);

virtual bool is_in_young(oop obj) const;
bool is_in_young(const void* p) const override;
};

class ClearNoncleanCardWrapper: public MemRegionClosure {
Expand All @@ -95,7 +95,7 @@ class ClearNoncleanCardWrapper: public MemRegionClosure {

public:
ClearNoncleanCardWrapper(DirtyCardToOopClosure* dirty_card_closure, CardTableRS* ct);
void do_MemRegion(MemRegion mr);
void do_MemRegion(MemRegion mr) override;
};

#endif // SHARE_GC_SHARED_CARDTABLERS_HPP
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/shared/genCollectedHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,8 @@ void GenCollectedHeap::do_full_collection(bool clear_all_soft_refs,
}
}

bool GenCollectedHeap::is_in_young(oop p) const {
bool result = cast_from_oop<HeapWord*>(p) < _old_gen->reserved().start();
bool GenCollectedHeap::is_in_young(const void* p) const {
bool result = p < _old_gen->reserved().start();
assert(result == _young_gen->is_in_reserved(p),
"incorrect test - result=%d, p=" INTPTR_FORMAT, result, p2i((void*)p));
return result;
Expand Down
5 changes: 2 additions & 3 deletions src/hotspot/share/gc/shared/genCollectedHeap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,9 @@ class GenCollectedHeap : public CollectedHeap {
// restrict their use to assertion checking or verification only.
bool is_in(const void* p) const;

// Returns true if the reference is to an object in the reserved space
// for the young generation.
// Returns true if p points into the reserved space for the young generation.
// Assumes the young gen address range is less than that of the old gen.
bool is_in_young(oop p) const;
bool is_in_young(const void* p) const;

virtual bool requires_barriers(stackChunkOop obj) const;

Expand Down

1 comment on commit ce06a3b

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.