Skip to content

Commit

Permalink
Parallel: fix size_given_klass
Browse files Browse the repository at this point in the history
  • Loading branch information
stefank committed Apr 23, 2024
1 parent 8e25cd6 commit d73d01e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/hotspot/share/oops/oop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@ jdouble oopDesc::double_field_acquire(int offset) const { return A
void oopDesc::release_double_field_put(int offset, jdouble value) { Atomic::release_store(field_addr<jdouble>(offset), value); }

#ifdef ASSERT
bool oopDesc::size_might_change() {
bool oopDesc::size_might_change(Klass* klass) {
// UseParallelGC and UseG1GC can change the length field
// of an "old copy" of an object array in the young gen so it indicates
// the grey portion of an already copied array. This will cause the first
// disjunct below to fail if the two comparands are computed across such
// a concurrent change.
return Universe::heap()->is_gc_active() && is_objArray() && is_forwarded() && (UseParallelGC || UseG1GC);
return Universe::heap()->is_gc_active() && klass->is_objArray_klass() && is_forwarded() && (UseParallelGC || UseG1GC);
}
#endif
2 changes: 1 addition & 1 deletion src/hotspot/share/oops/oop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ class oopDesc {
// for error reporting
static void* load_oop_raw(oop obj, int offset);

DEBUG_ONLY(bool size_might_change();)
DEBUG_ONLY(bool size_might_change(Klass* klass);)
};

// An oopDesc is not initialized via a constructor. Space is allocated in
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/oops/oop.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ size_t oopDesc::size_given_klass(Klass* klass) {
// skipping the intermediate round to HeapWordSize.
s = align_up(size_in_bytes, MinObjAlignmentInBytes) / HeapWordSize;

assert(s == klass->oop_size(this) || size_might_change(), "wrong array object size");
assert(s == klass->oop_size(this) || size_might_change(klass), "wrong array object size");
} else {
// Must be zero, so bite the bullet and take the virtual call.
s = klass->oop_size(this);
Expand Down

0 comments on commit d73d01e

Please sign in to comment.