Talk to the JVM (10) Mac Hsdis and jitwatch download and use

Source: Internet
Author: User

There are detailed Hsdis and Jitwatch textbooks on the web, such as this one using Hsdis and Jitwatch to view the assembly code generated by the analysis hotspot JIT compiler


Hsdis is able to view the compiled code generated by Java, which can be viewed in this article. Here are the Http://pan.baidu.com/s/1i3HxFDF for Hsdis-amd64.dylib and hsdis-amd64.so files under Mac

So you don't have to go back to compiling. The former is under the Mac 64-bit machine and the latter is under the Linux 64-bit machine.


After downloading the Hsdis, the simplest way to let the Java command load it is to put it under a directory and export the directory, for example, under. BASHRC

Export ld_library_path=~/documents/hsdis/

This allows you to use Hsdis to view the JIT-generated assembly code. You can use the following command to see if Hsdis is working

Java-xx:+unlockdiagnosticvmoptions-xx:+printassembly-version

See the results below to prove that Hsdis is configured correctly.


Let's try using Hsdis to generate a class assembler code.

The java-server directive specifies that the JIT is optimized using the C2 compiler, the-XCOMP option specifies that the JVM runs in compile mode, otherwise the mix mode is the default, and only hotspot code is optimized for JIT compilation. Many people say that the written class is not JIT-compiled, and my experience is that this class will generate a sink code if there is a main method. -xx:+printassembly can print the sink code. Execute the following command to have the JIT compile and generate the results into the specified log file

Java-server-xcomp  -xx:+unlockdiagnosticvmoptions-xx:+traceclassloading  -xx:+printassembly-xx:+ Logcompilation-xx:logfile=jit.log test. Testmain

You can use the Jitwatch tool to view the log files that were just generated. Jitwatch can be downloaded from Http://pan.baidu.com/s/1i3HxFDF. I put a jitwatch.sh in the inside, download it and then change the path in the file can be run directly.

The use of Jitwatch can be seen in this article using Hsdis and Jitwatch view analysis hotspot JIT compiler generated assembly code

Use Jitwatch to see which methods have been JIT-compiled



After calling a method, the Oopmap state is set, which is a safepoint



Before the method returns, the code test%eax, 0xxxxxxx, is inserted safepoint polling page, so that the thread can be blocked when it enters the SafePoint



Hsdis and Jitwatch are a powerful tool for learning the JVM, download it and use it.



Talk to the JVM (10) Mac Hsdis and jitwatch download and use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.