RFR: 8335946: DTrace code snippets should be generated when DTrace flags are enabled

kuaiwei duke at openjdk.org
Tue Jul 9 05:27:02 UTC 2024


Some DTrace code snippets are generated no matter dtrace is enabled or not. It looks dtrace flags could be dynamic changed in previous jdk releases. Since they are not changeable, the code snippets can be generated based on flags. The code snippets are:
1. method entry of native wrapper
2. method entry/exit of interpreter
3. allocation of interpreter

For example, run this command and check output with x86_64 build:
./java -XX:+UnlockDiagnosticVMOptions -XX:+PrintNativeNMethods -version


  0x00007f541436418f: cmpb $0x0,0x163c8b17(%rip) # 0x00007f542a72ccad
                                                            ; {external_word}
  0x00007f5414364196: je 0x00007f54143641d0
  0x00007f541436419c: push %rsi
  0x00007f541436419d: push %rdx
  0x00007f541436419e: push %rcx
  0x00007f541436419f: movabs $0x7f5386436860,%rsi ; {metadata({method} {0x00007f5386436860} 'getReferenceVolatile' '(Ljava/lang/Object;J)Ljava/lang/Object;' in 'jdk/internal/misc/Unsafe')}
  0x00007f54143641a9: mov %r15,%rdi
  0x00007f54143641ac: test $0xf,%spl
  0x00007f54143641b0: je 0x00007f54143641c8
  0x00007f54143641b6: sub $0x8,%rsp
  0x00007f54143641ba: callq 0x00007f5429ffe180 ; {runtime_call SharedRuntime::dtrace_method_entry(JavaThread*, Method*)}
  0x00007f54143641bf: add $0x8,%rsp
  0x00007f54143641c3: jmpq 0x00007f54143641cd
  0x00007f54143641c8: callq 0x00007f5429ffe180 ; {runtime_call SharedRuntime::dtrace_method_entry(JavaThread*, Method*)}
  0x00007f54143641cd: pop %rcx
  0x00007f54143641ce: pop %rdx
  0x00007f54143641cf: pop %rsi


Apply this patch, dtrace_method invocation will be emitted only when DTraceMethodProbes is enabled.

-------------

Commit messages:
 - Remove tail whitespace
 - 8335946: DTrace code snippets should be generated when DTrace flags are enabled

Changes: https://git.openjdk.org/jdk/pull/20090/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20090&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8335946
  Stats: 118 lines in 12 files changed: 5 ins; 33 del; 80 mod
  Patch: https://git.openjdk.org/jdk/pull/20090.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20090/head:pull/20090

PR: https://git.openjdk.org/jdk/pull/20090


More information about the hotspot-compiler-dev mailing list