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 ...
随机推荐
- 现代C++实现多种print
目录 Print Version1 Print Version2 Print Version3 Print Version4 容器的Print tuple容器的print 结语 学习C++的朋友会遇到 ...
- Docker第二弹之常用命令
Docker的常用命令 底层原理 Docker是如何工作的 Docker是一个Client-Server结构的系统,Docker守护进程运行在主机上, 然后通过Socket连接从客户端访问,守护进程从 ...
- AspNet Katana中Authentication有关的业务逻辑
我将从CookieAuthenticationMiddleware中间件的使用,来讲述cookie认证是如何实现的 1.系统是如何调用CookieAuthenticationMiddleware的 在 ...
- java.lang.IllegalArgumentException: java.util.zip.ZipException: invalid LOC header (bad signature)异常解决方法
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start com ...
- Flask(Jinja2) 服务端模板注入漏洞(SSTI)
flask Flask 是一个 web 框架.也就是说 Flask 为你提供工具,库和技术来允许你构建一个 web 应用程序.这个 wdb 应用程序可以使一些 web 页面.博客.wiki.基于 we ...
- dos编码格式 cmd编码 dos中文显示
设置uft-8编码 > chcp 65001 设置默认编码 > chcp 936 字符集 1258 越南语 1257 波罗的语 1256 阿拉伯语 1255 希伯来语 1254 土耳其语 ...
- Socket简单实现ssh笔记
Scoket概念: socket本质上就是在2台网络互通的电脑之间,架设一个通道,两台电脑通过这个通道来实现数据的互相传递. 我们知道网络 通信 都 是基于 ip+port 方能定位到目标的具体机器上 ...
- 记录C#-WPF布局面板
StackPanel:适合水平或者垂直方向的布局 DockPanel:区域布局 WrapPanel:自动换行的StackPanel布局 Grid:网格布局
- Dockerfile语法简介
Dockerfile是由一系列命令和参数构成的脚本,一个Dockerfile里面包含了构建整个image的完整命令.Docker通过docker build执行Dockerfile中的一系列命令自动构 ...
- Linux 的 netstat 命令
转载 https://www.cnblogs.com/ct20150811/p/9432043.html 一般用 netstat -lnp |grep "程序名"