Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.

[ILVerify] Fix leave from catch into enclosing try and assignability of readonly ByRefs - #5097

Merged
jkotas merged 4 commits into
dotnet:masterfrom
ArztSamuel:roslynTestFixes
Dec 12, 2017
Merged

[ILVerify] Fix leave from catch into enclosing try and assignability of readonly ByRefs#5097
jkotas merged 4 commits into
dotnet:masterfrom
ArztSamuel:roslynTestFixes

Conversation

@ArztSamuel

Copy link
Copy Markdown
Collaborator

This fixes two bugs discovered in course of the prototyped Roslyn test integration:

  • When checking a leave from a catch into an enclosing try, the validation of leave targets used the wrong index to get the source region information.
  • IsAssignable was not checking for the readonlyness of ByRefs.

@jcouv FYI: this should fix the LeaveIntoTry and UnexpectedTypeOnStack flags of your prototype. I have also had a quick look over all other flags; many are related to ILVerify not supporting TypedReferences / ArgIterators, and there are also a lot of special cases which are not implemented by ILVerify yet. I will have to look up how PEVerify implements those first.
For some of the other flags I have to actually debug the Roslyn tests, but I am still working on getting that to run.


var value = (StackValue)obj;
return this.Kind == value.Kind && this.Flags == value.Flags && this.Type == value.Type;
return this.Kind == value.Kind && this.IsReadOnly == value.IsReadOnly && this.Type == value.Type;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It may be better to inline the subset to compare into the calller.

I think that the right set of flags to compare will depend on who is calling it, and that there is no right subset to compare to make everybody happy.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I changed this to only check for the readonly flag, since PEVerify overloaded the == in the same way. I think it was implemented this way, because comparing the equality of two stack values by also considering flags like PermanentHome or ThisPtr is never actually used.

Anyway, I do agree that it would make more sense semantically to compare all flags in the equality operations and inline checks that require a subset.

@jkotas jkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@jkotas
jkotas merged commit 36d1ccf into dotnet:master Dec 12, 2017
@jcouv

jcouv commented Dec 12, 2017

Copy link
Copy Markdown
Contributor

Thanks! 👍

@ArztSamuel
ArztSamuel deleted the roslynTestFixes branch December 13, 2017 10:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants