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

[mono] Add metadata update for overrides #85182

Merged
merged 1 commit into from
Apr 24, 2023
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 @@ -229,7 +229,6 @@ public void CustomAttributeDelete()
});
}

[ActiveIssue("https://github.com/dotnet/runtime/issues/79043", TestRuntimes.Mono)]
[ConditionalFact(typeof(ApplyUpdateUtil), nameof (ApplyUpdateUtil.IsSupported))]
public void AsyncMethodChanges()
{
Expand Down
17 changes: 13 additions & 4 deletions src/mono/mono/metadata/metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -7029,18 +7029,27 @@ 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 */
gboolean found = tdef->base && mono_binary_search (&loc, tdef->base, table_info_get_rows (tdef), tdef->row_size, table_locator) != NULL;

if (!mono_binary_search (&loc, tdef->base, table_info_get_rows (tdef), tdef->row_size, table_locator))
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 @@ -7052,7 +7061,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