ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

IL 语法分析

2019-06-27 10:03:23  阅读:227  来源: 互联网

标签:语法分析 string value call IL Evaluation Stack String


Managed Heap: GC auto manage. One process, One heap.

Call Stack: Runtime auto manage, every time when you call a method, the Record frame+1.

Record Frame save the Method Parameter and Return Address and Local Variable

Evaluation Stack: Every Thread.

ldc.i4.1: Put a 4 byte with value 1 to Evaluation Stack.

stloc.0 : Retrieve a value from Evaluation Stack then put it to Call Stack Record Frame V0 and set V0 = 1

stloc
Retval is an instruction that takes the result of the call to sscanf from the stack and stores it in the local
variable Retval. We need to save this value in
a local variable because we will need it later.

ldloc.0: Put V0 to Evaluation Stack

ldloc Retval copies
the value of back onto the stack. We
need to check this value, which was taken off the stack by the instruction.Retvalstloc

box [mscorlib]System.Int32: Retrieve a value from Evaluation Stack, then box this value type to reference type and put it to Managed Heap.

ldstr "i+j+k": Put the "i+j+k" reference to Evaluation Stack from Managed Heap.

ldstr “Enter a number”
is an instruction that loads the specified string constant onto the
stack. The string constant in this case is stored in the metadata. We can refer
to such strings as common language runtime string
constants or metadata string constants. You can
store and handle the string constants in another way, as explained in a few
moments, but ldstr deals exclusively with
common language runtime string constants, which are always stored in Unicode
format

call string [mscorlib] System.String::Concat(object, object): 從 Evaluation Stack 中取出兩個值,此二值皆為 Reference Type,下面的值當作第一個參數,上面的值當作第二個參數,呼叫 mscorlib.dll 所提供的 System.String.Concat() method 來將此二參數進行字串接合(String Concatenation),將接合出來的新字串放在 Managed Heap,將其 Reference 放進 Evaluation Stack。值得注意的是:由於 System.String.Concat() 是 static method,所以此處使用的指令是 call,而非 callvirt(呼叫虛擬)

ret: End this call.

标签:语法分析,string,value,call,IL,Evaluation,Stack,String
来源: https://www.cnblogs.com/xiyin/p/11095269.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有