Revisit j.l.classfile.CodeBuilder API surface

Adam Sotona adam.sotona at oracle.com
Wed Jan 10 12:42:50 UTC 2024


We can probably attach the no-arg instructions to the Opcode enum, so the rest of the API will stay unchanged.

BTW: I just barely remember there was some reason to have each instruction as unique instance, however I don’t see it now.


From: Brian Goetz <brian.goetz at oracle.com>
Date: Tuesday, 9 January 2024 at 17:44
To: Adam Sotona <adam.sotona at oracle.com>, liangchenblue at gmail.com <liangchenblue at gmail.com>, classfile-api-dev <classfile-api-dev at openjdk.org>
Subject: Re: Revisit j.l.classfile.CodeBuilder API surface
These look good to me.  (Perhaps some of the instruction-specific methods could use the singleton instances of the single-bytecode instructions rather than the factory?)
On 1/9/2024 11:35 AM, Adam Sotona wrote:
Sorry, wrong PR https://github.com/openjdk/jdk/pull/17282 in the link below.


From: classfile-api-dev <classfile-api-dev-retn at openjdk.org><mailto:classfile-api-dev-retn at openjdk.org> on behalf of Adam Sotona <adam.sotona at oracle.com><mailto:adam.sotona at oracle.com>
Date: Tuesday, 9 January 2024 at 17:32
To: Brian Goetz <brian.goetz at oracle.com><mailto:brian.goetz at oracle.com>, liangchenblue at gmail.com<mailto:liangchenblue at gmail.com> <liangchenblue at gmail.com><mailto:liangchenblue at gmail.com>, classfile-api-dev <classfile-api-dev at openjdk.org><mailto:classfile-api-dev at openjdk.org>
Subject: Re: Revisit j.l.classfile.CodeBuilder API surface
Hi,
I’ve updated the PR<https://github.com/openjdk/jdk/pull/17306> draft with removal of operator method as obsolete and
newPrimitiveArray, newReferenceArray and newMultidimensionalArray methods as duplicate.

I’ve also extended conversion method to support the whole matrix (including multi-step conversions, no-op conversions and BooleanType conversions), see CodeBuilder.java#L548<https://github.com/openjdk/jdk/blob/027374004c9c9bf53a709c98593363043e8b7782/src/java.base/share/classes/java/lang/classfile/CodeBuilder.java#L548>

Regarding the allocateLocal I would slightly prefer to keep it, however allocateSlot or allocateLocalSlot or reserveLocalSlot are also fine.
Prefix new would be confusing.

Thanks,
Adam




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20240110/d479452d/attachment.htm>


More information about the classfile-api-dev mailing list