Skip to content

Latest commit

 

History

History
27 lines (15 loc) · 1.06 KB

iii.4.23-refanyval.md

File metadata and controls

27 lines (15 loc) · 1.06 KB

III.4.23 refanyval – load the address out of a typed reference

Format Assembly Format Description
C2 <T> refanyval type Push the address stored in a typed reference.

Stack Transition:

…, TypedRef → …, address

Description:

Retrieves the address (of type &) embedded in TypedRef. The type of reference in TypedRef shall match the type specified by type (a metadata token, either a typedef, typeref or a typespec; see Partition II). See the mkrefany instruction.

Exceptions:

System.InvalidCastException is thrown if type is not identical to the type stored in the TypedRef (ie, the class supplied to the mkrefany instruction that constructed that TypedRef)

System.TypeLoadException is thrown if type cannot be found.

Correctness:

Correct CIL ensures that TypedRef is a valid typed reference (created by a previous call to mkrefany).

Verifiability:

The refanyval instruction is always verifiable.