7月31日是什么星座| 比熊吃什么牌子的狗粮好| 足跟疼挂什么科室| pc材质是什么| 盆腔炎用什么药好| 眼底充血是什么原因| fa是什么意思| 营养师是干什么的| 什么是肾上腺素| 婴儿拉肚子吃什么药| 为什么会上火| 睾丸扭转有什么症状| 纤维素是什么| 下一年是什么生肖| 伍德氏灯检查什么| oz是什么单位| 小腿酸胀痛是什么原因| 白带发黄粘稠是什么原因| 莆田系是什么意思啊| 肚子胀气是什么原因引起的| 真我是什么意思| 子宫内膜脱落是什么原因| 什么的废墟| 六月份种什么菜| 灰指甲是什么样子的| 现在买什么股票好| 勃起不够硬吃什么药| 什么是气压| 俄罗斯乌克兰为什么打仗| 豚的右边念什么| 茶走是什么意思| 手机NFC什么意思| 三代试管是什么意思| 心律不齐是什么症状| 我不知道你在说什么英文| 养肝护肝吃什么食物| 冰箱里有什么细菌| 脸过敏要注意什么| 4月29日是什么星座| 霸天虎和威震天是什么关系| 减肥吃什么肉类| 独角仙吃什么| 7.10是什么日子| 吃了牛肉不能吃什么| 2018年属什么生肖| 心大是什么意思| 老年痴呆症挂什么科| 香蕉不能和什么水果一起吃| 两败俱伤是什么意思| 30年婚姻是什么婚| 老黄瓜炖什么好吃| 手足口病吃什么药最好| 一个月一个并念什么| 吃什么补血贫血| 大姨妈是什么意思| 夏威夷披萨都有什么配料| 循证是什么意思| 肚子为什么胀气| 待业什么意思| 体寒的人吃什么食物好| 飞机上不能带什么东西| 老当益壮是什么意思| 1945年是什么年| 什么叫情绪| 湿疹是什么引起的| 过期牛奶有什么用途| 小肚子疼是什么情况| 雌激素过高吃什么药| igg抗体阳性是什么意思| 出虚恭什么意思| 万寿菊什么时候开花| 手淫是什么意思| 半夜猫叫有什么预兆| 早年晚岁总无长是什么意思| 中产阶级的标准是什么| 体脂率是什么| 无性婚姻会有什么好处| 同房有什么姿势| 男人气虚吃什么补得快| 血压高什么原因引起的| 良代表什么生肖| 乳糖不耐受喝什么牛奶| 经常喝饮料有什么危害| 九月八号是什么星座| 腿发麻是什么原因| 品相是什么意思| 为什么会一直放屁| 郭靖属什么生肖| 胃胀吃什么药效果好| 梦到买房子是什么意思| 头晕为什么做眼震检查| 梦见狗是什么意思| ct平扫能检查出什么| 呜呼哀哉什么意思| 扁桃体肿大有什么症状| 拔得头筹是什么意思| 占便宜是什么意思| 发烧感冒吃什么药| 白虎女是什么意思| 尿量少是什么原因| 眼睛流眼泪用什么眼药水| 红豆薏仁水有什么功效| 1988属什么| 特异性是什么意思| 人民币代码是什么符号| 风湿类风湿有什么症状表现| 月经量少吃什么调理快| 血红蛋白浓度是什么意思| 五马长枪是什么意思| 6.22什么星座| 什么茶去火| 梦见自己得绝症了是什么预兆| 补钙吃什么好| 石棉是什么东西| 18年是什么年| 9月11号是什么星座| 蔓越莓是什么| 体温低是什么原因| 互卦是什么意思| 邓紫棋和华晨宇什么关系| 为什么有的人招蚊子| hsil是什么意思| 发糕是什么做的| 耿耿于怀是什么意思| 早上起床头晕是什么原因| 眉毛淡的男人代表什么| 请佛像回家有什么讲究| 早泄吃什么| 争奇斗艳是什么意思| 水浒传为什么叫水浒传| 血氨是什么| 骶椎隐裂是什么意思| 起水痘需要注意什么| cini是什么意思| 吃什么治失眠| 十一点是什么时辰| 儿童贫血吃什么补血最快| 女人为什么比男人长寿| 伏吟是什么意思| 女人性冷淡吃什么药| 过敏输液输什么药好| 勾芡用什么粉| 心率低有什么危害| 发改委是管什么的| 故宫里面有什么| edg是什么意思| 低氧血症是什么意思| 笙是什么意思| 隔离霜和bb霜有什么区别| 脂肪肝吃什么食物好| 子宫直肠窝积液是什么意思| lt是什么| 眉目的比喻义是什么| 去离子水是什么水| 长命百岁是什么意思| 瓜尔佳氏现在姓什么| 鸟是什么生肖| 开心的反义词是什么| 为什么脖子上会长痘痘| 接吻什么感觉| 镜花水月是什么意思| 脂浊是什么意思| 尿气味重是什么原因| feat什么意思| 什么是精神分裂症| 胸膜炎挂什么科| 窦性心律不齐是什么原因引起的| 金鱼可以和什么鱼混养| 镶是什么意思| 肾出血是什么原因引起的| 痛心疾首的疾什么意思| 灯火葳蕤是什么意思| 阴山是今天的什么地方| 什么的流水| 宫颈炎有什么症状| 多吃蔬菜对身体有什么好处| 梦见剪指甲是什么意思| 媒婆是什么意思| 早晨起来手肿是什么原因| 胰岛素针头4mm和5mm有什么区别| 激动的什么| 紧张手抖是什么原因| 后背疼是什么病| 马赛克是什么意思啊| 蟋蟀长什么样| 纳字五行属什么| darling什么意思| 太古里是什么意思| 摇头是什么病| 木瓜吃了有什么好处| 荔枝什么时候成熟| 流产吃什么药可以堕胎| 什么蘑菇| 脾胃不好挂什么科| 长辈生日送什么花| 肾病有什么症状男性| 梦见给别人理发是什么意思| 多吃什么可以长高| 高原反应有什么症状| 秦始皇叫什么| 飞机什么时候停止登机| 美的本质是什么| 醋酸是什么面料| 什么季节喝白茶| 啐了一口是什么意思| 上腹疼是什么原因| 吃什么容易长高| 梦见自己被警察抓了是什么意思| 公鸡为什么会打鸣| 诬赖是什么意思| 7月17什么星座| 吉人自有天相什么意思| 类风湿不能吃什么东西| 大耗是什么意思| 脑供血不足用什么药好| 眉骨疼是什么原因| 眼睑浮肿是什么原因| 胆气虚吃什么中成药| 3.21什么星座| 大腿抽筋是什么原因引起的| 八月一号是什么星座| 安睡裤是干什么用的| 什么是音爆| sheep是什么意思| 烧心胃酸吃什么药| 舌头短是什么原因| 为什么屁股上会长痘| 6月19什么星座| 皮肤长小肉粒是什么原因| 温字五行属什么| 玻璃体混浊吃什么药好| 山楂搭配什么泡水喝好| 痛风可以吃什么| 去医院点痣挂什么科| 人体有365个什么| 湿寒吃什么中成药| 吃什么| 充电宝100wh是什么意思| 什么的绽放| 长长的柳条像什么| 为什么不能拜女娲娘娘| 旨在是什么意思| 瓜怂是什么意思| 自然堂适合什么年龄| 嗪读什么| sm是什么意思啊| 肾腺瘤是什么病严重吗| 女人盗汗吃什么好得快| 脑干诱发电位检查是检查什么| 什么旺土| 人血馒头是什么意思| 千年修炼是什么生肖| 两什么三什么| 呼吸困难气短是什么原因| 乙型肝炎核心抗体阳性是什么意思| 什么是非遗| 舌苔是什么| 岁次什么意思| 堃什么意思| 前庭功能是什么意思| 笔仙是什么| 早上起床胃疼是什么原因| 绿色加什么颜色是蓝色| 割礼是什么| 百度

