8325633: Use stricter assertion in callers of Space::is_aligned

Reviewed-by: tschatzl, sjohanss
This commit is contained in:
Albert Mingkun Yang 2024-02-13 09:41:12 +00:00
parent 5dbf13730e
commit 618af397b4
3 changed files with 5 additions and 10 deletions

View File

@ -335,9 +335,9 @@ void DefNewGeneration::compute_space_boundaries(uintx minimum_eden_size,
char *to_end = to_start + survivor_size;
assert(to_end == _virtual_space.high(), "just checking");
assert(Space::is_aligned(eden_start), "checking alignment");
assert(Space::is_aligned(from_start), "checking alignment");
assert(Space::is_aligned(to_start), "checking alignment");
assert(is_aligned(eden_start, SpaceAlignment), "checking alignment");
assert(is_aligned(from_start, SpaceAlignment), "checking alignment");
assert(is_aligned(to_start, SpaceAlignment), "checking alignment");
MemRegion edenMR((HeapWord*)eden_start, (HeapWord*)from_start);
MemRegion fromMR((HeapWord*)from_start, (HeapWord*)to_start);

View File

@ -197,7 +197,7 @@ inline HeapWord* ContiguousSpace::allocate_impl(size_t size) {
if (pointer_delta(end(), obj) >= size) {
HeapWord* new_top = obj + size;
set_top(new_top);
assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
assert(is_object_aligned(obj) && is_object_aligned(new_top), "checking alignment");
return obj;
} else {
return nullptr;
@ -215,7 +215,7 @@ inline HeapWord* ContiguousSpace::par_allocate_impl(size_t size) {
// the old top value: the exchange succeeded
// otherwise: the new value of the top is returned.
if (result == obj) {
assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
assert(is_object_aligned(obj) && is_object_aligned(new_top), "checking alignment");
return obj;
}
} else {

View File

@ -122,11 +122,6 @@ class Space: public CHeapObj<mtGC> {
// given address.
bool is_in_reserved(const void* p) const { return _bottom <= p && p < _end; }
// Test whether p is double-aligned
static bool is_aligned(void* p) {
return ::is_aligned(p, sizeof(double));
}
// Size computations. Sizes are in bytes.
size_t capacity() const { return byte_size(bottom(), end()); }
virtual size_t used() const = 0;