Skip to content

Commit f869706

Browse files
committed
8224815: Remove non-GC uses of CollectedHeap::is_in_reserved()
Reviewed-by: stefank, coleenp
1 parent d19e6ea commit f869706

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+242
-239
lines changed

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3953,7 +3953,7 @@ void MacroAssembler::set_narrow_oop(Register dst, jobject obj) {
39533953
assert (UseCompressedOops, "should only be used for compressed oops");
39543954
assert (Universe::heap() != NULL, "java heap should be initialized");
39553955
assert (oop_recorder() != NULL, "this assembler needs an OopRecorder");
3956-
assert(Universe::heap()->is_in_reserved(JNIHandles::resolve(obj)), "should be real oop");
3956+
assert(Universe::heap()->is_in(JNIHandles::resolve(obj)), "should be real oop");
39573957
}
39583958
#endif
39593959
int oop_index = oop_recorder()->find_index(obj);
@@ -3968,7 +3968,7 @@ void MacroAssembler::set_narrow_klass(Register dst, Klass* k) {
39683968
assert (UseCompressedClassPointers, "should only be used for compressed headers");
39693969
assert (oop_recorder() != NULL, "this assembler needs an OopRecorder");
39703970
int index = oop_recorder()->find_index(k);
3971-
assert(! Universe::heap()->is_in_reserved(k), "should not be an oop");
3971+
assert(! Universe::heap()->is_in(k), "should not be an oop");
39723972

39733973
InstructionMark im(this);
39743974
RelocationHolder rspec = metadata_Relocation::spec(index);
@@ -4052,7 +4052,7 @@ void MacroAssembler::movoop(Register dst, jobject obj, bool immediate) {
40524052
#ifdef ASSERT
40534053
{
40544054
ThreadInVMfromUnknown tiv;
4055-
assert(Universe::heap()->is_in_reserved(JNIHandles::resolve(obj)), "should be real oop");
4055+
assert(Universe::heap()->is_in(JNIHandles::resolve(obj)), "should be real oop");
40564056
}
40574057
#endif
40584058
oop_index = oop_recorder()->find_index(obj);
@@ -4082,7 +4082,7 @@ Address MacroAssembler::constant_oop_address(jobject obj) {
40824082
{
40834083
ThreadInVMfromUnknown tiv;
40844084
assert(oop_recorder() != NULL, "this assembler needs an OopRecorder");
4085-
assert(Universe::heap()->is_in_reserved(JNIHandles::resolve(obj)), "not an oop");
4085+
assert(Universe::heap()->is_in(JNIHandles::resolve(obj)), "not an oop");
40864086
}
40874087
#endif
40884088
int oop_index = oop_recorder()->find_index(obj);

src/hotspot/cpu/sparc/c1_LIRAssembler_sparc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ void LIR_Assembler::jobject2reg(jobject o, Register reg) {
409409
#ifdef ASSERT
410410
{
411411
ThreadInVMfromNative tiv(JavaThread::current());
412-
assert(Universe::heap()->is_in_reserved(JNIHandles::resolve(o)), "should be real oop");
412+
assert(Universe::heap()->is_in(JNIHandles::resolve(o)), "should be real oop");
413413
}
414414
#endif
415415
int oop_index = __ oop_recorder()->find_index(o);

src/hotspot/cpu/sparc/macroAssembler_sparc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ AddressLiteral MacroAssembler::constant_oop_address(jobject obj) {
990990
{
991991
ThreadInVMfromUnknown tiv;
992992
assert(oop_recorder() != NULL, "this assembler needs an OopRecorder");
993-
assert(Universe::heap()->is_in_reserved(JNIHandles::resolve(obj)), "not an oop");
993+
assert(Universe::heap()->is_in(JNIHandles::resolve(obj)), "not an oop");
994994
}
995995
#endif
996996
int oop_index = oop_recorder()->find_index(obj);

src/hotspot/cpu/x86/relocInfo_x86.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void Relocation::pd_set_data_value(address x, intptr_t o, bool verify_only) {
5151
} else if (which == Assembler::narrow_oop_operand) {
5252
address disp = Assembler::locate_operand(addr(), which);
5353
// both compressed oops and compressed classes look the same
54-
if (Universe::heap()->is_in_reserved((oop)x)) {
54+
if (CompressedOops::is_in((void*)x)) {
5555
if (verify_only) {
5656
guarantee(*(uint32_t*) disp == CompressedOops::encode((oop)x), "instructions must match");
5757
} else {

src/hotspot/cpu/x86/x86_64.ad

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ void emit_d32_reloc(CodeBuffer& cbuf, int d32, RelocationHolder const& rspec, in
546546
#ifdef ASSERT
547547
if (rspec.reloc()->type() == relocInfo::oop_type &&
548548
d32 != 0 && d32 != (intptr_t) Universe::non_oop_word()) {
549-
assert(Universe::heap()->is_in_reserved((address)(intptr_t)d32), "should be real oop");
549+
assert(Universe::heap()->is_in((address)(intptr_t)d32), "should be real oop");
550550
assert(oopDesc::is_oop(cast_to_oop((intptr_t)d32)), "cannot embed broken oops in code");
551551
}
552552
#endif
@@ -573,7 +573,7 @@ void emit_d64_reloc(CodeBuffer& cbuf, int64_t d64, RelocationHolder const& rspec
573573
#ifdef ASSERT
574574
if (rspec.reloc()->type() == relocInfo::oop_type &&
575575
d64 != 0 && d64 != (int64_t) Universe::non_oop_word()) {
576-
assert(Universe::heap()->is_in_reserved((address)d64), "should be real oop");
576+
assert(Universe::heap()->is_in((address)d64), "should be real oop");
577577
assert(oopDesc::is_oop(cast_to_oop(d64)), "cannot embed broken oops in code");
578578
}
579579
#endif

src/hotspot/share/ci/ciObjectFactory.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ void ciObjectFactory::remove_symbols() {
239239
ciObject* ciObjectFactory::get(oop key) {
240240
ASSERT_IN_VM;
241241

242-
assert(Universe::heap()->is_in_reserved(key), "must be");
242+
assert(Universe::heap()->is_in(key), "must be");
243243

244244
NonPermObject* &bucket = find_non_perm(key);
245245
if (bucket != NULL) {
@@ -252,7 +252,7 @@ ciObject* ciObjectFactory::get(oop key) {
252252
ciObject* new_object = create_new_object(keyHandle());
253253
assert(oopDesc::equals(keyHandle(), new_object->get_oop()), "must be properly recorded");
254254
init_ident_of(new_object);
255-
assert(Universe::heap()->is_in_reserved(new_object->get_oop()), "must be");
255+
assert(Universe::heap()->is_in(new_object->get_oop()), "must be");
256256

257257
// Not a perm-space object.
258258
insert_non_perm(bucket, keyHandle(), new_object);
@@ -644,7 +644,7 @@ static ciObjectFactory::NonPermObject* emptyBucket = NULL;
644644
// If there is no entry in the cache corresponding to this oop, return
645645
// the null tail of the bucket into which the oop should be inserted.
646646
ciObjectFactory::NonPermObject* &ciObjectFactory::find_non_perm(oop key) {
647-
assert(Universe::heap()->is_in_reserved(key), "must be");
647+
assert(Universe::heap()->is_in(key), "must be");
648648
ciMetadata* klass = get_metadata(key->klass());
649649
NonPermObject* *bp = &_non_perm_bucket[(unsigned) klass->hash() % NON_PERM_BUCKETS];
650650
for (NonPermObject* p; (p = (*bp)) != NULL; bp = &p->next()) {
@@ -672,7 +672,7 @@ inline ciObjectFactory::NonPermObject::NonPermObject(ciObjectFactory::NonPermObj
672672
//
673673
// Insert a ciObject into the non-perm table.
674674
void ciObjectFactory::insert_non_perm(ciObjectFactory::NonPermObject* &where, oop key, ciObject* obj) {
675-
assert(Universe::heap()->is_in_reserved_or_null(key), "must be");
675+
assert(Universe::heap()->is_in_or_null(key), "must be");
676676
assert(&where != &emptyBucket, "must not try to fill empty bucket");
677677
NonPermObject* p = new (arena()) NonPermObject(where, key, obj);
678678
assert(where == p && is_equal(p, key) && p->object() == obj, "entry must match");

src/hotspot/share/code/debugInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ void ConstantOopWriteValue::write_on(DebugInfoWriteStream* stream) {
225225
// thread is already in VM state.
226226
ThreadInVMfromUnknown tiv;
227227
assert(JNIHandles::resolve(value()) == NULL ||
228-
Universe::heap()->is_in_reserved(JNIHandles::resolve(value())),
228+
Universe::heap()->is_in(JNIHandles::resolve(value())),
229229
"Should be in heap");
230230
}
231231
#endif
@@ -246,7 +246,7 @@ void ConstantOopWriteValue::print_on(outputStream* st) const {
246246
ConstantOopReadValue::ConstantOopReadValue(DebugInfoReadStream* stream) {
247247
_value = Handle(Thread::current(), stream->read_oop());
248248
assert(_value() == NULL ||
249-
Universe::heap()->is_in_reserved(_value()), "Should be in heap");
249+
Universe::heap()->is_in(_value()), "Should be in heap");
250250
}
251251

252252
void ConstantOopReadValue::write_on(DebugInfoWriteStream* stream) {

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ 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 {}
138142
};
139143

140144
#endif // SHARE_GC_CMS_CMSHEAP_HPP

src/hotspot/share/gc/cms/jvmFlagConstraintsCMS.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ JVMFlag::Error ParGCStridesPerThreadConstraintFunc(uintx value, bool verbose) {
7070
JVMFlag::Error ParGCCardsPerStrideChunkConstraintFunc(intx value, bool verbose) {
7171
if (UseConcMarkSweepGC) {
7272
// ParGCCardsPerStrideChunk should be compared with card table size.
73-
size_t heap_size = Universe::heap()->reserved_region().word_size();
73+
size_t heap_size = CMSHeap::heap()->reserved_region().word_size();
7474
CardTableRS* ct = GenCollectedHeap::heap()->rem_set();
7575
size_t card_table_size = ct->cards_required(heap_size) - 1; // Valid card table size
7676

src/hotspot/share/gc/epsilon/epsilonHeap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ jint EpsilonHeap::initialize() {
3939
size_t max_byte_size = align_up(MaxHeapSize, align);
4040

4141
// Initialize backing storage
42-
ReservedSpace heap_rs = Universe::reserve_heap(max_byte_size, align);
42+
ReservedHeapSpace heap_rs = Universe::reserve_heap(max_byte_size, align);
4343
_virtual_space.initialize(heap_rs, init_byte_size);
4444

4545
MemRegion committed_region((HeapWord*)_virtual_space.low(), (HeapWord*)_virtual_space.high());
4646
MemRegion reserved_region((HeapWord*)_virtual_space.low_boundary(), (HeapWord*)_virtual_space.high_boundary());
4747

48-
initialize_reserved_region(reserved_region.start(), reserved_region.end());
48+
initialize_reserved_region(heap_rs);
4949

5050
_space = new ContiguousSpace();
5151
_space->initialize(committed_region, /* clear_space = */ true, /* mangle_space = */ true);

0 commit comments

Comments
 (0)