Disassemble Java JIT compiled native bytecode(反汇编 Java JIT 编译的原生字节码)
问题描述
有没有办法对 Java 即时编译器生成的本机代码进行汇编转储?
Is there any way to do an assembly dump of the native code generated by the Java just-in-time compiler?
还有一个相关的问题:有没有什么方法可以在不运行 JVM 的情况下使用 JIT 编译器将我的代码编译为本机代码?
And a related question: Is there any way to use the JIT compiler without running the JVM to compile my code into native machine code?
推荐答案
是的,有一种打印生成的本机代码的方法(需要 OpenJDK 7).
Yes, there is a way to print the generated native code (requires OpenJDK 7).
不,没有办法使用 JDK 的 JIT 将 Java 字节码编译为本机代码并将其保存为本机可执行文件.
No, there is no way to compile your Java bytecode to native code using the JDK's JIT and save it as a native executable.
即使这是可能的,它也可能没有你想象的那么有用.JVM 做了一些非常复杂的优化,如果需要,它甚至可以动态地去优化代码.换句话说,它并不像 JIT 将您的代码编译为本地机器语言那么简单,然后在程序运行时该本地机器语言将保持不变.此外,这不会让您制作独立于 JVM 和运行时库的本机可执行文件.
Even if this were possible, it would probably not as useful as you think. The JVM does some very sophisticated optimizations, and it can even de-optimize code on the fly if necessary. In other words, it's not as simple as the JIT compiles your code to native machine language, and then that native machine language will remain unchanged while the program is running. Also, this would not let you make a native executable that is independent of the JVM and runtime library.
这篇关于反汇编 Java JIT 编译的原生字节码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:反汇编 Java JIT 编译的原生字节码


- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01