Skip to content

Implement verification of readonly references #57444

Open

Description

Activity

  1. added
    help wanted
    area-Tools-ILVerification
    on Aug 15, 2021
  2. added this to the Future milestone on Aug 15, 2021
  3. ghost added
    untriaged
    on Aug 15, 2021
  4. removed
    untriaged
    on Aug 15, 2021
  5. added
    Priority:3
    on Apr 24, 2023
  6. kant2002 commented on Jan 27, 2025

    @kant2002
    Contributor

    I would like to get some clarification on document from somebody.

    Right now inside ILVerify there concept of isReadonly and isPermanentHome.
    a. Is isReadonly in the ILVerify correspond to readonly references?
    b. What concept represented by the isPermanentHome.
    c. How ILVerify represent controlled mutability references? Also not clear what controlled mutability references is.

    Also quick glance on the codebase get me puzzled a bit. I do not fully understand what's going on, but looks like verification happens when ILImporter sees instruction. Currently InitOnly error happens when ilverifier find ldsflda/ldflda, for example and if field is readonly have exclusion condition. It seems to me that with readonly ref support I have to check what kind of reference attempted to be assigned, only at stsfld for example, or during call famility. But that seems a bit disruptive to me, so I want to ask if I thinking in right direction and what am I missing.

  7. jkotas commented on Jan 28, 2025

    @jkotas
    MemberAuthor

    Is isReadonly in the ILVerify correspond to readonly references?
    How ILVerify represent controlled mutability references?

    IsReadonly concept in current ILVerify corresponds to controlled mutability references.
     

    What concept represented by the isPermanentHome.

    Whether or not the reference can be pointing to stack. The rules for isPermanentHome are very simplistic compared to what's available in C# today.

    Also not clear what controlled mutability references is.

    Controlled mutability references are explained in ECMA-335. The key difference between controlled mutability references and readonly references is that it is allowed to call non-readonly valuetype instance method on controlled mutability reference, but it is not allowed to call such method on readonly reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority:3area-Tools-ILVerificationhelp wanted

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions