Skip to content

Commit 6848447

Browse files
authored
Add metadata update for overrides (#85182)
1 parent 48b5311 commit 6848447

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/libraries/System.Runtime.Loader/tests/ApplyUpdateTest.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ public void CustomAttributeDelete()
229229
});
230230
}
231231

232-
[ActiveIssue("https://github.com/dotnet/runtime/issues/79043", TestRuntimes.Mono)]
233232
[ConditionalFact(typeof(ApplyUpdateUtil), nameof (ApplyUpdateUtil.IsSupported))]
234233
public void AsyncMethodChanges()
235234
{

src/mono/mono/metadata/metadata.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7029,18 +7029,27 @@ mono_class_get_overrides_full (MonoImage *image, guint32 type_token, MonoMethod
70297029
if (num_overrides)
70307030
*num_overrides = 0;
70317031

7032-
if (!tdef->base)
7032+
if (!tdef->base && !image->has_updates)
70337033
return;
70347034

70357035
loc.t = tdef;
70367036
loc.col_idx = MONO_METHODIMPL_CLASS;
70377037
loc.idx = mono_metadata_token_index (type_token);
7038+
loc.result = 0;
70387039

7039-
/* FIXME metadata-update */
7040+
gboolean found = tdef->base && mono_binary_search (&loc, tdef->base, table_info_get_rows (tdef), tdef->row_size, table_locator) != NULL;
70407041

7041-
if (!mono_binary_search (&loc, tdef->base, table_info_get_rows (tdef), tdef->row_size, table_locator))
7042+
if (!found && !image->has_updates)
70427043
return;
70437044

7045+
if (G_UNLIKELY (image->has_updates)) {
7046+
if (!found && !mono_metadata_update_metadata_linear_search (image, tdef, &loc, table_locator)) {
7047+
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_METADATA_UPDATE, "NO Found interfaces for class 0x%08x", type_token);
7048+
return;
7049+
}
7050+
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_METADATA_UPDATE, "Found interfaces for class 0x%08x starting at 0x%08x", type_token, loc.result);
7051+
}
7052+
70447053
start = loc.result;
70457054
end = start + 1;
70467055
/*
@@ -7052,7 +7061,7 @@ mono_class_get_overrides_full (MonoImage *image, guint32 type_token, MonoMethod
70527061
else
70537062
break;
70547063
}
7055-
guint32 rows = table_info_get_rows (tdef);
7064+
guint32 rows = mono_metadata_table_num_rows (image, MONO_TABLE_METHODIMPL);
70567065
while (end < rows) {
70577066
if (loc.idx == mono_metadata_decode_row_col (tdef, end, MONO_METHODIMPL_CLASS))
70587067
end++;

0 commit comments

Comments
 (0)