如何在 JVM 中查看 JIT 编译的代码? [英] How to see JIT-compiled code in JVM?

查看:30
本文介绍了如何在 JVM 中查看 JIT 编译的代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在 JVM 中查看 JIT 生成的本机代码?

Is there some way to see the native code produces by the JIT in a JVM?

推荐答案

假设您使用的是 Sun Hotspot JVM(即 java.com 由 Oracle 提供),您可以添加标志

Assuming you're using the Sun Hotspot JVM (i.e. the one provided on java.com by Oracle), you can add the flag

-XX:+PrintOptoAssembly

-XX:+PrintOptoAssembly

运行代码时.这将打印出 JIT 编译器生成的优化代码,并忽略其余部分.

when running your code. This will print out the optimized code generated by the JIT compiler and leaves out the rest.

如果您想查看整个字节码,包括未优化的部分,请添加

If you want see the entire bytecode, including the unoptimized parts, add

-XX:CompileThreshold=#

-XX:CompileThreshold=#

当您运行代码时.

您可以阅读有关此命令和 JIT 功能的更多信息此处.

You can read more about this command and the functionality of JIT in general here.

这篇关于如何在 JVM 中查看 JIT 编译的代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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