Skip to content

Commit

Permalink
Add metadata update for overrides (#85182)
Browse files Browse the repository at this point in the history
  • Loading branch information
fanyang-mono authored Apr 24, 2023
1 parent 48b5311 commit 6848447
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
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

0 comments on commit 6848447

Please sign in to comment.