Signature Validity Rules

Signature Validity Rules

Let’s wrap up the basic facts discussed in this chapter:

  • [run time] Signature entries of records in the Method, Field, Property, MemberRef, StandaloneSig, and TypeSpec metadata tables must hold valid offsets in the #Blob stream. Nil values of these entries are not acceptable.

  • Signatures are built from SETs. Each SET describes the type of a field, a parameter, or other such item.

  • [run time] Each SET is a sequence of primitive type codes and optional integer parameters, such as metadata tokens or array dimension sizes. A SET cannot end with the following primitive types: a sentinel, *, &, [ ], or pinned. These primitive types are modifiers for the types that follow them in the SET.

  • [run time] A field signature, which is referenced from the Field or MemberRef table, consists of the calling convention IMAGE_CEE_CS _CALLCONV_FIELD and one valid SET, which cannot be void or <type>& and cannot contain a sentinel or a pinned modifier.

  • A method reference signature, which is referenced from the MemberRef table, consists of a calling convention, an argument count, a return SET, and a sequence of argument SETs, corresponding in number to the argument count.

  • [run time] The calling convention of a method reference signature is one of the following: the default, vararg, instance, instance vararg, instance explicit, or instance explicit vararg.

  • [run time] The return SET of a method reference signature cannot contain a sentinel or a pinned modifier.

  • [run time] No more than one argument SET of a method reference signature can contain a sentinel, and it can do so only if the calling convention includes vararg.

  • [run time] The argument SETs of a method reference signature cannot be void and cannot contain a pinned modifier.

  • A method declaration signature, which is referenced from the Method table, has the same structure as a method reference signature and must comply with the same requirements, plus the following restrictions: the explicit calling convention cannot be used, and no argument SET can contain a sentinel.

  • A property declaration signature, which is referenced from the Property table, has the same structure as a method declaration signature and must comply with the same requirements except that the calling convention of a property declaration signature must be IMAGE_CEE_CS_CALLCONV_PROPERTY.

  • An indirect call signature, which is referenced from the StandAloneSig table, has the same structure as a method reference signature and must comply with the same requirements except that the calling convention of an indirect call to an unmanaged method can be unmanaged cdecl, unmanaged stdcall, unmanaged thiscall, or unmanaged fastcall.

  • A local variables signature, which is referenced from the StandAloneSig table, consists of the calling convention IMAGE_CEE_CS_CALL- CONV_LOCAL_SIG, a local variable count, and a sequence of variable SETs, corresponding in number to the variable count.

  • [run time] No variable SET can be void or can contain a sentinel.

  • A type specification signature, which is referenced from the TypeSpec table, consists of one SET not preceded by the calling convention. The SET must represent an array, a vector, an unmanaged pointer, or a function pointer, and it cannot contain a pinned modifier.



Inside Microsoft. NET IL Assembler
Inside Microsoft .NET IL Assembler
ISBN: 0735615470
EAN: 2147483647
Year: 2005
Pages: 147
Authors: SERGE LIDIN

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net