RFR: 8339260: Move rarely used constants out of ClassFile [v6]

Chen Liang liach at openjdk.org
Mon Sep 23 15:21:38 UTC 2024


On Mon, 23 Sep 2024 15:15:15 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 14 commits:
>> 
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/constant-moving
>>  - omission in tests
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/constant-moving
>>  - Rename constants at new locations, link to related factories, cp tag constant names
>>  - Fix compile errors
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/constant-moving
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/constant-moving
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/constant-moving
>>  - Compile errors; now tests are all green.
>>  - Move Constant Pool tags to PoolEntry
>>    
>>    Two unexpected usages in jlink raw processing, but rest is fine
>>  - ... and 4 more: https://git.openjdk.org/jdk/compare/6fd043f1...fa9ea36d
>
> src/java.base/share/classes/java/lang/classfile/Opcode.java line 1133:
> 
>> 1131:      */
>> 1132:     @PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
>> 1133:     public static final class OpcodeValues {
> 
> I think we should not introduce a new API class just to expose int constants we plan to hide under the Opcode.
> My proposal is to hard-code the opcodes in the Opcode initialization and remove OpcodeValues class.

I think we can move these values to an implementation class like `RawBytecodeHelper` as we make use of these values. We can always move these constants back if there is need.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20773#discussion_r1771661393


More information about the core-libs-dev mailing list