无兄弟,不相聚!一一2016陕西大队年会发生的事!

百度 今天,我们落实习主席提出的“三严三实”要求,应该始终保持清醒头脑,发扬自我革命精神,用党性修养这把剪刀,剪除失志之念、失德之欲、失格之为,永葆共产党人的先进性和纯洁性。

Common Intermediate Language (CIL), formerly called Microsoft Intermediate Language (MSIL) or Intermediate Language (IL),[1] is the intermediate language binary instruction set defined within the Common Language Infrastructure (CLI) specification.[2] CIL instructions are executed by a CIL-compatible runtime environment such as the Common Language Runtime. Languages which target the CLI compile to CIL. CIL is object-oriented, stack-based bytecode. Runtimes typically just-in-time compile CIL instructions into native code.

CIL was originally known as Microsoft Intermediate Language (MSIL) during the beta releases of the .NET languages. Due to standardization of C# and the CLI, the bytecode is now officially known as CIL.[3] Windows Defender virus definitions continue to refer to binaries compiled with it as MSIL.[4]

General information

edit

During compilation of CLI programming languages, the source code is translated into CIL code rather than into platform- or processor-specific object code. CIL is a CPU- and platform-independent instruction set that can be executed in any environment supporting the Common Language Infrastructure, such as the .NET runtime on Windows, or the cross-platform Mono runtime. In theory, this eliminates the need to distribute different executable files for different platforms and CPU types. CIL code is verified for safety during runtime, providing better security and reliability than natively compiled executable files.[5][6]

