IL代码中的那些符号是什么?
What are those symbols in IL code?
IL 代码中的这个符号(IL_0000
等)是什么。这是真正的内存堆地址吗?
IL_0000: nop
IL_0001: ldstr "here is something"
IL_0006: call void [mscorlib]System.Console::WriteLine(string)
IL_000b: nop
IL_000c: ldc.i4.s 18
IL_000e: newobj instance void Proj.Stock::.ctor(int32)
IL_0013: stloc.0
IL_0014: ldstr "another"
IL_0019: call void [mscorlib]System.Console::WriteLine(string)
IL_001e: nop
IL_001f: ldstr "and even more"
IL_0024: call void [mscorlib]System.Console::WriteLine(string)
IL_0029: nop
IL_002a: ret
IL_0000:
是代码标签。它实际上只是一个标识符,因此您可以轻松地通过名称而不是字节数来引用跳转位置。
请参阅公共语言基础结构 (CLI) 标准文档。
ECMA-335 第 II.5.4 节
II.5.4 Labels and l ists of labels
Labels are provided as a programming convenience; they represent a
number that is encoded in the metadata. The value represented by a
label is typically an offset in bytes from the beginning of the
current method, although the precise encoding differs depending on
where in the logical metadata structure or CIL stream the label
occurs.
...
IL 代码中的这个符号(IL_0000
等)是什么。这是真正的内存堆地址吗?
IL_0000: nop
IL_0001: ldstr "here is something"
IL_0006: call void [mscorlib]System.Console::WriteLine(string)
IL_000b: nop
IL_000c: ldc.i4.s 18
IL_000e: newobj instance void Proj.Stock::.ctor(int32)
IL_0013: stloc.0
IL_0014: ldstr "another"
IL_0019: call void [mscorlib]System.Console::WriteLine(string)
IL_001e: nop
IL_001f: ldstr "and even more"
IL_0024: call void [mscorlib]System.Console::WriteLine(string)
IL_0029: nop
IL_002a: ret
IL_0000:
是代码标签。它实际上只是一个标识符,因此您可以轻松地通过名称而不是字节数来引用跳转位置。
请参阅公共语言基础结构 (CLI) 标准文档。 ECMA-335 第 II.5.4 节
II.5.4 Labels and l ists of labels
Labels are provided as a programming convenience; they represent a number that is encoded in the metadata. The value represented by a label is typically an offset in bytes from the beginning of the current method, although the precise encoding differs depending on where in the logical metadata structure or CIL stream the label occurs.
...