IL 语法分析
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 ParameterandReturn AddressandLocal 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.
IL 语法分析的更多相关文章
- IL异常处理
异常处理在程序中也算是比较重要的一部分了,IL异常处理在C#里面实现会用到一些新的方法 1.BeginExceptionBlock:异常块代码开始,相当于try,但是感觉又不太像 2.EndExcep ...
- CLR via C# 摘要二:IL速记
最简单的IL程序 .assembly test {} .method void Func() { .entrypoint ldstr "hello world" call void ...
- IL实现简单的IOC容器
既然了解了IL的接口和动态类之间的知识,何不使用进来项目实验一下呢?而第一反应就是想到了平时经常说的IOC容器,在园子里搜索了一下也有这类型的文章http://www.cnblogs.com/kkll ...
- IL接口和类的属性
上一篇文章学习了IL的入门,接下来我们再通过两个例子来了解下类的属性.构造函数以及接口的使用 一.类的属性.构造函数 1.先看下我们要构建的类的C#代码,然后再进行IL的实现,示例代码如下: [Ser ...
- IL初步了解
一.概述: 近来也是在看AOP方面的东西,了解到Emit可以实现.之前对Emit的了解也就是停留在Reflector针对方法反编译出来的部分指令.就用这次机会学习下Emit也用这篇随笔记录下学习的过程 ...
- Linux源码Kconfig文件语法分析
Kconfig是我们进行内核配置的关键文件,用于生成menuconfig的界面并生成最终确定编译选项的.config文件.关于Kconfig文件的编写规则,在Documentation/kbuild/ ...
- 【转】fatal error C1900: “P1”(第“20081201”版)和“P2”(第“20080116”版)之间 Il 不匹配
转自:这里(然而这里并没有写原出处) 背景:今天傻逼逼地想用vs2010来编译一个vs2013的项目,其中这个项目用到了一个库(应该是用2013编译的) 在我浅薄的认知中,以为只是13支持的特性更多, ...
- VS2012 集成 IL DASM IL微软中间语言查看器
第一步: 找到IL DASM的安装位置,默认在C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools 第二步: ...
- 跟vczh看实例学编译原理——三:Tinymoe与无歧义语法分析
文章中引用的代码均来自https://github.com/vczh/tinymoe. 看了前面的三篇文章,大家应该基本对Tinymoe的代码有一个初步的感觉了.在正确分析"print ...
随机推荐
- 在IDEA中用Maven打包大项目时失败问题
今天在完成公司里某项功能开发时,准备用Maven打包,后来在打包的过程中报错:OutOfMemoryError.如下图: 后来经过查找资料,发现可以配置一下Maven的参数即可解决此问题. 配置参数为 ...
- C++ 运算符重载的基本概念
01 运算符重载的需求 C++ 预定义的运算符,只能用于基本数据类型的运算:整型.实型.字符型.逻辑型等等,且不能用于对象的运算.但是我们有时候又很需要在对象之间能用运算符,那么这时我们就要重载运算符 ...
- js个人笔记简记
正则表达式 创建正则表达式的两种方法: Var reg = new RegExp(‘’) Var reg = / a/ 后面三个参数g:全局匹配 i:不区分大小写 m:多行匹配 开头结尾有用 常见 ...
- android ANR 分析定位问题
ANR ? android 规定,Activity如果5秒钟之内无法响应屏幕触摸事件或者键盘输入事件,BroadcastReceiver 如果10s中之内还未执行完操作就会出现ANR 定位ANR问题 ...
- .net4.0使用Dapper操作MySql
准备使用Dapper操作MySql,由于电脑只有vs2010,所以需要Dapper和MySql组件支持.net 4.0.经过一番测试,终于弄出一个DEMO. 1.操作MySql需要用MySql.Dat ...
- [20190920]完善vim调用sqlplus脚本.txt
[20190920]完善vim调用sqlplus脚本.txt --//以前写的http://blog.itpub.net/267265/viewspace-2140936/=>[20170617 ...
- Flask—好的博客
https://www.cnblogs.com/cwp-bg/p/8892403.html https://www.cnblogs.com/ExMan/p/9825710.html https://w ...
- 5-4 可视化库Seaborn-回归分析
In [2]: %matplotlib inline import numpy as np import pandas as pd from scipy import stats,integrate ...
- 不能聚焦元素问题 WebDriverException: Message: unknown error: cannot focus element
上周碰到了 Unable to locate element,即“无法定位元素”,后靠两行代码解决: wait = ui.WebDriverWait(driver,5) wait.until(lamb ...
- 爬虫scrapy模块
首先下载scrapy模块 这里有惊喜 https://www.cnblogs.com/bobo-zhang/p/10068997.html 创建一个scrapy文件 首先在终端找到一个文件夹 输入 s ...