The execution process looks like this:

  1. Source code is converted to CIL bytecode and a CLI assembly is created.
  2. Upon execution of a CIL assembly, its code is passed through the runtime's JIT compiler to generate native code. Ahead-of-time compilation may also be used, which eliminates this step, but at the cost of executable-file portability.
  3. The computer's processor executes the native code.

Instructions

edit

CIL bytecode has instructions for the following groups of tasks:

Computational model

edit

The Common Intermediate Language is object-oriented and stack-based, which means that instruction parameters and results are kept on a single stack instead of in several registers or other memory locations, as in most programming languages.

Code that adds two numbers in x86 assembly language, where eax and edx specify two different general-purpose registers:

add eax, edx

Code in an intermediate language (IL), where 0 is eax and 1 is edx:

ldloc.0    // push local variable 0 onto stack
ldloc.1    // push local variable 1 onto stack
add        // pop and add the top two stack items then push the result onto the stack
stloc.0    // pop and store the top stack item to local variable 0

In the latter example, the values of the two registers, eax and edx, are first pushed on the stack. When the add-instruction is called the operands are "popped", or retrieved, and the result is "pushed", or stored, on the stack. The resulting value is then popped from the stack and stored in eax.

Object-oriented concepts

edit

CIL is designed to be object-oriented. One may create objects, call methods, and use other types of members, such as fields.

Every method needs (with some exceptions) to reside in a class. So does this static method:

.class public Foo {
    .method public static int32 Add(int32, int32) cil managed {
        .maxstack 2
        ldarg.0 // load the first argument;
        ldarg.1 // load the second argument;
        add     // add them;
        ret     // return the result;
    }
}

The method Add does not require any instance of Foo to be declared because it is declared as static, and it may then be used like this in C#:

int r = Foo.Add(2, 3);    // 5

In CIL it would look like this:

ldc.i4.2
ldc.i4.3
call int32 Foo::Add(int32, int32)
stloc.0

Instance classes

edit

An instance class contains at least one constructor and some instance members. The following class has a set of methods representing actions of a Car-object.

.class public Car {
    .method public specialname rtspecialname instance void .ctor(int32, int32) cil managed {
        /* Constructor */
    }

    .method public void Move(int32) cil managed { /* Omitting implementation */ }
    .method public void TurnRight() cil managed { /* Omitting implementation */ }
    .method public void TurnLeft() cil managed { /* Omitting implementation */ }
    .method public void Brake() cil managed { /* Omitting implementation */ }
}

Creating objects

edit

In C# class instances are created like this:

Car myCar = new Car(1, 4); 
Car yourCar = new Car(1, 3);

And those statements are roughly the same as these instructions in CIL:

ldc.i4.1
ldc.i4.4
newobj instance void Car::.ctor(int, int)
stloc.0    // myCar = new Car(1, 4);
ldc.i4.1
ldc.i4.3
newobj instance void Car::.ctor(int, int)
stloc.1    // yourCar = new Car(1, 3);

Invoking instance methods

edit

Instance methods are invoked in C# as the one that follows:

myCar.Move(3);

As invoked in CIL:

ldloc.0    // Load the object "myCar" on the stack
ldc.i4.3
call instance void Car::Move(int32)

Metadata

edit

The Common Language Infrastructure (CLI) records information about compiled classes as metadata. Like the type library in the Component Object Model, this enables applications to support and discover the interfaces, classes, types, methods, and fields in the assembly. The process of reading such metadata is called "reflection".

