Skip to content

Commit

Permalink
8338260: [lworld] assert(elements_end <= obj_end) failed: payload mus…
Browse files Browse the repository at this point in the history
…t fit in object

Reviewed-by: thartmann, fparain
  • Loading branch information
David Simms committed Aug 23, 2024
1 parent b81cb4e commit 884078f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/hotspot/share/oops/arrayOop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define SHARE_OOPS_ARRAYOOP_HPP

#include "oops/oop.hpp"
#include "runtime/globals.hpp"
#include "utilities/align.hpp"
#include "utilities/globalDefinitions.hpp"

Expand Down Expand Up @@ -55,12 +56,15 @@ class arrayOopDesc : public oopDesc {

// Given a type, return true if elements of that type must be aligned to 64-bit.
static bool element_type_should_be_aligned(BasicType type) {
if (EnableValhalla && type == T_PRIMITIVE_OBJECT) {
return true; //CMH: tighten the alignment when removing T_PRIMITIVE_OBJECT
}
#ifdef _LP64
if (type == T_OBJECT || type == T_ARRAY || type == T_PRIMITIVE_OBJECT) {
if (type == T_OBJECT || type == T_ARRAY) {
return !UseCompressedOops;
}
#endif
return type == T_DOUBLE || type == T_LONG || type == T_PRIMITIVE_OBJECT;
return type == T_DOUBLE || type == T_LONG;
}

public:
Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/share/oops/flatArrayOop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class flatArrayOopDesc : public arrayOopDesc {
}

static int object_size(int lh, int length) {
julong size_in_bytes = header_size_in_bytes() + element_size(lh, length);
julong size_in_bytes = base_offset_in_bytes(Klass::layout_helper_element_type(lh));
size_in_bytes += element_size(lh, length);
julong size_in_words = ((size_in_bytes + (HeapWordSize-1)) >> LogHeapWordSize);
assert(size_in_words <= (julong)max_jint, "no overflow");
return align_object_size((intptr_t)size_in_words);
Expand Down

0 comments on commit 884078f

Please sign in to comment.