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

Coleen Phillimore coleenp at openjdk.org
Tue Jul 9 19:55:24 UTC 2024


On Tue, 9 Jul 2024 05:14:39 GMT, kuaiwei <duke at openjdk.org> wrote:

> 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.

This looks good.  Does anyone use DTRACE?

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

Marked as reviewed by coleenp (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20090#pullrequestreview-2167337296


More information about the hotspot-runtime-dev mailing list