Is there any way to do an assembly dump of the native code generated by the Java just-in-time compiler?
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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, there is a way to print the generated native code (requires OpenJDK 7).
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.
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.