8178490: Usages of is_object_aligned with pointers are broken
Reviewed-by: tschatzl, kbarrett
This commit is contained in:
parent
ed94ecff28
commit
06cee886b1
@ -419,9 +419,9 @@ void ASPSYoungGen::resize_spaces(size_t requested_eden_size,
|
||||
"from start moved to the right");
|
||||
guarantee((HeapWord*)from_end >= from_space()->top(),
|
||||
"from end moved into live data");
|
||||
assert(is_object_aligned((intptr_t)eden_start), "checking alignment");
|
||||
assert(is_object_aligned((intptr_t)from_start), "checking alignment");
|
||||
assert(is_object_aligned((intptr_t)to_start), "checking alignment");
|
||||
assert(is_ptr_object_aligned(eden_start), "checking alignment");
|
||||
assert(is_ptr_object_aligned(from_start), "checking alignment");
|
||||
assert(is_ptr_object_aligned(to_start), "checking alignment");
|
||||
|
||||
MemRegion edenMR((HeapWord*)eden_start, (HeapWord*)eden_end);
|
||||
MemRegion toMR ((HeapWord*)to_start, (HeapWord*)to_end);
|
||||
|
@ -177,7 +177,7 @@ HeapWord* MutableSpace::allocate(size_t size) {
|
||||
if (pointer_delta(end(), obj) >= size) {
|
||||
HeapWord* new_top = obj + size;
|
||||
set_top(new_top);
|
||||
assert(is_object_aligned((intptr_t)obj) && is_object_aligned((intptr_t)new_top),
|
||||
assert(is_ptr_object_aligned(obj) && is_ptr_object_aligned(new_top),
|
||||
"checking alignment");
|
||||
return obj;
|
||||
} else {
|
||||
@ -198,7 +198,7 @@ HeapWord* MutableSpace::cas_allocate(size_t size) {
|
||||
if (result != obj) {
|
||||
continue; // another thread beat us to the allocation, try again
|
||||
}
|
||||
assert(is_object_aligned((intptr_t)obj) && is_object_aligned((intptr_t)new_top),
|
||||
assert(is_ptr_object_aligned(obj) && is_ptr_object_aligned(new_top),
|
||||
"checking alignment");
|
||||
return obj;
|
||||
} else {
|
||||
|
@ -88,7 +88,7 @@ inline ObjectStartArray* PSParallelCompact::start_array(SpaceId id) {
|
||||
inline void PSParallelCompact::check_new_location(HeapWord* old_addr, HeapWord* new_addr) {
|
||||
assert(old_addr >= new_addr || space_id(old_addr) != space_id(new_addr),
|
||||
"must move left or to a different space");
|
||||
assert(is_object_aligned((intptr_t)old_addr) && is_object_aligned((intptr_t)new_addr),
|
||||
assert(is_ptr_object_aligned(old_addr) && is_ptr_object_aligned(new_addr),
|
||||
"checking alignment");
|
||||
}
|
||||
#endif // ASSERT
|
||||
|
@ -122,7 +122,7 @@ class PSOldPromotionLAB : public PSPromotionLAB {
|
||||
// The 'new_top>obj' check is needed to detect overflow of obj+size.
|
||||
if (new_top > obj && new_top <= end()) {
|
||||
set_top(new_top);
|
||||
assert(is_object_aligned((intptr_t)obj) && is_object_aligned((intptr_t)new_top),
|
||||
assert(is_ptr_object_aligned(obj) && is_ptr_object_aligned(new_top),
|
||||
"checking alignment");
|
||||
_start_array->allocate_block(obj);
|
||||
return obj;
|
||||
|
@ -40,7 +40,7 @@ HeapWord* PSYoungPromotionLAB::allocate(size_t size) {
|
||||
// The 'new_top>obj' check is needed to detect overflow of obj+size.
|
||||
if (new_top > obj && new_top <= end()) {
|
||||
set_top(new_top);
|
||||
assert(is_ptr_aligned(obj, SurvivorAlignmentInBytes) && is_object_aligned((intptr_t)new_top),
|
||||
assert(is_ptr_aligned(obj, SurvivorAlignmentInBytes) && is_ptr_object_aligned(new_top),
|
||||
"checking alignment");
|
||||
return obj;
|
||||
} else {
|
||||
|
@ -193,9 +193,9 @@ void PSYoungGen::set_space_boundaries(size_t eden_size, size_t survivor_size) {
|
||||
char *from_end = from_start + survivor_size;
|
||||
|
||||
assert(from_end == virtual_space()->high(), "just checking");
|
||||
assert(is_object_aligned((intptr_t)eden_start), "checking alignment");
|
||||
assert(is_object_aligned((intptr_t)to_start), "checking alignment");
|
||||
assert(is_object_aligned((intptr_t)from_start), "checking alignment");
|
||||
assert(is_ptr_object_aligned(eden_start), "checking alignment");
|
||||
assert(is_ptr_object_aligned(to_start), "checking alignment");
|
||||
assert(is_ptr_object_aligned(from_start), "checking alignment");
|
||||
|
||||
MemRegion eden_mr((HeapWord*)eden_start, (HeapWord*)to_start);
|
||||
MemRegion to_mr ((HeapWord*)to_start, (HeapWord*)from_start);
|
||||
@ -611,9 +611,9 @@ void PSYoungGen::resize_spaces(size_t requested_eden_size,
|
||||
"from start moved to the right");
|
||||
guarantee((HeapWord*)from_end >= from_space()->top(),
|
||||
"from end moved into live data");
|
||||
assert(is_object_aligned((intptr_t)eden_start), "checking alignment");
|
||||
assert(is_object_aligned((intptr_t)from_start), "checking alignment");
|
||||
assert(is_object_aligned((intptr_t)to_start), "checking alignment");
|
||||
assert(is_ptr_object_aligned(eden_start), "checking alignment");
|
||||
assert(is_ptr_object_aligned(from_start), "checking alignment");
|
||||
assert(is_ptr_object_aligned(to_start), "checking alignment");
|
||||
|
||||
MemRegion edenMR((HeapWord*)eden_start, (HeapWord*)eden_end);
|
||||
MemRegion toMR ((HeapWord*)to_start, (HeapWord*)to_end);
|
||||
|
@ -556,6 +556,10 @@ inline bool is_object_aligned(intptr_t addr) {
|
||||
return addr == align_object_size(addr);
|
||||
}
|
||||
|
||||
inline bool is_ptr_object_aligned(const void* addr) {
|
||||
return is_ptr_aligned(addr, MinObjAlignmentInBytes);
|
||||
}
|
||||
|
||||
// Pad out certain offsets to jlong alignment, in HeapWord units.
|
||||
|
||||
inline intptr_t align_object_offset(intptr_t offset) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user