RFR: 8351594: JFR: Rate-limited sampling of Java events [v2]
Erik Gahlin
egahlin at openjdk.org
Sun Jun 1 21:10:52 UTC 2025
On Sat, 31 May 2025 21:20:17 GMT, Markus Grönlund <mgronlun at openjdk.org> wrote:
>> Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Some reviewer feedback
>
> src/jdk.jfr/share/classes/jdk/jfr/internal/EventInstrumentation.java line 261:
>
>> 259: getfield(codeBuilder, eventClassDesc, ImplicitFields.FIELD_DURATION);
>> 260: Bytecode.invokevirtual(codeBuilder, TYPE_EVENT_CONFIGURATION, METHOD_THROTTLE);
>> 261: int result = codeBuilder.allocateLocal(TypeKind.LONG);
>
> Do we really need to store the result in a local? Can't we just dup it on the expression stack and store it directly into the field after another aload, or dup? Perhaps dup twice to then issue the mask operation?
We could do an aload(0) at the beginning, before getEventConfiguration(codeBuilder), to have "this" for putfield(duration) later, but then we would need to do a getfield(this.duration) to have it on the stack for the mask.
We can't do a dup() on duration because we need "this" on the stack to store it in this.duration. I thought using a local variable would be faster than accessing this.duration. It also reduces the chance of the value being changed by another thread.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2119593028
More information about the net-dev
mailing list