Skip to content

Commit

Permalink
[mono][aot] Emit struct-to-ptr and ptr-to-struct wrappers for generic…
Browse files Browse the repository at this point in the history
… instances as well. (#73301)

Fixes #73236.
  • Loading branch information
vargaz authored Aug 4, 2022
1 parent b034595 commit 876c0be
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/mono/mono/mini/aot-compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -5239,6 +5239,25 @@ MONO_RESTORE_WARNING
add_method (acfg, mono_marshal_get_ptr_to_struct (klass));
}
}

rows = table_info_get_rows (&acfg->image->tables [MONO_TABLE_TYPESPEC]);
for (int i = 0; i < rows; ++i) {
ERROR_DECL (error);
MonoClass *klass;

token = MONO_TOKEN_TYPE_SPEC | (i + 1);
klass = mono_class_get_checked (acfg->image, token, error);

if (!klass) {
mono_error_cleanup (error);
continue;
}

if (m_class_is_ginst (klass) && !mono_class_is_open_constructed_type (m_class_get_byval_arg (klass)) && can_marshal_struct (klass)) {
add_method (acfg, mono_marshal_get_struct_to_ptr (klass));
add_method (acfg, mono_marshal_get_ptr_to_struct (klass));
}
}
}

static gboolean
Expand Down

0 comments on commit 876c0be

Please sign in to comment.