[release/6.0-rc1] [hot_reload] Don't look at delta method table rows (#57799)
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Fri, 20 Aug 2021 20:21:55 +0000 (13:21 -0700)
committerGitHub <noreply@github.com>
Fri, 20 Aug 2021 20:21:55 +0000 (13:21 -0700)
commit13b1111adda0ee7260e2736e3311a3bcbb278401
tree6bf49b60e978d86c874452e45ba01792c856a6a6
parent236e490d4fb624498e10dc5a3b78fda24b55a35e
[release/6.0-rc1] [hot_reload] Don't look at delta method table rows (#57799)

* Add test case

Call a method for the first time after an update has been applied to it.

This will check that the interpreter or JIT does not have to rely on cached
information from the baseline (about the method signature, for example) and
that it can compute it from the delta.

* [hot_reload] Don't look at delta method table rows

The issue is that the ParamList column in EnC deltas is a "suppressed column"
that has the value 0.  So when a method is updated if we use the value
directly, we will break, for example - `mono_metadata_get_param_attrs` which
expects a non-zero index in that column.

CoreCLR solves this by having a set of suppressed columns that are never
updated by deltas.  (CoreCLR's model is to directly mutate the tables of the
baseline image).  In Mono we can eventually do the same thing by writing the
value from the previous generation into the current delta's row.  But right now
since we don't allow parameter modifications, and the only column on a Method
table that we allow to be modified is the RVA - which we look up specially - we
can just always return the baseline image row for the method table.

Fixes https://github.com/dotnet/runtime/issues/57643

Co-authored-by: Aleksey Kliger <alklig@microsoft.com>
src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/FirstCallAfterUpdate.cs [new file with mode: 0644]
src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/FirstCallAfterUpdate_v1.cs [new file with mode: 0644]
src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/FirstCallAfterUpdate_v2.cs [new file with mode: 0644]
src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate.csproj [new file with mode: 0644]
src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/deltascript.json [new file with mode: 0644]
src/libraries/System.Runtime.Loader/tests/ApplyUpdateTest.cs
src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj
src/mono/mono/component/hot_reload.c