Skip to content

Commit

Permalink
8344454: [lworld] Nullable flat fields fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fparain committed Nov 18, 2024
1 parent fa2c4ff commit c743381
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/hotspot/share/classfile/fieldLayoutBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ LayoutRawBlock* FieldLayout::insert_field_block(LayoutRawBlock* slot, LayoutRawB
LayoutRawBlock* adj = new LayoutRawBlock(LayoutRawBlock::EMPTY, adjustment);
insert(slot, adj);
}
assert(block->size() >= block->size(), "Enough space must remain afte adjustment");
assert(block->size() >= block->size(), "Enough space must remain after adjustment");
insert(slot, block);
if (slot->size() == 0) {
remove(slot);
Expand Down Expand Up @@ -557,6 +557,12 @@ void FieldLayout::shift_fields(int shift) {
b->set_offset(b->offset() + shift);
if (b->block_kind() == LayoutRawBlock::REGULAR || b->block_kind() == LayoutRawBlock::FLAT) {
_field_info->adr_at(b->field_index())->set_offset(b->offset());
if (b->layout_kind() == LayoutKind::NULLABLE_ATOMIC_FLAT) {
int new_nm_offset = _field_info->adr_at(b->field_index())->null_marker_offset() + shift;
_field_info->adr_at(b->field_index())->set_null_marker_offset(new_nm_offset);
_inline_layout_info_array->adr_at(b->field_index())->set_null_marker_offset(new_nm_offset);

}
}
assert(b->block_kind() == LayoutRawBlock::EMPTY || b->offset() % b->alignment() == 0, "Must still be correctly aligned");
b = b->next_block();
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/interpreter/bytecodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#define JVM_BYTECODES_DO(def) \
def(_fast_agetfield , "fast_agetfield" , "bJJ" , nullptr , T_OBJECT , 0, true , _getfield ) \
def(_fast_vgetfield , "fast_qgetfield" , "bJJ" , nullptr , T_OBJECT , 0, true , _getfield ) \
def(_fast_vgetfield , "fast_vgetfield" , "bJJ" , nullptr , T_OBJECT , 0, true , _getfield ) \
def(_fast_bgetfield , "fast_bgetfield" , "bJJ" , nullptr , T_INT , 0, true , _getfield ) \
def(_fast_cgetfield , "fast_cgetfield" , "bJJ" , nullptr , T_CHAR , 0, true , _getfield ) \
def(_fast_dgetfield , "fast_dgetfield" , "bJJ" , nullptr , T_DOUBLE , 0, true , _getfield ) \
Expand All @@ -41,7 +41,7 @@
def(_fast_sgetfield , "fast_sgetfield" , "bJJ" , nullptr , T_SHORT , 0, true , _getfield ) \
\
def(_fast_aputfield , "fast_aputfield" , "bJJ" , nullptr , T_OBJECT , 0, true , _putfield ) \
def(_fast_vputfield , "fast_qputfield" , "bJJ" , nullptr , T_OBJECT , 0, true , _putfield ) \
def(_fast_vputfield , "fast_vputfield" , "bJJ" , nullptr , T_OBJECT , 0, true , _putfield ) \
def(_fast_bputfield , "fast_bputfield" , "bJJ" , nullptr , T_INT , 0, true , _putfield ) \
def(_fast_zputfield , "fast_zputfield" , "bJJ" , nullptr , T_INT , 0, true , _putfield ) \
def(_fast_cputfield , "fast_cputfield" , "bJJ" , nullptr , T_CHAR , 0, true , _putfield ) \
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/oops/inlineKlass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ oop InlineKlass::read_flat_field(oop obj, int offset, LayoutKind lk, TRAPS) {
InstanceKlass* recv = InstanceKlass::cast(obj->klass());
int nm_offset = offset + (null_marker_offset() - first_field_offset());
jbyte nm = obj->byte_field(nm_offset);
if (nm_offset == 0) {
if (nm == 0) {
return nullptr;
}
}
Expand Down

0 comments on commit c743381

Please sign in to comment.