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

[hot_reload] Add support for row modifications; CustomAttribute updates #55445

Merged
merged 7 commits into from
Jul 12, 2021

Conversation

lambdageek
Copy link
Member

This fixes #55097 - which allows us to support C# nullability analysis once again in hot reload deltas.

Specifically we allow EnC deltas to include modifications of existing rows in the CustomAttribute table as long as the Parent and Type columns stay the same (that is: a custom attribute modification that still applies to the same element - and uses the same custom attribute constructor, but may have a different value).


To support this, we add a new BaselineInfo:any_modified_rows array that keeps track for each table whether any rows have been modified (as opposed to added) by any EnC delta. When the runtime calls mono_metadata_decode_row, if there have been any deltas that modified a row in the requested table, we call hot_reload_effective_table_slow which find the latest delta that modified that row. If there have only been additions, we stop at the first delta that added the row we're looking for, if there are modifications, we look through all the deltas and return the latest one.

Just changing the arguments of a custom attribute constructor should generate
an update to the CustomAttributes table with the same parent and .ctor.  That
kind of change should be allowed by Mono and CoreCLR
unchanged.

Allows updates to the constructor arguments (or property values)
Add a bool array on the base image to keep track of whether each table had any
row modifications (as opposed to row additions) in any generation.

If there was a modification, take the slow path in mono_image_effective_table
even if the index we're looking at is in the base image.

Update hot_reload_effective_table_slow so that if there was a modified row, we
look at all the deltas to see if there's an even later update to that
row.  (When there are only additions, keep same behavior as before - only look
as far as the generation that added the row we wanted to find).

Also refine the assertion in hot_reload_relative_delta_index to properly
account for EnCMap entries that correspond to modifications - in that case we
might stop searching a metadata delta before we hit the end of the table if the
EnCmap entries start pointing to rows that are past the one we wanted to look
up.
Check that we get the updated custom attribute string property value.
Mono can now deal with the custom attributes modifications that Roslyn emits
@lambdageek lambdageek added the area-EnC-mono Hot Reload for WebAssembly, iOS/Android, etc label Jul 10, 2021
Copy link
Member

@thaystg thaystg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lambdageek lambdageek merged commit 9fb28c8 into dotnet:main Jul 12, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Aug 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-EnC-mono Hot Reload for WebAssembly, iOS/Android, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[mono] Allow CustomAttribute table modifications if Parent stays unchanged
2 participants