.net - How are different types handled on the stack in CIL -
experimenting ildasm dive cil code became obvious cil working stack-based support expressions like
il_0001: ldc.i4.s 13 ; 1f 0d il_0003: stloc.0 ; 0a il_0004: ldc.i4.s 31 ; 1f 1f il_0006: stloc.1 ; 0b il_0007: ldloc.0 ; 06 il_0008: ldloc.1 ; 07 il_0009: add ; 58 doing same float32 instead of int32 using ldc.r4 <num> there no difference in calling add making me wonder whether there different stacks different types or if there 1 stack holds metadata type specific element has on stack. there information specific implementation in ecma-335 or somewhere else?
this addressed in partition i, part 12 (from e.g. pdf), discusses virtual execution system (ves):
as described below, cil instructions not specify operand types. instead, cli keeps track of operand types based on data flow , aided stack consistency requirement described below. example, single
addinstruction add 2 integers or 2 floats stack.
and:
most cil instructions deal numbers take operands evaluation stack (see §i.12.3.2.1), , these inputs have associated type known ves. result, single operation
addcan have inputs of numeric data type, although not instructions can deal combinations of operand types.
where i.12.1.4 goes considerably more detail also.
Comments
Post a Comment