On Thu, 9 May 2024 16:02:02 GMT, Erik Gahlin <egah...@openjdk.org> wrote:

>> The field is only used once and a VarHandle implementation loads three 
>> additional classes during startup and in my measurements add about 0.6 ms to 
>> startup.
>
> A compromise between performance and readability is:
> 
> if (JFRTracing.isEnabled()) {
>       ...
> }
> 
> One additional class is loaded, but it's more clear where it comes from. I 
> didn't want to do that for the ThrowableTracer class since it had a clinit.
> 
> This could potentially cause problems if JFRTracing is loaded early from 
> Throwable or other class in the future. The static boolean flag is more safe, 
> so probably better.

One thing that isn't clear (to me anyway) is how it works with the memory 
model. It's plain read at the use sites, looks like the set when recording is 
turned on is also a plain write. Would it be possible to summarise what else 
happens when recording is turned on?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19129#discussion_r1597461416

Reply via email to