add hsdis instructions for the macos

This commit is contained in:
Rob Muir 2023-10-21 02:02:24 -04:00
parent afb2a60751
commit c09fb560f7
1 changed files with 18 additions and 0 deletions

View File

@ -43,9 +43,27 @@ java --module-path lucene/benchmark-jmh/build/benchmarks --module org.apache.luc
hsdis setup
===========
Linux
In order to see disassembled instructions and not just binary instructions when using '-prof perfasm':
$ git clone --depth 1 https://github.com/openjdk/jdk/
$ curl -f https://ftp.gnu.org/gnu/binutils/binutils-2.38.tar.gz | tar -zxf -
$ (cd jdk && bash ./configure --with-hsdis=binutils --with-binutils-src=../binutils-2.38 && make build-hsdis)
$ cp jdk/build/linux-x86_64-server-release/support/hsdis/hsdis-amd64.so $JAVA_HOME/lib/server
Mac OS X
In order to see disassembled instructions and not just binary instructions when using '-prof dtraceasm':
This one is a little rough because they removed the Makefile so you have to bring it back from the dead.
Otherwise you are stuck wrestling down full dependencies of OpenJDK (metal etc) just to compile a single C file.
Also you must run benchmarks as root to use dtrace, but it works.
$ git clone --depth 1 https://github.com/openjdk/jdk/
$ curl -fo jdk/src/utils/hsdis/binutils/Makefile https://raw.githubusercontent.com/openjdk/jdk/3c7ae1225f0d5575fd927a9b76fb40dc30e208cd/src/utils/hsdis/Makefile
$ vi jdk/src/utils/hsdis/binutils/Makefile, change SOURCE = hsdis.c to SOURCE = hsdis-binutils.c
$ vi jdk/src/utils/hsdis/binutils/hsdis-binutils.c, change #include "hsdis.h" to #include "../hsdis.h"
$ (cd jdk/src/utils/hsdis && make BINUTILS=../../../../../binutils-2.38 ARCH=aarch64)
$ cp jdk/src/utils/hsdis/binutils/build/macosx-aarch64/hsdis-aarch64.dylib $JAVA_HOME/lib/server