RFR: 8339214: Remove misleading CodeBuilder.loadConstant(Opcode, ConstantDesc) [v2]

ExE Boss duke at openjdk.org
Sat Aug 31 10:21:18 UTC 2024


On Sat, 31 Aug 2024 09:42:41 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:

>> Chen Liang has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Move bipush and sipush fix from Opcode cleanup to this patch
>
> src/jdk.jfr/share/classes/jdk/jfr/internal/EventInstrumentation.java line 679:
> 
>> 677:         getEventConfiguration(blockCodeBuilder);
>> 678:         // stack: [EW] [EW] [EC]
>> 679:         blockCodeBuilder.loadConstant(eventTypeId);
> 
> Does this means an int (single slot) can be pushed if the event type id happens to be below Integer.MAX_VALUE?

No, because the type of `eventTypeId` is `long`, so the boxed type is `Long`, therefore the only instructions are `LDC2_W`, `LCONST_0`, and `LCONST_1`:

https://github.com/openjdk/jdk/blob/86c4104d86d91fefae3d9dc11e4f2684d29fcde1/src/java.base/share/classes/java/lang/classfile/CodeBuilder.java#L639-L642

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20779#discussion_r1739652453


More information about the core-libs-dev mailing list