Skip to content
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
ed03217
8305895: Implement JEP 450: Compact Object Headers (Experimental)
rkennke Aug 22, 2024
18e08c1
Add missing newline
rkennke Aug 22, 2024
1578ffa
Remove hashcode leftovers from SA
rkennke Aug 22, 2024
7009e14
Fix hash_mask_in_place in ClhsdbLongConstant test
rkennke Aug 22, 2024
5ffc582
Fix hash shift for 32 bit builds
rkennke Aug 22, 2024
eaec111
Fix bit counts in GCForwarding
rkennke Aug 22, 2024
c9e0d07
Merge remote-tracking branch 'origin/master' into JDK-8305895-v4
rkennke Sep 9, 2024
40d327c
Fix metaspace issues post JDK-8338929
tstuefe Sep 2, 2024
9652ea3
GCForwarding init, SerialGC: wrong max heap size used
tstuefe Aug 30, 2024
3aaf07a
Zero should allow LightWeight locking mode
tstuefe Aug 29, 2024
be6f395
Improve comment for CDS precalculating narrow Klass IDs
tstuefe Aug 30, 2024
bf5067e
More fixes post JDK-8338929
tstuefe Sep 2, 2024
a39e5ac
Fix merge error in ClassLoaderMetaspace::deallocate
tstuefe Sep 2, 2024
2224b93
fix merge problem in PSPromotionManager::push_objArray
tstuefe Sep 2, 2024
ecb017b
Fix TestAutoCreateSharedArchiveNoDefaultArchive
stefank Sep 2, 2024
439bbc0
Let CDS print compact headers state
stefank Sep 2, 2024
3f1d0ed
Use FLAG_SET_ERGO when turning off UseCompactObjectHeaders
stefank Sep 2, 2024
88b3709
aarch64: Fix loadNKlassCompactHeaders
xmas92 Sep 3, 2024
2bc8088
x86_64: Fix loadNKlassCompactHeaders
xmas92 Sep 3, 2024
0a10679
Cleanup markWord bits and comments
xmas92 Sep 3, 2024
8671688
Fix jdk/tools/jlink/plugins/CDSPluginTest.java
tstuefe Sep 3, 2024
e00e4f4
Fix runtime/cds/appcds/loaderConstraints/DynamicLoaderConstraintsTest…
tstuefe Sep 3, 2024
294c2ce
GC code tweaks
stefank Aug 23, 2024
015f65a
Nit in header_size
stefank Sep 3, 2024
b35d6df
Simplify arrayOopDesc::length_offset_in_bytes and oopDesc::base_offse…
stefank Sep 4, 2024
4912638
Fix compiler/c2/irTests/TestPadding.java for +COH
tstuefe Sep 9, 2024
c5a840d
Fix release build error
tstuefe Sep 2, 2024
70f492d
Try to avoid lea in loadNklass (aarch64)
rkennke Sep 9, 2024
0a9a51b
GCForwarding touch-ups
rkennke Sep 9, 2024
91bc475
Get rid of forward_safe_* methods
rkennke Sep 9, 2024
3b1b6eb
Simplify oopDesc::init_mark()
rkennke Sep 9, 2024
49017fb
Simplify getKlass() in SA
rkennke Sep 9, 2024
33cf12e
Improve initialization of mark-word in CDS ArchiveHeapWriter
rkennke Sep 9, 2024
2884499
Print as warning when UCOH doesn't match in CDS archive
rkennke Sep 9, 2024
696003c
Fix comment
rkennke Sep 10, 2024
e986d19
Rename GCForwarding -> FullGCForwarding; some touch-ups
rkennke Sep 10, 2024
c85c2ed
Improve is_oop()
rkennke Sep 10, 2024
321a44a
Various touch-ups
rkennke Sep 10, 2024
6b27782
Remove asserts in XArrayKlass::oop_oop_iterate()
rkennke Sep 10, 2024
5da250c
More touch-ups, fix Shenandoah oop iterator
rkennke Sep 10, 2024
6abda7b
Fix FullGCForwarding initialization
rkennke Sep 10, 2024
bff4dc1
Re-enable some vectorization tests
rkennke Sep 11, 2024
b6c11f7
Make is_oop() MT-safe
rkennke Sep 11, 2024
9e008ac
Revert accidental change of UCOH default
rkennke Sep 11, 2024
69f1ef1
Hide log timestamps in test to prevent false failures
robcasloz Sep 12, 2024
990926f
Various touch-ups
rkennke Sep 13, 2024
af9adf3
Merge commit '597788850041e7272a23714c05ba546ee6080856' into JDK-8305…
rkennke Sep 16, 2024
d54133a
Fixes post 8338526
tstuefe Sep 11, 2024
78d1a22
remove stray debug output
tstuefe Sep 11, 2024
2f70eb5
Rework compressedklass encoding
tstuefe Sep 12, 2024
c398b05
clarify obscure assert in metasapce setup
tstuefe Sep 13, 2024
a191abc
Fix loop on aarch64
tstuefe Sep 13, 2024
49c8754
Fix test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointer…
tstuefe Sep 13, 2024
2125cd8
Merge remote-tracking branch 'origin/master' into JDK-8305895-v4
rkennke Sep 16, 2024
194d5ab
Merge upstream up to and including 8340184
tstuefe Sep 17, 2024
6a4617b
Fixes post-8340184
tstuefe Sep 17, 2024
28a26ae
fix CompressedClassPointersEncodingScheme yet again for linux aarch64
tstuefe Sep 17, 2024
352e708
Johan review feedback
tstuefe Sep 17, 2024
612d304
CompressedKlassPointers::is_encodable shall be callable with -UseCCP
tstuefe Sep 17, 2024
bb64162
Merge remote-tracking branch 'origin/master' into JDK-8305895-v4
rkennke Sep 18, 2024
9ad2e62
JVMCI support
mur47x111 Sep 18, 2024
b25a4b6
Simplify LIR_Assembler::emit_load_klass()
rkennke Sep 19, 2024
945eb6f
review feedback
tstuefe Sep 19, 2024
0d8a923
Merge remote-tracking branch 'lilliput/JEP-450-temporary-fix-branch-2…
rkennke Sep 19, 2024
2c4a787
Improve matching of loadNKlassCompactHeaders on aarch64
rkennke Sep 20, 2024
cd69da8
Enforce lightweight locking on 32-bit platforms
rkennke Sep 25, 2024
4904d43
Allow LM_MONITOR on 32-bit platforms
rkennke Sep 25, 2024
805a4e0
Improve CollectedHeap::is_oop()
rkennke Sep 26, 2024
d48f55d
@robcasloz review comments
rkennke Sep 26, 2024
059b157
Disable TestSplitPacks::test4a, failing on aarch64
rkennke Sep 27, 2024
f00c899
Disable some vectorization tests that fail with +UCOH and UseSSE<=3
rkennke Oct 2, 2024
d2547b4
Simplify object init code in interpreter
rkennke Oct 2, 2024
aea8f00
Revert "Disable TestSplitPacks::test4a, failing on aarch64"
rkennke Oct 2, 2024
2883e7b
Merge tag 'jdk-24+18' into JDK-8305895-v4
rkennke Oct 4, 2024
119bdc5
Fix for CDSPluginTest.java
rkennke Oct 4, 2024
8742f3c
Merge remote-tracking branch 'rkennke/JDK-8305895-v4' into JDK-830589…
rkennke Oct 4, 2024
572f1ac
@stefank review comments
rkennke Oct 7, 2024
6040108
Remove unused variable
rkennke Oct 7, 2024
1ab2077
Rename nklass/nKlass
rkennke Oct 7, 2024
17f8eb5
Some more review comments/cleanups
rkennke Oct 7, 2024
f65ef5d
Fix header < 16 bytes in indexOf intrinsic, by @sviswa7
rkennke Oct 8, 2024
4d7228e
Rename nklass in x86 code
rkennke Oct 8, 2024
9b1877d
Fix comment
rkennke Oct 8, 2024
17d8367
Rename nklass in aarch64
rkennke Oct 8, 2024
0be2fc4
Re-enable indexOf intrinsic for compact headers
rkennke Oct 8, 2024
d57dbfc
Improve PSParallelCompact::fill_dense_prefix_end() even more
rkennke Oct 8, 2024
4035bb6
Fix include guards
rkennke Oct 8, 2024
b289ef8
Increase compiler code stubs size for indexOf intrinsic
rkennke Oct 8, 2024
6722f8b
PPC64 implementation of Compact Object Headers (JEP 450)
TheRealMDoerr Oct 9, 2024
86f94fe
Merge tag 'jdk-24+19' into JDK-8305895-v4
rkennke Oct 15, 2024
005498b
Fix aarch64.ad
rkennke Oct 15, 2024
1fd365d
Address comments by @vpaprotsk
rkennke Oct 16, 2024
ec42f4d
Problem-list SharedBaseAddress tests on aarch64
rkennke Oct 16, 2024
e4c0878
Remove extra sanity check
rkennke Oct 16, 2024
1b907cc
Compact header riscv (#3)
rkennke Oct 17, 2024
8c4eb6d
Fix needle copying in indexOf intrinsic for smaller headers
rkennke Oct 22, 2024
e324d95
Merge tag 'jdk-24+20' into JDK-8305895-v4
rkennke Oct 22, 2024
19d05e4
Update copyright headers
rkennke Oct 22, 2024
2bbff19
Avoid assert/endless-loop in JFR code
rkennke Oct 22, 2024
1ef6394
Update copyright
rkennke Oct 22, 2024
aadd7b8
Conditionalize platform specific parts of CompressedClassPointersEnco…
rkennke Oct 24, 2024
c2f6d20
s390 port
rkennke Oct 24, 2024
434c681
Enable riscv in CompressedClassPointersEncodingScheme test
rkennke Oct 24, 2024
b945822
Merge tag 'jdk-24+22' into JDK-8305895-v4
rkennke Nov 5, 2024
1ea4de1
Fix gen-ZGC removal
rkennke Nov 6, 2024
4d28224
Merge tag 'jdk-25+23' into JDK-8305895-v4
rkennke Nov 7, 2024
c1a6323
Merge branch 'master' into JDK-8305895-v4
rkennke Nov 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/hotspot/share/cds/archiveHeapWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ void ArchiveHeapWriter::ensure_buffer_space(size_t min_bytes) {
}

void ArchiveHeapWriter::copy_roots_to_buffer(GrowableArrayCHeap<oop, mtClassShared>* roots) {
Klass* k = Universe::objectArrayKlass(); // already relocated to point to archived klass
Klass* k = Universe::objectArrayKlass();
int length = roots->length();
_heap_roots_word_size = objArrayOopDesc::object_size(length);
size_t byte_size = _heap_roots_word_size * HeapWordSize;
Expand All @@ -206,8 +206,7 @@ void ArchiveHeapWriter::copy_roots_to_buffer(GrowableArrayCHeap<oop, mtClassShar
{
// This is copied from MemAllocator::finish
if (UseCompactObjectHeaders) {
narrowKlass nk = ArchiveBuilder::current()->get_requested_narrow_klass(k);
oopDesc::release_set_mark(mem, markWord::prototype().set_narrow_klass(nk));
oopDesc::release_set_mark(mem, k->prototype_header());
} else {
oopDesc::set_mark(mem, markWord::prototype());
oopDesc::release_set_klass(mem, k);
Expand Down
10 changes: 5 additions & 5 deletions src/hotspot/share/cds/filemap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2493,7 +2493,7 @@ bool FileMapHeader::validate() {
log_info(cds)("Archive was created with UseCompressedOops = %d, UseCompressedClassPointers = %d, UseCompactObjectHeaders = %d",
compressed_oops(), compressed_class_pointers(), compact_headers());
if (compressed_oops() != UseCompressedOops || compressed_class_pointers() != UseCompressedClassPointers) {
log_info(cds)("Unable to use shared archive.\nThe saved state of UseCompressedOops and UseCompressedClassPointers is "
log_warning(cds)("Unable to use shared archive.\nThe saved state of UseCompressedOops and UseCompressedClassPointers is "
"different from runtime, CDS will be disabled.");
return false;
}
Expand All @@ -2504,10 +2504,10 @@ bool FileMapHeader::validate() {
}

if (compact_headers() != UseCompactObjectHeaders) {
log_info(cds)("The shared archive file's UseCompactObjectHeaders setting (%s)"
" does not equal the current UseCompactObjectHeaders setting (%s).",
_compact_headers ? "enabled" : "disabled",
UseCompactObjectHeaders ? "enabled" : "disabled");
log_warning(cds)("Unable to use shared archive.\nThe shared archive file's UseCompactObjectHeaders setting (%s)"
" does not equal the current UseCompactObjectHeaders setting (%s).",
_compact_headers ? "enabled" : "disabled",
UseCompactObjectHeaders ? "enabled" : "disabled");
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1CollectedHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,7 @@ jint G1CollectedHeap::initialize() {

G1InitLogger::print();

GCForwarding::initialize(heap_rs.region());
GCForwarding::initialize();

return JNI_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jint ParallelScavengeHeap::initialize() {

ParallelInitLogger::print();

GCForwarding::initialize(heap_rs.region());
GCForwarding::initialize();

return JNI_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/serial/serialHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ jint SerialHeap::initialize() {

GCInitLogger::print();

GCForwarding::initialize(_reserved);
GCForwarding::initialize();

return JNI_OK;
}
Expand Down
14 changes: 8 additions & 6 deletions src/hotspot/share/gc/shared/gcForwarding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,22 @@ void GCForwarding::initialize_flags(size_t max_heap_size) {
#ifdef _LP64
size_t max_narrow_heap_size = right_n_bits(NumLowBitsNarrow - Shift);
if (UseCompactObjectHeaders && max_heap_size > max_narrow_heap_size * HeapWordSize) {
warning("Compact object headers require a java heap size smaller than %zu (given: %zu). "
"Disabling compact object headers.", max_narrow_heap_size * HeapWordSize, max_heap_size);
warning("Compact object headers require a java heap size smaller than " SIZE_FORMAT
"%s (given: " SIZE_FORMAT "%s). Disabling compact object headers.",
byte_size_in_proper_unit(max_narrow_heap_size * HeapWordSize),
proper_unit_for_byte_size(max_narrow_heap_size * HeapWordSize),
byte_size_in_proper_unit(max_heap_size),
proper_unit_for_byte_size(max_heap_size));
FLAG_SET_ERGO(UseCompactObjectHeaders, false);
}
#endif
}

void GCForwarding::initialize(MemRegion heap) {
void GCForwarding::initialize() {
#ifdef _LP64
_heap_base = heap.start();
if (heap.word_size() <= right_n_bits(NumLowBitsNarrow - Shift)) {
if (UseCompactObjectHeaders) {
_num_low_bits = NumLowBitsNarrow;
} else {
assert(!UseCompactObjectHeaders, "Compact object headers should be turned off for large heaps");
_num_low_bits = NumLowBitsWide;
}
#endif
Expand Down
5 changes: 4 additions & 1 deletion src/hotspot/share/gc/shared/gcForwarding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
* compressed-oops encoding: it basically subtracts the forwardee address from the
* heap-base, shifts that difference into the right place, and sets the lowest two
* bits (to indicate 'forwarded' state as usual).
* With compact-headers, we have 40 bits to encode forwarding pointers. This is
* enough to address 8TB of heap. If the heap size exceeds that limit, we turn off
* compact headers.
*/
class GCForwarding : public AllStatic {
static const int NumLowBitsNarrow = LP64_ONLY(markWord::klass_shift) NOT_LP64(0 /*unused*/);
Expand All @@ -47,7 +50,7 @@ class GCForwarding : public AllStatic {
static int _num_low_bits;
public:
static void initialize_flags(size_t max_heap_size);
static void initialize(MemRegion heap);
static void initialize();
static inline void forward_to(oop from, oop to);
static inline oop forwardee(oop from);
static inline bool is_forwarded(oop obj);
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ void ShenandoahAsserts::assert_correct(void* interior_loc, oop obj, const char*
file, line);
}

Klass* obj_klass = obj->forward_safe_klass();
Klass* obj_klass = ShenandoahForwarding::klass(obj);
if (obj_klass == nullptr) {
print_failure(_safe_unknown, obj, interior_loc, nullptr, "Shenandoah assert_correct failed",
"Object klass pointer should not be null",
Expand Down Expand Up @@ -235,7 +235,7 @@ void ShenandoahAsserts::assert_correct(void* interior_loc, oop obj, const char*
file, line);
}

if (obj_klass != fwd->forward_safe_klass()) {
if (obj_klass != ShenandoahForwarding::klass(fwd)) {
print_failure(_safe_oop, obj, interior_loc, nullptr, "Shenandoah assert_correct failed",
"Forwardee klass disagrees with object class",
file, line);
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/gc/shenandoah/shenandoahForwarding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class ShenandoahForwarding {
*/
static inline oop try_update_forwardee(oop obj, oop update);

static inline size_t size(oop obj);
static inline Klass* klass(oop obj);
};

#endif // SHARE_GC_SHENANDOAH_SHENANDOAHFORWARDING_HPP
17 changes: 17 additions & 0 deletions src/hotspot/share/gc/shenandoah/shenandoahForwarding.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,21 @@ inline oop ShenandoahForwarding::try_update_forwardee(oop obj, oop update) {
}
}

inline Klass* ShenandoahForwarding::klass(oop obj) {
if (UseCompactObjectHeaders) {
markWord mark = obj->mark();
if (mark.is_marked()) {
oop fwd = cast_to_oop(mark.clear_lock_bits().to_pointer());
mark = fwd->mark();
}
return mark.klass();
} else {
return obj->klass();
}
}

inline size_t ShenandoahForwarding::size(oop obj) {
return obj->size_given_klass(klass(obj));
}

#endif // SHARE_GC_SHENANDOAH_SHENANDOAHFORWARDING_INLINE_HPP
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ jint ShenandoahHeap::initialize() {

ShenandoahInitLogger::print();

GCForwarding::initialize(_heap_region);
GCForwarding::initialize();

return JNI_OK;
}
Expand Down Expand Up @@ -1133,7 +1133,7 @@ oop ShenandoahHeap::evacuate_object(oop p, Thread* thread) {

assert(ShenandoahThreadLocalData::is_evac_allowed(thread), "must be enclosed in oom-evac scope");

size_t size = p->forward_safe_size();
size_t size = ShenandoahForwarding::size(p);

assert(!heap_region_containing(p)->is_humongous(), "never evacuate humongous objects");

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ inline void ShenandoahHeap::marked_object_iterate(ShenandoahHeapRegion* region,
oop obj = cast_to_oop(cs);
assert(oopDesc::is_oop(obj), "sanity");
assert(ctx->is_marked(obj), "object expected to be marked");
size_t size = obj->forward_safe_size();
size_t size = ShenandoahForwarding::size(obj);
cl->do_object(obj);
cs += size;
}
Expand Down
18 changes: 9 additions & 9 deletions src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class ShenandoahVerifyOopClosure : public BasicOopIterateClosure {
T o = RawAccess<>::oop_load(p);
if (!CompressedOops::is_null(o)) {
oop obj = CompressedOops::decode_not_null(o);
if (is_instance_ref_klass(obj->forward_safe_klass())) {
if (is_instance_ref_klass(ShenandoahForwarding::klass(obj))) {
obj = ShenandoahForwarding::get_forwardee(obj);
}
// Single threaded verification can use faster non-atomic stack and bitmap
Expand All @@ -129,7 +129,7 @@ class ShenandoahVerifyOopClosure : public BasicOopIterateClosure {
"oop must be aligned");

ShenandoahHeapRegion *obj_reg = _heap->heap_region_containing(obj);
Klass* obj_klass = obj->forward_safe_klass();
Klass* obj_klass = ShenandoahForwarding::klass(obj);

// Verify that obj is not in dead space:
{
Expand All @@ -144,11 +144,11 @@ class ShenandoahVerifyOopClosure : public BasicOopIterateClosure {
"Object start should be within the region");

if (!obj_reg->is_humongous()) {
check(ShenandoahAsserts::_safe_unknown, obj, (obj_addr + obj->forward_safe_size()) <= obj_reg->top(),
check(ShenandoahAsserts::_safe_unknown, obj, (obj_addr + ShenandoahForwarding::size(obj)) <= obj_reg->top(),
"Object end should be within the region");
} else {
size_t humongous_start = obj_reg->index();
size_t humongous_end = humongous_start + (obj->forward_safe_size() >> ShenandoahHeapRegion::region_size_words_shift());
size_t humongous_end = humongous_start + (ShenandoahForwarding::size(obj) >> ShenandoahHeapRegion::region_size_words_shift());
for (size_t idx = humongous_start + 1; idx < humongous_end; idx++) {
check(ShenandoahAsserts::_safe_unknown, obj, _heap->get_region(idx)->is_humongous_continuation(),
"Humongous object is in continuation that fits it");
Expand All @@ -165,7 +165,7 @@ class ShenandoahVerifyOopClosure : public BasicOopIterateClosure {
// skip
break;
case ShenandoahVerifier::_verify_liveness_complete:
Atomic::add(&_ld[obj_reg->index()], (uint) obj->forward_safe_size(), memory_order_relaxed);
Atomic::add(&_ld[obj_reg->index()], (uint) ShenandoahForwarding::size(obj), memory_order_relaxed);
// fallthrough for fast failure for un-live regions:
case ShenandoahVerifier::_verify_liveness_conservative:
check(ShenandoahAsserts::_safe_oop, obj, obj_reg->has_live(),
Expand Down Expand Up @@ -209,7 +209,7 @@ class ShenandoahVerifyOopClosure : public BasicOopIterateClosure {
HeapWord *fwd_addr = cast_from_oop<HeapWord *>(fwd);
check(ShenandoahAsserts::_safe_oop, obj, fwd_addr < fwd_reg->top(),
"Forwardee start should be within the region");
check(ShenandoahAsserts::_safe_oop, obj, (fwd_addr + fwd->forward_safe_size()) <= fwd_reg->top(),
check(ShenandoahAsserts::_safe_oop, obj, (fwd_addr + ShenandoahForwarding::size(fwd)) <= fwd_reg->top(),
"Forwardee end should be within the region");

oop fwd2 = ShenandoahForwarding::get_forwardee_raw_unchecked(fwd);
Expand Down Expand Up @@ -327,7 +327,7 @@ class ShenandoahVerifyOopClosure : public BasicOopIterateClosure {
*/
void verify_oops_from(oop obj) {
_loc = obj;
Klass* klass = obj->forward_safe_klass();
Klass* klass = ShenandoahForwarding::klass(obj);
obj->oop_iterate_backwards(this, klass);
_loc = nullptr;
}
Expand Down Expand Up @@ -592,7 +592,7 @@ class ShenandoahVerifierMarkedRegionTask : public WorkerTask {

while (addr < limit) {
verify_and_follow(addr, stack, cl, &processed);
addr += cast_to_oop(addr)->forward_safe_size();
addr += ShenandoahForwarding::size(cast_to_oop(addr));
}
}

Expand All @@ -608,7 +608,7 @@ class ShenandoahVerifierMarkedRegionTask : public WorkerTask {

// Verify everything reachable from that object too, hopefully realizing
// everything was already marked, and never touching further:
if (!is_instance_ref_klass(obj->forward_safe_klass())) {
if (!is_instance_ref_klass(ShenandoahForwarding::klass(obj))) {
cl.verify_oops_from(obj);
(*processed)++;
}
Expand Down
14 changes: 0 additions & 14 deletions src/hotspot/share/oops/oop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,6 @@ class oopDesc {
// to be able to figure out the size of an object knowing its klass.
inline size_t size_given_klass(Klass* klass);

// The following set of methods is used to access the mark-word and related
// properties when the object may be forwarded. Be careful where and when
// using this method. It assumes that the forwardee is installed in
// the header as a plain pointer (or self-forwarded). In particular,
// those methods can not deal with the encoded forwarding that is used
// in Serial, Parallel, G1 and Shenandoah full-GCs.
private:
inline Klass* forward_safe_klass_impl(markWord m) const;
public:
inline Klass* forward_safe_klass() const;
inline Klass* forward_safe_klass(markWord m) const;
inline size_t forward_safe_size();
inline void forward_safe_init_mark();

// type test operations (inlined in oop.inline.hpp)
inline bool is_instance() const;
inline bool is_instanceRef() const;
Expand Down
53 changes: 1 addition & 52 deletions src/hotspot/share/oops/oop.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,7 @@ markWord oopDesc::prototype_mark() const {
}

void oopDesc::init_mark() {
if (UseCompactObjectHeaders) {
set_mark(prototype_mark());
} else {
set_mark(markWord::prototype());
}
set_mark(prototype_mark());
}

Klass* oopDesc::klass() const {
Expand Down Expand Up @@ -225,53 +221,6 @@ size_t oopDesc::size_given_klass(Klass* klass) {
return s;
}

#ifdef _LP64
Klass* oopDesc::forward_safe_klass_impl(markWord m) const {
assert(UseCompactObjectHeaders, "Only get here with compact headers");
if (m.is_marked()) {
oop fwd = forwardee(m);
markWord m2 = fwd->mark();
assert(!m2.is_marked() || m2.is_self_forwarded(), "no double forwarding: this: " PTR_FORMAT " (" INTPTR_FORMAT "), fwd: " PTR_FORMAT " (" INTPTR_FORMAT ")", p2i(this), m.value(), p2i(fwd), m2.value());
m = m2;
}
return m.klass();
}
#endif

Klass* oopDesc::forward_safe_klass(markWord m) const {
#ifdef _LP64
if (UseCompactObjectHeaders) {
return forward_safe_klass_impl(m);
} else
#endif
{
return klass();
}
}

Klass* oopDesc::forward_safe_klass() const {
#ifdef _LP64
if (UseCompactObjectHeaders) {
return forward_safe_klass_impl(mark());
} else
#endif
{
return klass();
}
}

size_t oopDesc::forward_safe_size() {
return size_given_klass(forward_safe_klass());
}

void oopDesc::forward_safe_init_mark() {
if (UseCompactObjectHeaders) {
set_mark(forward_safe_klass()->prototype_header());
} else {
set_mark(markWord::prototype());
}
}

bool oopDesc::is_instance() const { return klass()->is_instance_klass(); }
bool oopDesc::is_instanceRef() const { return klass()->is_reference_instance_klass(); }
bool oopDesc::is_stackChunk() const { return klass()->is_stack_chunk_instance_klass(); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,10 @@ private static synchronized void initialize(TypeDataBase db) throws WrongTypeExc
// Accessors for declared fields
public Mark getMark() { return new Mark(getHandle()); }

private static Klass getKlass(Mark mark) {
assert(VM.getVM().isCompactObjectHeadersEnabled());
return mark.getKlass();
}

public Klass getKlass() {
if (VM.getVM().isCompactObjectHeadersEnabled()) {
assert(VM.getVM().isCompressedKlassPointersEnabled());
return getKlass(getMark());
return getMark().getKlass();
} else if (VM.getVM().isCompressedKlassPointersEnabled()) {
return (Klass)compressedKlass.getValue(getHandle());
} else {
Expand Down Expand Up @@ -224,7 +219,7 @@ public static Klass getKlassForOopHandle(OopHandle handle) {
}
if (VM.getVM().isCompactObjectHeadersEnabled()) {
Mark mark = new Mark(handle);
return getKlass(mark);
return mark.getKlass();
} else if (VM.getVM().isCompressedKlassPointersEnabled()) {
return (Klass)Metadata.instantiateWrapperFor(handle.getCompKlassAddressAt(compressedKlass.getOffset()));
} else {
Expand Down
2 changes: 1 addition & 1 deletion test/hotspot/gtest/gc/shared/test_preservedMarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ TEST_VM(PreservedMarks, iterate_and_restore) {

HeapWord fakeheap[32] = { nullptr };
HeapWord* heap = align_up(fakeheap, 8 * sizeof(HeapWord));
GCForwarding::initialize(MemRegion(&heap[0], &heap[16]));
GCForwarding::initialize();

oop o1 = cast_to_oop(&heap[0]); o1->set_mark(originalMark());
oop o2 = cast_to_oop(&heap[2]); o2->set_mark(originalMark());
Expand Down