Skip to content

Commit

Permalink
@stefank review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rkennke committed Oct 7, 2024
1 parent 8742f3c commit 572f1ac
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 16 deletions.
8 changes: 3 additions & 5 deletions src/hotspot/share/gc/parallel/psParallelCompact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,8 @@ void PSParallelCompact::fill_dense_prefix_end(SpaceId id) {
//
// The size of the filler (min-obj-size) is 2 heap words with the default
// MinObjAlignment, since both markword and klass take 1 heap word.
// With +UseCompactObjectHeaders, the minimum filler size is only one word,
// because both Klass* gets encoded in the mark-word.
//
// The size of the gap (if any) right before dense-prefix-end is
// MinObjAlignment.
Expand All @@ -781,17 +783,13 @@ void PSParallelCompact::fill_dense_prefix_end(SpaceId id) {
// filler obj will extend to next region.

// Note: If min-fill-size decreases to 1, this whole method becomes redundant.
if (UseCompactObjectHeaders) {
// The gap is always equal to min-fill-size, so nothing to do.
return;
}
assert(CollectedHeap::min_fill_size() >= 2, "inv");
#ifndef _LP64
// In 32-bit system, each heap word is 4 bytes, so MinObjAlignment == 2.
// The gap is always equal to min-fill-size, so nothing to do.
return;
#endif
if (MinObjAlignment > 1) {
if (MinObjAlignment >= checked_cast<int>(CollectedHeap::min_fill_size())) {
return;
}
assert(CollectedHeap::min_fill_size() == 2, "inv");
Expand Down
15 changes: 7 additions & 8 deletions src/hotspot/share/gc/shared/collectedHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ bool CollectedHeap::supports_concurrent_gc_breakpoints() const {
return false;
}

bool klass_is_sane(oop object) {
static bool klass_is_sane(oop object) {
Klass* klass;
if (UseCompactObjectHeaders) {
// With compact headers, we can't safely access the Klass* when
Expand All @@ -229,17 +229,16 @@ bool klass_is_sane(oop object) {
// the forwarding pointer, and here we have no way to make a
// distinction between Full-GC and regular GC forwarding.
markWord mark = object->mark();
if (!mark.is_forwarded()) {
klass = mark.klass_without_asserts();
} else {
if (mark.is_forwarded()) {
// We can't access the Klass*. We optimistically assume that
// it is ok. This happens very rarely.
klass = nullptr;
return true;
}
} else {
klass = object->klass_without_asserts();

return Metaspace::contains(mark.klass_without_asserts());
}
return klass == nullptr || Metaspace::contains(klass);

return Metaspace::contains(object->klass_without_asserts());
}

bool CollectedHeap::is_oop(oop object) const {
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/jvmci/vmStructs_jvmci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@
nonstatic_field(Klass, _bitmap, uintx) \
nonstatic_field(Klass, _hash_slot, uint8_t) \
nonstatic_field(Klass, _misc_flags._flags, u1) \
nonstatic_field(Klass, _prototype_header, markWord) \
\
nonstatic_field(LocalVariableTableElement, start_bci, u2) \
nonstatic_field(LocalVariableTableElement, length, u2) \
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/oops/compressedKlass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "precompiled.hpp"
#include "logging/log.hpp"
#include "memory/metaspace.hpp"
#include "oops/klass.hpp"
#include "oops/compressedKlass.inline.hpp"
#include "runtime/globals.hpp"
#include "runtime/java.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/oops/markWord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#ifdef _LP64
STATIC_ASSERT(markWord::klass_shift + markWord::klass_bits == 64);
// The hash (preceding nKlass) shall be a direct neighbor but not interleave
// The hash (preceding klass bits) shall be a direct neighbor but not interleave
STATIC_ASSERT(markWord::klass_shift == markWord::hash_bits + markWord::hash_shift);
#endif

Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/oops/markWord.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
narrowKlass markWord::narrow_klass() const {
#ifdef _LP64
assert(UseCompactObjectHeaders, "only used with compact object headers");
const narrowKlass nk = value() >> klass_shift;
return narrowKlass(value() >> klass_shift);
#else
ShouldNotReachHere();
Expand Down

0 comments on commit 572f1ac

Please sign in to comment.