Problem with dtraceasm profiler on openjdk-17

Сергей Цыпанов sergei.tsypanov at yandex.ru
Fri Oct 29 09:50:17 UTC 2021


Hello,

I'm running a benchmark with

sudo ... -f 1 -prof dtraceasm -jvmArgsAppend "-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly"

on MacOS and openjdk-17 the output doesn't show actual assembly commands. This is an example:

c2, level 4, org.springframework.util.ConcurrentReferenceHashMap::<init>, version 484 (57 bytes) 
  0x000000011ba08498: 7df3 4180 | 7f38 000f | 8521 0400 | 004d 8bd6 | 4d8b c849 | c1e9 0345 | 894e 204d | 8bd8 4d33 
  0x000000011ba084b8: da49 c1eb | 154d 85db | 741a 49c1 | ea09 48bf | 0040 e003 | 0100 0000 | 4903 fa80 | 3f04 0f85 
  0x000000011ba084d8: 6b05 0000 | f083 4424 
  0x000000011ba084e0: ;*putfield references {reexecute=0 rethrow=0 return_oop=0}
                      ; - org.springframework.util.ConcurrentReferenceHashMap$Segment::<init>@43 (line 487)
                      ; - org.springframework.util.ConcurrentReferenceHashMap::<init>@141 (line 184)
  0x000000011ba084e0: c000 458b 
  0x000000011ba084e4: ;*getfield references {reexecute=0 rethrow=0 return_oop=0}
                      ; - org.springframework.util.ConcurrentReferenceHashMap$Segment::<init>@48 (line 488)
                      ; - org.springframework.util.ConcurrentReferenceHashMap::<init>@141 (line 184)
  0x000000011ba084e4: 5620 478b

To fix this I've built hsdis from JDK sources as follows:

cd ~/IdeaProjects/jdk/src/utils/hsdis/
wget http://ftpmirror.gnu.org/gnu/binutils/binutils-2.37.tar.gz
tar zxvf binutils-2.37.tar.gz
export BINUTILS=binutils-2.37
make ARCH=i586

The last command was a bit confusing to me, as when I execute 'uname -p' on my Mac I see 'i386',
but 'make ARCH=i386' fails and plain 'make' creates a build config for 'i586'.

Anyway, after successful build for i586 I've copied hsdis-i586.dylib into the same folder where I have libjvm.dylib,
but there's still no assembly code in the output.

I've tried the same with openjdk-8_312 and liberica-11.0.13, but there I don't have any output at all, instead JMH issues this warning:

ERROR: No address lines detected in assembly capture. Make sure your JDK is properly configured to
print generated assembly. The most probable cause for this failure is that hsdis is not available,
or resides at the wrong path within the JDK. Try to run the same JDK with -XX:+PrintAssembly with
a simple non-JMH program and look for warning messages.

Is there a misconfiguration somewhere, or I've made wrong build?

Regards,
Sergey Tsypanov


More information about the jmh-dev mailing list