Printing Generated Assembly Code From The Hotspot JIT Compiler documented back in 2013 how to view Java Hotspot generated assembly code.
While still useful, the disassembler plugin referenced in the post is no longer available in binary form as the Kenai project has been decommissioned.
A number of references are available on how to build the plugin, however information on how to build on current macOS systems is hard to come by. Here is how to build the disassembler plugin on Java 10.
- macOS High Sierra 10.13
- Xcode 9.3 (including Command-line Tools)
|# Download OpenJDK Reference Implementation Sources from|
|curl -O https://download.java.net/openjdk/jdk10/ri/openjdk-10_src.zip|
|# Navigate to the hsdis sources|
|# Download binutils 2.26|
|curl -O https://mirrors.syringanetworks.net/gnu/binutils/binutils-2.26.tar.gz|
|tar xzvf binutils-2.26.tar.gz|
|# Build hsdis|
|make BINUTILS=binutils-2.26 all64|
|# Install hsdis|
|sudo cp build/macosx-amd64/hsdis-amd64.dylib /Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home/lib/server|
- https://github.com/AdoptOpenJDK/jitwatch/wiki/Building-hsdis pointed out the requirement for binptils 2.26
- https://www.chrisnewland.com/updated-instructions-for-building-hsdis-on-osx-417 was a good starting point
- OpenJDK Supported platforms: https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms
- OpenJDK Sources: http://jdk.java.net/java-se-ri/10
- java command line arguments: https://docs.oracle.com/javase/10/tools/java.htm