Skip to content

Commit 64fc7e8

Browse files
committed
fix for nullptr padding
1 parent 3cb20bb commit 64fc7e8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/hotspot/share/classfile/fieldLayoutBuilder.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -644,10 +644,16 @@ void FieldLayoutBuilder::compute_regular_layout() {
644644
if (!_contended_groups.is_empty()) {
645645
for (int i = 0; i < _contended_groups.length(); i++) {
646646
FieldGroup* cg = _contended_groups.at(i);
647-
LayoutRawBlock* padding = insert_contended_padding(_layout->last_block());
647+
LayoutRawBlock* start = _layout->last_block();
648+
LayoutRawBlock* padding = insert_contended_padding(start);
649+
648650
// Do not insert fields past the padding block.
649-
_layout->add(cg->primitive_fields(), padding);
650-
_layout->add(cg->oop_fields(), padding);
651+
if (padding != nullptr) {
652+
start = padding;
653+
}
654+
655+
_layout->add(cg->primitive_fields(), start);
656+
_layout->add(cg->oop_fields(), start);
651657
need_tail_padding = true;
652658
}
653659
}

0 commit comments

Comments
 (0)