8231051: Remove check_obj_alignment() and replace with is_object_aligned()
Reviewed-by: tschatzl, shade
--- a/src/hotspot/share/gc/shared/collectedHeap.cpp Tue Sep 17 09:51:02 2019 +0200
+++ b/src/hotspot/share/gc/shared/collectedHeap.cpp Tue Sep 17 09:51:02 2019 +0200
@@ -174,7 +174,7 @@
}
bool CollectedHeap::is_oop(oop object) const {
- if (!check_obj_alignment(object)) {
+ if (!is_object_aligned(object)) {
return false;
}
@@ -344,7 +344,7 @@
#endif // PRODUCT
void CollectedHeap::check_oop_location(void* addr) const {
- assert(check_obj_alignment(addr), "address is not aligned");
+ assert(is_object_aligned(addr), "address is not aligned");
assert(_reserved.contains(addr), "address is not in reserved heap");
}
--- a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp Tue Sep 17 09:51:02 2019 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp Tue Sep 17 09:51:02 2019 +0200
@@ -35,6 +35,7 @@
#include "memory/iterator.inline.hpp"
#include "memory/resourceArea.hpp"
#include "oops/compressedOops.inline.hpp"
+#include "utilities/align.hpp"
// Avoid name collision on verify_oop (defined in macroAssembler_arm.hpp)
#ifdef verify_oop
@@ -98,7 +99,7 @@
check(ShenandoahAsserts::_safe_unknown, obj, _heap->is_in(obj),
"oop must be in heap");
- check(ShenandoahAsserts::_safe_unknown, obj, check_obj_alignment(obj),
+ check(ShenandoahAsserts::_safe_unknown, obj, is_object_aligned(obj),
"oop must be aligned");
ShenandoahHeapRegion *obj_reg = _heap->heap_region_containing(obj);
@@ -158,7 +159,7 @@
"Forwardee must be in heap");
check(ShenandoahAsserts::_safe_oop, obj, !CompressedOops::is_null(fwd),
"Forwardee is set");
- check(ShenandoahAsserts::_safe_oop, obj, check_obj_alignment(fwd),
+ check(ShenandoahAsserts::_safe_oop, obj, is_object_aligned(fwd),
"Forwardee must be aligned");
// Do this before touching fwd->size()
--- a/src/hotspot/share/gc/z/zCollectedHeap.cpp Tue Sep 17 09:51:02 2019 +0200
+++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp Tue Sep 17 09:51:02 2019 +0200
@@ -35,6 +35,7 @@
#include "gc/z/zUtils.inline.hpp"
#include "memory/universe.hpp"
#include "runtime/mutexLocker.hpp"
+#include "utilities/align.hpp"
ZCollectedHeap* ZCollectedHeap::heap() {
CollectedHeap* heap = Universe::heap();
@@ -369,7 +370,7 @@
}
void ZCollectedHeap::check_oop_location(void* addr) const {
- assert(check_obj_alignment(addr), "address is not aligned");
+ assert(is_object_aligned(addr), "address is not aligned");
const uintptr_t addr_int = reinterpret_cast<uintptr_t>(addr);
assert(addr_int >= ZAddressSpaceStart, "address is outside of the heap");
--- a/src/hotspot/share/memory/heapShared.inline.hpp Tue Sep 17 09:51:02 2019 +0200
+++ b/src/hotspot/share/memory/heapShared.inline.hpp Tue Sep 17 09:51:02 2019 +0200
@@ -27,6 +27,7 @@
#include "oops/compressedOops.inline.hpp"
#include "memory/heapShared.hpp"
+#include "utilities/align.hpp"
#if INCLUDE_G1GC
#include "gc/g1/g1Allocator.inline.hpp"
#endif
@@ -40,7 +41,7 @@
inline oop HeapShared::decode_from_archive(narrowOop v) {
assert(!CompressedOops::is_null(v), "narrow oop value can never be zero");
oop result = (oop)(void*)((uintptr_t)_narrow_oop_base + ((uintptr_t)v << _narrow_oop_shift));
- assert(check_obj_alignment(result), "address not aligned: " INTPTR_FORMAT, p2i((void*) result));
+ assert(is_object_aligned(result), "address not aligned: " INTPTR_FORMAT, p2i((void*) result));
return result;
}
--- a/src/hotspot/share/oops/compressedOops.inline.hpp Tue Sep 17 09:51:02 2019 +0200
+++ b/src/hotspot/share/oops/compressedOops.inline.hpp Tue Sep 17 09:51:02 2019 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, 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
@@ -29,6 +29,7 @@
#include "memory/universe.hpp"
#include "oops/compressedOops.hpp"
#include "oops/oop.hpp"
+#include "utilities/align.hpp"
// Functions for encoding and decoding compressed oops.
// If the oops are compressed, the type passed to these overloaded functions
@@ -47,7 +48,7 @@
inline oop CompressedOops::decode_not_null(narrowOop v) {
assert(!is_null(v), "narrow oop value can never be zero");
oop result = decode_raw(v);
- assert(check_obj_alignment(result), "address not aligned: " INTPTR_FORMAT, p2i((void*) result));
+ assert(is_object_aligned(result), "address not aligned: " INTPTR_FORMAT, p2i((void*) result));
return result;
}
--- a/src/hotspot/share/oops/oopsHierarchy.hpp Tue Sep 17 09:51:02 2019 +0200
+++ b/src/hotspot/share/oops/oopsHierarchy.hpp Tue Sep 17 09:51:02 2019 +0200
@@ -190,10 +190,6 @@
return (T)(CHECK_UNHANDLED_OOPS_ONLY((void*))o);
}
-inline bool check_obj_alignment(void* ptr) {
- return (uintptr_t(ptr) & MinObjAlignmentInBytesMask) == 0;
-}
-
// The metadata hierarchy is separate from the oop hierarchy
// class MetaspaceObj