Metadata can be data in the form of "attributes". Attributes can be customized by extending the Attribute class. This is a powerful feature. It allows the creator of the class the ability to adorn it with extra information that consumers of the class can use in various meaningful ways, depending on the application domain.

Example

edit

Below is a basic "Hello, World!" program written in CIL assembler. It will display the string "Hello, world!".

.assembly Hello {}
.assembly extern mscorlib {}
.method static void Main()
{
    .entrypoint
    .maxstack 1
    ldstr "Hello, world!"
    call void [mscorlib]System.Console::WriteLine(string)
    ret
}

The following code is more complex in number of opcodes.

This code can also be compared with the corresponding code in the article about Java bytecode.

static void Main(string[] args)
{
    for (int i = 2; i < 1000; i++)
    {
        for (int j = 2; j < i; j++)
        {
             if (i % j == 0)
                 goto outer;
        }
        Console.WriteLine(i);
        outer:;
    }
}

In CIL assembler syntax it looks like this:

.method private hidebysig static void Main(string[] args) cil managed
{
    .entrypoint
    .maxstack  2
    .locals init (int32 V_0,
                  int32 V_1)

              ldc.i4.2
              stloc.0
              br.s       IL_001f
    IL_0004:  ldc.i4.2
              stloc.1
              br.s       IL_0011
    IL_0008:  ldloc.0
              ldloc.1
              rem
              brfalse.s  IL_001b
              ldloc.1
              ldc.i4.1
              add
              stloc.1
    IL_0011:  ldloc.1
              ldloc.0
              blt.s      IL_0008
              ldloc.0
              call       void [mscorlib]System.Console::WriteLine(int32)
    IL_001b:  ldloc.0
              ldc.i4.1
              add
              stloc.0
    IL_001f:  ldloc.0
              ldc.i4     0x3e8
              blt.s      IL_0004
              ret
}

This is just a representation of how CIL looks near the virtual machine (VM) level. When compiled the methods are stored in tables and the instructions are stored as bytes inside the assembly, which is a Portable Executable (PE).

Generation

edit

A CIL assembly and instructions are generated by either a compiler or a utility called the IL Assembler (ILAsm) that is shipped with the execution environment.

