理论:JIT编译器可以先解析整个程序,然后再执行吗?

发布于 2024-10-08 10:07:26 字数 151 浏览 0 评论 0原文

通常,JIT编译器的工作原理是读取字节代码,将其翻译为机器代码,然后执行。这是我的理解,但理论上,是否可以让JIT编译器先解析整个程序,然后再将程序作为机器代码执行?我不知道 JIT 编译器在技术上和具体上是如何工作的,所以我不知道在这种情况下有任何可行性。但理论上可能吗?还是我做错了?

Normally, JIT Compiler works by reads the byte code, translate it into machine code, and execute it. This is what I understand, but in theory, is it possible to make the JIT Compiler parses the whole program first, then execute the program later as machine code? I do not know how JIT Compiler works technically and exactly, so I don't know any feasibility in this case. But theoretically, is it possible? Or am I doing it wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

遗忘曾经 2024-10-15 10:07:26

正如 Mehrdad 所说,它不再是 JIT 编译器,但是,是的,您可以提前编译。在 .NET 中,他们有一个名为 ngen.exe 的工具 就是这样做的。

As Mehrdad said, it's no longer a JIT compiler, but yes, you can compile ahead of time. In .NET they have a tool called ngen.exe which does just this.

自由范儿 2024-10-15 10:07:26

不,这是不可能的,原因很简单,“JIT”意味着“Just-In-Time”,如果你不这样做“Just-In-Time”,那么它就不是“Just-In-Time”编译器。

这就像问是否可以购买一辆红色但蓝色的汽车一样。

您要求的是一个提前编译器,通常简称为编译器。

No, this is not possible, for the simple reason that "JIT" means "Just-In-Time" and if you don't do it "Just-In-Time", then it's not a "Just-In-Time" compiler.

That's like asking whether it would be possible to buy a red car, but in blue.

What you are asking for, is an Ahead-Of-Time compiler, which is usually just called a compiler.

愛放△進行李 2024-10-15 10:07:26

是的,这是可能的,但它通常不再称为 JIT 编译。它本质上是提前(AOT)编译。

Yes, it's possible, but it's usually not called JIT compilation anymore. It's essentially ahead-of-time (AOT) compilation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文