c#中的jit编译器 [英] jit compiler in c#

查看:193
本文介绍了c#中的jit编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我选择一个cosole应用程序作为项目类型,使用c#作为语言.当我构建程序时,它将在bin/debug文件夹中创建.exe文件.
现在我的问题是:
jit现在使用此.exe来生成本机代码吗?

I choose an cosoleapplication as project type with c# as language .When i built the program it creates the.exe file in bin/debug folder.
Now my question is that:
Is this .exe now used by jit to produce native code?

推荐答案

基本上,是的,但与调试"无关或发行"文件夹.文件夹完全无关,它们只是不同构建配置的选项,并且绝对可以是任何东西.但是,即使配置也不相关.它们只是构建选项的集合,您可以更改和创建自己的配置,无论是否带有调试信息.最后,即使是那些选项,包括调试信息,也完全不相关.继续阅读.

实际上,您在纯.NET程序集中生成的每个可执行文件都将通过JIT. (在这里,可执行"是指任何程序集的可执行文件 module ;如果这是EXE,DLL或其他任何内容,则没有区别-这只是文件名的一部分,根本没有区别; .NET代码的中心概念是 module assembly ,但是Visual Studio仅支持创建仅由一个模块组成的程序集.)获得所有纯.NET程序集通过将源代码编译为.CLI中的CLI 字节码,称为 CIL (通用中间语言,又称为MSIL),最终在运行时将其翻译为CPU指令. >


.NET上的注释不是多余的.可以创建结合了本机(非托管)代码和托管代码的混合模式可执行模块.值得注意的是,可以使用C ++/CLI创建此类模块(在撰写本文时,我不熟悉能够进行此类开发的其他工具).显然,只有代码的托管部分才是JIT编译的主题.

请参阅:
http://en.wikipedia.org/wiki/C%2B%2B/CLI [ ^ ],
http://www.ecma-international.org/publications/standards/Ecma-372.htm [^ ],
http://msdn.microsoft.com/en-us/library/xey702bw.aspx [ ^ ].

[END EDIT]

请参阅我对问题的评论,不要着急.这不是那么简单.通常,它是按方法发生的,在第一次要调用某个方法的那一刻之前.

请参阅:
http://en.wikipedia.org/wiki/JIT-compilation [ http://en.wikipedia.org/wiki/Common_Intermediate_Language [ http://en.wikipedia.org/wiki/Common_Language_Infrastructure [ http://msdn.microsoft.com/en-us/library/k5532s8a.aspx [ ^ ].

最后一个链接是指向Microsoft文章的,解释了将代码编译为MSIL,将MSIL编译为本机代码以及其执行的步骤.

—SA
Basically, yes, but it has nothing to do with "debug" or "release" folders. Folders are totally irrelevant, they are only options of different build configurations and can be absolutely anything. But even configurations are irrelevant; they are just the sets of building options which you can change and create your own configurations, with debug information or not. And finally, even those options, including debug information, are totally irrelevant. Keep reading.

In fact, every executable you produce in pure .NET assembly goes through JIT. (By "executable" here I mean executable module of any assembly; there are no difference if this is EXE, DLL or anything else — this is just a part of a file name making no difference at all; the central notions of .NET code is module and assembly, but Visual Studio only supports creation of assemblies each composed of only one module.) All pure-.NET assemblies are obtained by compilation of source code to CLI bytecode, called CIL (Common Intermediate Language, a.k.a. MSIL) in .CLI, which is finally translated to CPU instructions during runtime.



The note on pure .NET is not redundant. It''s possible to create mixed-mode executable modules combining native (unmanaged) and managed code. Notably, such modules can be created using C++/CLI (at the moment of writing, I''m unfamiliar with other tools capable of this kind of development). Apparently, only managed part of code is subject of JIT compilation.

Please see:
http://en.wikipedia.org/wiki/C%2B%2B/CLI[^],
http://www.ecma-international.org/publications/standards/Ecma-372.htm[^],
http://msdn.microsoft.com/en-us/library/xey702bw.aspx[^].

[END EDIT]

Please see my comments to the question and don''t rush. It''s not so simple. Usually, it happens on per-method basis, before a moment of time when a method is about to be called for the very first time.

Please see:
http://en.wikipedia.org/wiki/JIT-compilation[^],
http://en.wikipedia.org/wiki/Common_Intermediate_Language[^],
http://en.wikipedia.org/wiki/Common_Language_Infrastructure[^],
http://msdn.microsoft.com/en-us/library/k5532s8a.aspx[^].

The last link is to the Microsoft article explaining steps of compilation the code to MSIL, MSIL to native code, and its execution.

—SA


这篇关于c#中的jit编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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