Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/7.0] [mono] Add metadata update for overrides (backport #85182) #85259

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ public void CustomAttributeDelete()
});
}

[ActiveIssue("https://github.com/dotnet/runtime/issues/52993", TestRuntimes.Mono)]
[ConditionalFact(typeof(ApplyUpdateUtil), nameof (ApplyUpdateUtil.IsSupported))]
public void AsyncMethodChanges()
{
Expand Down
18 changes: 13 additions & 5 deletions src/mono/mono/metadata/metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -7003,18 +7003,26 @@ mono_class_get_overrides_full (MonoImage *image, guint32 type_token, MonoMethod
if (num_overrides)
*num_overrides = 0;

if (!tdef->base)
if (!tdef->base && !image->has_updates)
return;

loc.t = tdef;
loc.col_idx = MONO_METHODIMPL_CLASS;
loc.idx = mono_metadata_token_index (type_token);
loc.result = 0;

/* FIXME metadata-update */

if (!mono_binary_search (&loc, tdef->base, table_info_get_rows (tdef), tdef->row_size, table_locator))
gboolean found = tdef->base && mono_binary_search (&loc, tdef->base, table_info_get_rows (tdef), tdef->row_size, table_locator) != NULL;
if (!found && !image->has_updates)
return;

if (G_UNLIKELY (image->has_updates)) {
if (!found && !mono_metadata_update_metadata_linear_search (image, tdef, &loc, table_locator)) {
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_METADATA_UPDATE, "NO Found interfaces for class 0x%08x", type_token);
return;
}
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_METADATA_UPDATE, "Found interfaces for class 0x%08x starting at 0x%08x", type_token, loc.result);
}

start = loc.result;
end = start + 1;
/*
Expand All @@ -7026,7 +7034,7 @@ mono_class_get_overrides_full (MonoImage *image, guint32 type_token, MonoMethod
else
break;
}
guint32 rows = table_info_get_rows (tdef);
guint32 rows = mono_metadata_table_num_rows (image, MONO_TABLE_METHODIMPL);
while (end < rows) {
if (loc.idx == mono_metadata_decode_row_col (tdef, end, MONO_METHODIMPL_CLASS))
end++;
Expand Down