Skip to content

Commit

Permalink
Fix lowering support for inline arrays (dotnet#107744)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkurdek committed Oct 2, 2024
1 parent 5880118 commit 5dffc01
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/mono/mono/metadata/marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -6798,11 +6798,15 @@ static void record_struct_field_physical_lowering (guint8* lowered_bytes, MonoTy

static void record_inlinearray_struct_physical_lowering (guint8* lowered_bytes, MonoClass* klass, guint32 offset)
{
int align;
int type_offset = MONO_ABI_SIZEOF (MonoObject);

// Get the first field and record its physical lowering N times
MonoClassField* field = mono_class_get_fields_internal (klass, NULL);
gpointer iter = NULL;
MonoClassField* field = mono_class_get_fields_internal (klass, &iter);
MonoType* fieldType = field->type;
for (int i = 0; i < m_class_inlinearray_value(klass); ++i) {
record_struct_field_physical_lowering(lowered_bytes, fieldType, offset + m_field_get_offset(field) + i * mono_type_size(fieldType, NULL));
record_struct_field_physical_lowering(lowered_bytes, fieldType, offset + m_field_get_offset(field) + i * mono_type_size(fieldType, &align) - type_offset);
}
}

Expand Down

0 comments on commit 5dffc01

Please sign in to comment.