8323610: G1: HeapRegion pin count should be size_t to avoid overflows
Reviewed-by: kbarrett, ayang
This commit is contained in:
parent
e66a76f524
commit
8643cc2133
src/hotspot/share/gc/g1
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2024, 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
|
||||
@ -403,7 +403,7 @@ class G1PrepareEvacuationTask : public WorkerTask {
|
||||
_g1h->register_region_with_region_attr(hr);
|
||||
}
|
||||
log_debug(gc, humongous)("Humongous region %u (object size %zu @ " PTR_FORMAT ") remset %zu code roots %zu "
|
||||
"marked %d pinned count %u reclaim candidate %d type array %d",
|
||||
"marked %d pinned count %zu reclaim candidate %d type array %d",
|
||||
index,
|
||||
cast_to_oop(hr->bottom())->size() * HeapWordSize,
|
||||
p2i(hr->bottom()),
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2024, 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
|
||||
@ -424,7 +424,7 @@ void HeapRegion::print_on(outputStream* st) const {
|
||||
st->print("|-");
|
||||
}
|
||||
}
|
||||
st->print("|%3u", Atomic::load(&_pinned_object_count));
|
||||
st->print("|%3zu", Atomic::load(&_pinned_object_count));
|
||||
st->print_cr("");
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2024, 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
|
||||
@ -257,7 +257,7 @@ private:
|
||||
uint _node_index;
|
||||
|
||||
// Number of objects in this region that are currently pinned.
|
||||
volatile uint _pinned_object_count;
|
||||
volatile size_t _pinned_object_count;
|
||||
|
||||
void report_region_type_change(G1HeapRegionTraceType::Type to);
|
||||
|
||||
@ -408,7 +408,7 @@ public:
|
||||
|
||||
bool is_old_or_humongous() const { return _type.is_old_or_humongous(); }
|
||||
|
||||
uint pinned_count() const { return Atomic::load(&_pinned_object_count); }
|
||||
size_t pinned_count() const { return Atomic::load(&_pinned_object_count); }
|
||||
bool has_pinned_objects() const { return pinned_count() > 0; }
|
||||
|
||||
void set_free();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2024, 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
|
||||
@ -554,11 +554,11 @@ inline void HeapRegion::record_surv_words_in_group(size_t words_survived) {
|
||||
}
|
||||
|
||||
inline void HeapRegion::increment_pinned_object_count() {
|
||||
Atomic::add(&_pinned_object_count, 1u, memory_order_relaxed);
|
||||
Atomic::add(&_pinned_object_count, (size_t)1, memory_order_relaxed);
|
||||
}
|
||||
|
||||
inline void HeapRegion::decrement_pinned_object_count() {
|
||||
Atomic::sub(&_pinned_object_count, 1u, memory_order_relaxed);
|
||||
Atomic::sub(&_pinned_object_count, (size_t)1, memory_order_relaxed);
|
||||
}
|
||||
|
||||
#endif // SHARE_GC_G1_HEAPREGION_INLINE_HPP
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2024, 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
|
||||
@ -41,7 +41,7 @@
|
||||
nonstatic_field(HeapRegion, _bottom, HeapWord* const) \
|
||||
nonstatic_field(HeapRegion, _top, HeapWord* volatile) \
|
||||
nonstatic_field(HeapRegion, _end, HeapWord* const) \
|
||||
nonstatic_field(HeapRegion, _pinned_object_count, volatile uint) \
|
||||
volatile_nonstatic_field(HeapRegion, _pinned_object_count, size_t) \
|
||||
\
|
||||
nonstatic_field(HeapRegionType, _tag, HeapRegionType::Tag volatile) \
|
||||
\
|
||||
|
Loading…
x
Reference in New Issue
Block a user