Skip to content

Latest commit

 

History

History
52 lines (37 loc) · 1.88 KB

ii.22.36-standalonesig-0x11.md

File metadata and controls

52 lines (37 loc) · 1.88 KB

II.22.36 StandAloneSig: 0x11

Signatures are stored in the metadata Blob heap. In most cases, they are indexed by a column in some table—Field.Signature, Method.Signature, MemberRef.Signature, etc. However, there are two cases that require a metadata token for a signature that is not indexed by any metadata table. The StandAloneSig table fulfils this need. It has just one column, which points to a Signature in the Blob heap.

The signature shall describe either:

  • a method – code generators create a row in the StandAloneSig table for each occurrence of a calli CIL instruction. That row indexes the call-site signature for the function pointer operand of the calli instruction

  • local variables – code generators create one row in the StandAloneSig table for each method, to describe all of its local variables. The .locals directive (§II.15.4.1) in ILAsm generates a row in the StandAloneSig table.

The StandAloneSig table has the following column:

  • Signature (an index into the Blob heap)

[Example:

// On encountering the calli instruction, ilasm generates a signature
// in the blob heap (DEFAULT, ParamCount = 1, RetType = int32, Param1 = int32),
// indexed by the StandAloneSig table:
.assembly Test {}
.method static int32 AddTen(int32)
{ ldarg.0
  ldc.i4  10
  add
  ret
}
.class Test
{ .method static void main()
  { .entrypoint
    ldc.i4.1
    ldftn int32 AddTen(int32)
    calli int32(int32)
    pop
    ret
  }
}

end example]

This contains informative text only.

  1. The StandAloneSig table can contain zero or more rows

  2. Signature shall index a valid signature in the Blob heap [ERROR]

  3. The signature 'blob' indexed by Signature shall be a valid METHOD or LOCALS signature [ERROR]

  4. Duplicate rows are allowed

End informative text.