Skip to content

Latest commit

 

History

History
28 lines (16 loc) · 1.78 KB

iii.3.61-starg-length.md

File metadata and controls

28 lines (16 loc) · 1.78 KB

III.3.61 starg.<length> – store a value in an argument slot

Format Assembly Format Description
FE 0B <unsigned int16> starg num Store value to the argument numbered num.
10 <unsigned int8> starg.s num Store value to the argument numbered num, short form.

Stack Transition:

…, value → …,

Description:

The starg num instruction pops a value from the stack and places it in argument slot num (see Partition I). The type of the value shall match the type of the argument, as specified in the current method's signature. The starg.s instruction provides an efficient encoding for use with the first 256 arguments.

For procedures that take a variable argument list, the starg instructions can be used only for the initial fixed arguments, not those in the variable part of the signature. Storing into arguments that hold a value smaller than 4 bytes whose intermediate type is int32 truncates the value as it moves from the stack to the argument. Floating-point values are rounded from their native size (type F) to the size associated with the argument. (See §III.1.1.1, Numeric data types.)

Exceptions:

None.

Correctness:

Correct CIL requires that num is a valid argument slot. In addition to the stores allowed by Verified CIL, Correct CIL also allows a native int to be stored as a byref (&); in which case following the store the value will be tracked by garbage collection.

Verifiability:

Verification checks that the type of value is verifier-assignable-toIII.1.8.1.2.3) the type of the argument, as specified in the current method's signature.