JIT是否将IL的二进制代码转换为二进制机器代码? [英] Does JIT convert the binary code of IL into binary machine code?

查看:125
本文介绍了JIT是否将IL的二进制代码转换为二进制机器代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这与.NET有关。


  1. 代码(高级:c#,vb.net-人类可以理解)是在VS中编译并生成dll / exe,这称为IL(也或多或少是人类可以理解的。)。

  1. Code (high-level: c#,vb.net - human understandable) is compiled in VS and dll/exe is generated This is called IL (this is also more or less human understandable).

当我们为此运行dll / exe时第一次在计算机上,CLR / JIT将IL转换为机器代码(二进制格式:0和1-这是人类无法理解的)。该机器代码保存在内存中,因此下次除非重新启动系统,否则无需进行转换。

When we run this dll/exe for the first time on the machine, the CLR/JIT converts the IL to machine code (binary format: 0's and 1's - this is not human understandable). This machine code is saved in memory so next time the conversion is not required unless the system is restarted.

ILASM.exe可用于转换dll / exe(IL代码)转换为机器代码,而ILDASM.exe与之相反。

ILASM.exe can be used to convert the dll/exe (IL code) into machine code and ILDASM.exe is other opposite.

如果编译器生成exe / dll (IL)是二进制格式,那么JIT的目的是什么?由于代码已经是二进制格式... 这是否意味着JIT将IL的二进制代码转换为二进制机器代码?

If the compiler generates exe/dll (IL) which is in binary format, then, what is purpose of the JIT? Since code is already in binary format... Does it mean that the binary code of IL is converted into binary machine code by JIT?

请纠正以上说明。

推荐答案


代码(高级:c#,vb.net -人类可理解的)在VS中编译并生成dll / exe,这称为IL(也或多或少人类可理解的)。

Code (high-level: c#,vb.net - human understandable) is compiled in VS and dll/exe is generated This is called IL (this is also more or less human understandable).

您需要区分IL的 binary 形式和IL的 textual 形式-如果打开已编译的EXE或DLL文件,则不会看到文本,因此难以理解...但是文本表示形式是一种面向对象的汇编语言。二进制表示形式是 CLI的机器代码-但这不是您正在运行的计算机的本机机器代码。

You need to differentiate between the binary form of IL, and the textual form of IL - if you open up a compiled EXE or DLL file, you won't see text, so that isn't human readable... but the textual representation is a sort of "object oriented assembly language". The binary representation is "machine code for a CLI" - but that's not the native machine code of the computer you're running on.


此机器代码保存在内存中,因此下次无需进行转换。

This machine code is saved in memory so next time the conversion is not required.

不,不是据我所知-在大多数情况下,它仅保留在 process 中。因此,如果您启动另一个进程,它将再次使代码JIT。

No, not as far as I'm aware - it's only retained in the process, in most cases. So if you start another process, it will JIT the code again.


ILASM.exe可用于转换dll / exe(IL代码)与机器代码和ILDASM.exe相反。这也保存在内存中吗?什么是文件格式?

ILASM.exe can be used to convert the dll/exe (IL code) into machine code and ILDASM.exe is other opposite. Is this saved in memory also? What is file format?

不,那不是真的。 ILASM使用 source IL(文本)并将其组装为 binary IL ...它不会将其转换为机器代码。 ILDASM进行相反的操作-将DLL或EXE转换为可以读取的文本IL。

No, that's not true. ILASM takes source IL (text) and assembles it into binary IL... it doesn't convert it into machine code. ILDASM does the reverse - it will convert a DLL or EXE into textual IL, that can be read.


何时使用该工具像ILASM吗?

When would one make use of tool like ILASM?

有时我会使用ILDASM来查看特定编译二进制文件的IL(尽管我通常使用Reflector)。我很少使用ILASM,通常是在使用ILDASM获得文本IL之后,然后以一些有趣的方式对其进行了调整。您可以查看我的不受约束的旋律项目的示例,在此我将IL表示不能用C#表示的一般约束。

I sometimes use ILDASM to look at the IL for a particular compiled binary (although I usually use Reflector). I use ILASM more rarely - usually after using ILDASM to get the text IL, then I've tweaked it in some interesting way. You could look at my Unconstrained Melody project for an example of this, where I tweak the IL to represent generic constraints which can't be represented in C#.

这篇关于JIT是否将IL的二进制代码转换为二进制机器代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