如何在Java运行时环境,在编译过程方面的.NET架构比较? [英] How does the Java Runtime Environment compare with the .NET framework in terms of compilation process?

查看:171
本文介绍了如何在Java运行时环境,在编译过程方面的.NET架构比较?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习有关的源代码的机器码通过 .NET JRE 框架的转换。要开始我做了一些研究比较这两个进程和创建此图。我需要批评的正确性,更重要的是增加任何严肃的事情我错过了更好的理解编译途径有所帮助。

I am learning about the conversion of source code to machine code via the .NET and JRE Frameworks. To start off I did some research comparing the two processes and created this diagram. I need some help in criticizing its correctness, and more importantly adding any serious things I missed out to better understand the compilation pathway.

推荐答案

.NET和java的向下编译成字节码,即它包含了一个虚拟机指​​令的中间语言。这不是机器代码,因为它无法在物理机上直接运行。会发生什么,而不是(至少在今天,Java有较深的历史,在这方面)是在运行时刚刚即时编译器在运行它转换VM指令为本地代码,然后直接运行。这具有超过仅解释它的一个主要性能benefot

Both .NET and Java compile down to bytecode, that is an intermediate language which contains instructions for a virtual machine. It's not machine code because it cannot run directly on a physical machine. What happens instead (today at least; Java has a darker history in this regard) is that at runtime a just-in-time compiler is run which translates the VM instructions into native code that is then run directly. This has a major performance benefot over only interpreting it.

它们在这方面的一点点不同。苏<子> ^ H ^ H Oracle的Java实现使用解释的巧妙搭配,测量和JIT编译只是大量使用的部件否则解释。这是为了减少由JIT编译器初始冲击(其需要前期否则运行,延长处理的启动时间),同时仍然允许在需要的地方良好的性能。 。在另一方面.NET始终的JIT编译时使用(未使用的代码不编译,虽然)所有代码

They differ in this regard a little. Su^H^HOracle's Java implementation uses a clever mix of interpretation, measuring and JIT compiling just the parts that are heavily used and interpreting otherwise. This is to reduce initial impact by the JIT compiler (which needs to run upfront otherwise, lengthening process startup time) while still allowing good performance where needed. .NET on the other hand always JIT-compiles all code that is used (unused code is not compiled, though).

至于你在你的注释中提到的问题:是的,CLR和JVM的的平台这样的程序运行。虚拟机是一台机器也是如此,只是较少的硬件-Y。他们都被紧紧地与相应的框架,基类库.NET和Java类库的Java集成。这些都是框架。

As for a question you mentioned in your comments: Yes, the CLR and the JVM are the platforms such programs are run on. A virtual machine is a machine too, just less hardware-y. They both are tightly integrated with a corresponding framework, the Base Class Library for .NET and the Java class library for Java. Those are frameworks.

这篇关于如何在Java运行时环境,在编译过程方面的.NET架构比较?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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