Skip to content

Commit b053f09

Browse files
committed
8231113: Remove CollectedHeap::check_oop_location()
Reviewed-by: stefank, eosterlund, tschatzl
1 parent 35a9f68 commit b053f09

File tree

9 files changed

+7
-29
lines changed

9 files changed

+7
-29
lines changed

src/hotspot/share/gc/cms/cmsHeap.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,6 @@ class CMSHeap : public GenCollectedHeap {
135135
bool should_do_concurrent_full_gc(GCCause::Cause cause);
136136

137137
void collect_mostly_concurrent(GCCause::Cause cause);
138-
139-
// CMS forwards some non-heap value into the mark oop to reserve oops during
140-
// promotion, so we can't assert about obj alignment or that the forwardee is in heap
141-
virtual void check_oop_location(void* addr) const {}
142138
};
143139

144140
#endif // SHARE_GC_CMS_CMSHEAP_HPP

src/hotspot/share/gc/g1/g1OopClosures.inline.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "oops/oopsHierarchy.hpp"
3939
#include "oops/oop.inline.hpp"
4040
#include "runtime/prefetch.inline.hpp"
41+
#include "utilities/align.hpp"
4142

4243
template <class T>
4344
inline void G1ScanClosureBase::prefetch_and_push(T* p, const oop obj) {
@@ -115,7 +116,8 @@ inline static void check_obj_during_refinement(T* p, oop const obj) {
115116
G1CollectedHeap* g1h = G1CollectedHeap::heap();
116117
// can't do because of races
117118
// assert(oopDesc::is_oop_or_null(obj), "expected an oop");
118-
g1h->check_oop_location(obj);
119+
assert(is_object_aligned(obj), "oop must be aligned");
120+
assert(g1h->is_in_reserved(obj), "oop must be in reserved");
119121

120122
HeapRegion* from = g1h->heap_region_containing(p);
121123

src/hotspot/share/gc/serial/markSweep.inline.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "oops/access.inline.hpp"
3333
#include "oops/compressedOops.inline.hpp"
3434
#include "oops/oop.inline.hpp"
35+
#include "utilities/align.hpp"
3536
#include "utilities/stack.inline.hpp"
3637

3738
inline void MarkSweep::mark_object(oop obj) {
@@ -87,7 +88,7 @@ template <class T> inline void MarkSweep::adjust_pointer(T* p) {
8788
"should be forwarded");
8889

8990
if (new_obj != NULL) {
90-
DEBUG_ONLY(Universe::heap()->check_oop_location((HeapWord*)new_obj);)
91+
assert(is_object_aligned(new_obj), "oop must be aligned");
9192
RawAccess<IS_NOT_NULL>::oop_store(p, new_obj);
9293
}
9394
}

src/hotspot/share/gc/shared/collectedHeap.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,6 @@ void CollectedHeap::check_for_non_bad_heap_word_value(HeapWord* addr, size_t siz
343343
}
344344
#endif // PRODUCT
345345

346-
void CollectedHeap::check_oop_location(void* addr) const {
347-
assert(is_object_aligned(addr), "address is not aligned");
348-
assert(_reserved.contains(addr), "address is not in reserved heap");
349-
}
350-
351346
size_t CollectedHeap::max_tlab_size() const {
352347
// TLABs can't be bigger than we can fill with a int[Integer.MAX_VALUE].
353348
// This restriction could be removed by enabling filling with multiple arrays.
@@ -376,8 +371,6 @@ void CollectedHeap::fill_args_check(HeapWord* start, size_t words)
376371
{
377372
assert(words >= min_fill_size(), "too small to fill");
378373
assert(is_object_aligned(words), "unaligned size");
379-
DEBUG_ONLY(Universe::heap()->check_oop_location(start);)
380-
DEBUG_ONLY(Universe::heap()->check_oop_location(start + words - MinObjAlignment);)
381374
}
382375

383376
void CollectedHeap::zap_filler_array(HeapWord* start, size_t words, bool zap)

src/hotspot/share/gc/shared/collectedHeap.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,6 @@ class CollectedHeap : public CHeapObj<mtInternal> {
233233

234234
DEBUG_ONLY(bool is_in_or_null(const void* p) const { return p == NULL || is_in(p); })
235235

236-
// This function verifies that "addr" is a valid oop location, w.r.t. heap
237-
// datastructures such as bitmaps and virtual memory address. It does *not*
238-
// check if the location is within committed heap memory.
239-
virtual void check_oop_location(void* addr) const;
240-
241236
virtual uint32_t hash_oop(oop obj) const;
242237

243238
void set_gc_cause(GCCause::Cause v) {

src/hotspot/share/gc/z/zCollectedHeap.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,3 @@ void ZCollectedHeap::verify(VerifyOption option /* ignored */) {
368368
bool ZCollectedHeap::is_oop(oop object) const {
369369
return CollectedHeap::is_oop(object) && _heap.is_oop(object);
370370
}
371-
372-
void ZCollectedHeap::check_oop_location(void* addr) const {
373-
assert(is_object_aligned(addr), "address is not aligned");
374-
375-
const uintptr_t addr_int = reinterpret_cast<uintptr_t>(addr);
376-
assert(addr_int >= ZAddressSpaceStart, "address is outside of the heap");
377-
assert(addr_int < ZAddressSpaceEnd, "address is outside of the heap");
378-
}

src/hotspot/share/gc/z/zCollectedHeap.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ class ZCollectedHeap : public CollectedHeap {
126126
virtual void prepare_for_verify();
127127
virtual void verify(VerifyOption option /* ignored */);
128128
virtual bool is_oop(oop object) const;
129-
virtual void check_oop_location(void* addr) const;
130129
};
131130

132131
#endif // SHARE_GC_Z_ZCOLLECTEDHEAP_HPP

src/hotspot/share/oops/compressedOops.inline.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ inline oop CompressedOops::decode(narrowOop v) {
5858

5959
inline narrowOop CompressedOops::encode_not_null(oop v) {
6060
assert(!is_null(v), "oop value can never be zero");
61-
DEBUG_ONLY(Universe::heap()->check_oop_location(v);)
61+
assert(is_object_aligned(v), "address not aligned: " PTR_FORMAT, p2i((void*)v));
62+
assert(is_in(v), "address not in heap range: " PTR_FORMAT, p2i((void*)v));
6263
uint64_t pd = (uint64_t)(pointer_delta((void*)v, (void*)base(), 1));
6364
assert(OopEncodingHeapMax > pd, "change encoding max if new encoding");
6465
uint64_t result = pd >> shift();

src/hotspot/share/oops/oop.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ void oopDesc::release_double_field_put(int offset, jdouble value) { HeapAcce
209209

210210
#ifdef ASSERT
211211
void oopDesc::verify_forwardee(oop forwardee) {
212-
Universe::heap()->check_oop_location(forwardee);
213212
#if INCLUDE_CDS_JAVA_HEAP
214213
assert(!HeapShared::is_archived_object(forwardee) && !HeapShared::is_archived_object(this),
215214
"forwarding archive object");

0 commit comments

Comments
 (0)