8282620: G1/Parallel: Constify is_in_young() predicates

Reviewed-by: iwalulya, ayang
This commit is contained in:
Thomas Schatzl 2022-03-07 13:52:19 +00:00
parent 894ffb098c
commit 6fc73f709b
4 changed files with 4 additions and 5 deletions

View File

@ -1179,7 +1179,7 @@ public:
size_t max_tlab_size() const override;
size_t unsafe_max_tlab_alloc(Thread* ignored) const override;
inline bool is_in_young(const oop obj);
inline bool is_in_young(const oop obj) const;
// Returns "true" iff the given word_size is "very large".
static bool is_humongous(size_t word_size) {

View File

@ -208,7 +208,7 @@ void G1CollectedHeap::register_optional_region_with_region_attr(HeapRegion* r) {
_region_attr.set_optional(r->hrm_index(), r->rem_set()->is_tracked());
}
inline bool G1CollectedHeap::is_in_young(const oop obj) {
inline bool G1CollectedHeap::is_in_young(const oop obj) const {
if (obj == NULL) {
return false;
}

View File

@ -184,8 +184,7 @@ class ParallelScavengeHeap : public CollectedHeap {
bool is_in_reserved(const void* p) const;
bool is_in_young(oop p); // reserved part
bool is_in_old(oop p); // reserved part
bool is_in_young(const oop p) const;
MemRegion reserved_region() const { return _reserved; }
HeapWord* base() const { return _reserved.start(); }

View File

@ -43,7 +43,7 @@ inline void ParallelScavengeHeap::invoke_scavenge() {
PSScavenge::invoke();
}
inline bool ParallelScavengeHeap::is_in_young(oop p) {
inline bool ParallelScavengeHeap::is_in_young(const oop p) const {
// Assumes the the old gen address range is lower than that of the young gen.
bool result = cast_from_oop<HeapWord*>(p) >= young_gen()->reserved().start();
assert(result == young_gen()->is_in_reserved(p),