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 ...
随机推荐
- CSAPP lab3 bufbomb-缓冲区溢出攻击实验(下)bang boom kaboom
CSAPP lab3 bufbomb-缓冲区溢出攻击实验(上)smoke fizz CSAPP lab3 bufbomb-缓冲区溢出攻击实验(下)bang boom kaboom 栈结构镇楼 这里先给 ...
- Token ,Cookie、Session傻傻分不清楚?
作者 | 王菜鸟1993 来源 | cnblogs.com/JamesWang1993/p/8593494.html 在做接口测试时,经常会碰到请求参数为token的类型,但是可能大部分测试人员对to ...
- 使用Java操作Elasticsearch(Elasticsearch的java api使用)
1.Elasticsearch是基于Lucene开发的一个分布式全文检索框架,向Elasticsearch中存储和从Elasticsearch中查询,格式是json. 索引index,相当于数据库中的 ...
- MongoDB 高级教程
MongoDB 关系 MongoDB 的关系表示多个文档之间在逻辑上的相互联系. 文档间可以通过嵌入和引用来建立联系. MongoDB 中的关系可以是: 1:1 (1对1) 1: N (1对多) N: ...
- 利用windbg分析崩溃,句柄泄漏,死锁,CPU高,内存泄漏
Windbg的一些简单使用命令 一.崩溃 1. 输入.ecxr;kbn得到崩溃的堆栈 其中源代码如下 2. 查看堆栈和源代码,发现第0帧导致崩溃,代码也是本地代码 输入.frame 0,切到第0 ...
- [b0023] python 归纳 (九)_html解析-lxml
# -*- coding: utf-8 -*- """ 学习lxml解析网页 程序功能: 解析 360影视 电影排行榜中的信息 https://www.360kan.co ...
- oracle通过impdp导入不同表用户、不同表空间的数据
原创 tegwy 发布于2013-04-21 17:34:39 阅读数 46592 收藏 展开 impdp smtj2012/密码@localhost/devdb DIRECTORY=dump_dir ...
- centos 下创建本地镜像源,结合 nginx
1. 创建同步文件 参考清华的Centos源,配置同步文件.https://mirrors.tuna.tsinghua.edu.cn/help/centos/ [root@localhost cent ...
- Flask Rest接口
Flask适用于简单的接口请求 安装 pip install Flask pip install Flask-RESTful 仅简单请求url,然后出发处理程序,返回处理结果 app.py代码如下 f ...
- js修改对象的key值
var array = [ { id:1, name:"小明" }, { id:2, name:"小红" } ]; /**/ //旧key到新key的映射 va ...