程序重新启动时的JITted机器指令 [英] JITted machine instructions at program restart

查看:81
本文介绍了程序重新启动时的JITted机器指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当程序终止或重新启动时,由JIT编译器生成的机器代码/指令会发生什么情况. JIT编译会再次发生吗?如果是这样,为什么会使用这种方法?

What happens to the machine code/instructions that are generated by the JIT compiler when a program is terminated or restarted. Does the JIT compilation occur again? If so, why would it use this approach?

为了简化范围,我想特别了解.NET,但是为了他人的利益,欢迎提供有关其他实现的答案

To keep the scope simple, I would like to know specifically about .NET but for the benefit of others, answers about other implementations are welcome

推荐答案

JIT编译会再次发生吗?

Does the JIT compilation occur again?

是的,一般.

如果是,为什么会使用这种方法?

If so, why would it use this approach?

一方面,它避免了有关将JITted代码存储在哪里,存储多长时间等问题.另一方面,它避免了由于有人将硬盘驱动器移至具有不同CPU的机器而导致代码无效的问题. .我怀疑JIT编译在大多数程序的总时间中只占了相对的一小部分.

For one thing, it avoids questions about where the JITted code should be stored, how long for etc. For another, it avoids the code becoming invalid due to someone moving their hard drive to a machine with a different CPU, for example. I suspect it's felt that JIT compilation is a relatively small part of the total time taken for most programs.

现在,您可以使用

Now you can "pre-JIT" an assembly using NGen - but there are some optimizations I believe it can't make, and again the generated code becomes invalid if you change CPU etc.

还请注意,.NET框架本身在首次安装时将运行后台服务,以JIT编译框架库(这可能构成大多数应用程序运行的大部分代码).大概它有一些聪明的地方,可以在需要时进行重新编译...我从来没有对它进行过多的研究.

Also note that the .NET framework itself will run a background service when it's first installed, to JIT compile the framework libraries (which will probably form the bulk of the code run for most apps). Presumably it has some smarts to recompile if necessary... I've never looked into it in too much detail.

这篇关于程序重新启动时的JITted机器指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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