Assembled CIL can also be disassembled into code again using the IL Disassembler (ILDASM). There are other tools such as .NET Reflector that can decompile CIL into a high-level language (e. g. C# or Visual Basic). This makes CIL a very easy target for reverse engineering. This trait is shared with Java bytecode. However, there are tools that can obfuscate the code, and do it so that the code cannot be easily readable but still be runnable.

Execution

edit

Just-in-time compilation

edit

Just-in-time compilation (JIT) involves turning the byte-code into code immediately executable by the CPU. The conversion is performed gradually during the program's execution. JIT compilation provides environment-specific optimization, runtime type safety, and assembly verification. To accomplish this, the JIT compiler examines the assembly metadata for any illegal accesses and handles violations appropriately.

Ahead-of-time compilation

edit

CLI-compatible execution environments also come with the option to do an Ahead-of-time compilation (AOT) of an assembly to make it execute faster by removing the JIT process at runtime.

In the .NET Framework there is a special tool called the Native Image Generator (NGEN) that performs the AOT. A different approach for AOT is CoreRT that allows the compilation of .Net Core code to a single executable with no dependency on a runtime. In Mono there is also an option to do an AOT.

Pointer instructions - C++/CLI

edit

A notable difference from Java's bytecode is that CIL comes with ldind, stind, ldloca, and many call instructions which are enough for data/function pointers manipulation needed to compile C/C++ code into CIL.

class A {
   public: virtual void __stdcall meth() {}
};
void test_pointer_operations(int param) {
	int k = 0;
	int * ptr = &k;
	*ptr = 1;
	ptr = &param;
	*ptr = 2;
	A a;
	A * ptra = &a;
	ptra->meth();
}

The corresponding code in CIL can be rendered as this:

.method assembly static void modopt([mscorlib]System.Runtime.CompilerServices.CallConvCdecl) 
        test_pointer_operations(int32 param) cil managed
{
  .vtentry 1 : 1
  // Code size       44 (0x2c)
  .maxstack  2
  .locals ([0] int32* ptr,
           [1] valuetype A* V_1,
           [2] valuetype A* a,
           [3] int32 k)
// k = 0;
  IL_0000:  ldc.i4.0 
  IL_0001:  stloc.3
// ptr = &k;
  IL_0002:  ldloca.s   k // load local's address instruction
  IL_0004:  stloc.0
// *ptr = 1;
  IL_0005:  ldloc.0
  IL_0006:  ldc.i4.1
  IL_0007:  stind.i4 // indirection instruction
// ptr = &param
  IL_0008:  ldarga.s   param // load parameter's address instruction
  IL_000a:  stloc.0
// *ptr = 2
  IL_000b:  ldloc.0
  IL_000c:  ldc.i4.2
  IL_000d:  stind.i4
// a = new A;
  IL_000e:  ldloca.s   a
  IL_0010:  call       valuetype A* modopt([mscorlib]System.Runtime.CompilerServices.CallConvThiscall) 'A.{ctor}'(valuetype A* modopt([mscorlib]System.Runtime.CompilerServices.IsConst) modopt([mscorlib]System.Runtime.CompilerServices.IsConst))
  IL_0015:  pop
// ptra = &a;
  IL_0016:  ldloca.s   a
  IL_0018:  stloc.1
// ptra->meth();
  IL_0019:  ldloc.1
  IL_001a:  dup
  IL_001b:  ldind.i4 // reading the VMT for virtual call
  IL_001c:  ldind.i4
  IL_001d:  calli      unmanaged stdcall void modopt([mscorlib]System.Runtime.CompilerServices.CallConvStdcall)(native int)
  IL_0022:  ret
} // end of method 'Global Functions'::test_pointer_operations

See also

edit

References

edit
  1. ^ "What is "managed code"?". Microsoft. 19 April 2023.
  2. ^ "ECMA-335 Common Language Infrastructure (CLI)".
  3. ^ "What is Intermediate Language(IL)/MSIL/CIL in .NET". Retrieved 2025-08-05. CIL: ... When we compile [a]. NET project, it [is] not directly converted to binary code but to the intermediate language. When a project is run, every language of .NET programming is converted into binary code into CIL. Only some part of CIL that is required at run time is converted into binary code. DLL and EXE of .NET are also in CIL form.
  4. ^ "HackTool:MSIL/SkypeCracker". Microsoft. Retrieved 26 November 2019.
  5. ^ Troelsen, Andrew (2025-08-05). Benefits of CIL. Apress. ISBN 9781590598849. Retrieved 2025-08-05.
  6. ^ "Unmanaged, Managed Extensions for C++, Managed and .Net Framework". www.visualcplusdotnet.com. Retrieved 2025-08-05.

Further reading

edit
  • Bock, Jason (2002). CIL Programming: Under the Hood of .NET. Apress. ISBN 978-1590590416.
edit
婚前体检都检查什么 戊土是什么土 1288是什么意思 马子是什么意思 每天吃洋葱有什么好处
十九朵玫瑰花代表什么意思 巴氏征阳性是什么意思 什么属相不能带狗牙 令香是什么意思 啤酒花是什么东西
经常落枕是什么原因引起的 很多屁放是什么原因 b什么意思 吃饭出汗多是什么原因 三湖慈鲷可以和什么鱼混养
看走眼是什么意思 雄起是什么意思 吉和页念什么 水痘疫苗什么时候打 阳光照耀是什么意思
舌头溃疡是什么原因造成的520myf.com 芡实和什么搭配最好hcv8jop5ns4r.cn 阿鼻地狱是什么意思hcv7jop9ns2r.cn 细佬什么意思hcv9jop0ns3r.cn 肚子冰凉是什么原因hcv8jop3ns9r.cn
机体是什么意思hcv9jop3ns0r.cn 火气旺盛有什么症状hcv8jop8ns6r.cn 素颜霜是干什么用的hcv8jop7ns3r.cn 大学校长是什么级别hcv8jop7ns9r.cn 孕妇白蛋白偏低是什么意思hcv8jop0ns0r.cn
什么人容易得肺结核520myf.com 塔罗牌是什么意思hcv9jop2ns6r.cn 正品行货是什么意思hcv7jop6ns3r.cn 三分钟热度是什么意思hcv8jop6ns1r.cn 6月15日什么星座hcv9jop6ns7r.cn
europe是什么意思hcv9jop7ns1r.cn 山梨糖醇是什么hcv8jop5ns2r.cn 梅花表属于什么档次travellingsim.com 爆菊是什么意思hcv9jop4ns9r.cn 教师节送老师什么礼物最好chuanglingweilai.com
百度