RFR: 8307190: Refactor ref_at methods in Constant Pool [v4]

Ioi Lam iklam at openjdk.org
Fri May 19 20:22:58 UTC 2023


On Thu, 18 May 2023 16:24:27 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:

>> In anticipation of [JDK-8301996](https://bugs.openjdk.org/browse/JDK-8301996), some of the accessors in constantpool.cpp need to be updated. The CPCache rework introduces multiple new meanings to the index argument passed to these functions, so they need to be restructured in a way that facilitates different paths depending on the input. For this enhancement, the bytecode is propagated by the callers to determine how to handle the index. Thanks to this and JDK-8307306, `bool uncached` is no longer needed in these functions.
>> 
>> Tests have been altered to suit the changes to JVMCI. Verified with tier1-5 tests.
>
> Matias Saavedra Silva has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Removed unused imports

Looks good to me. Just some minor nits about the tests.

test/hotspot/jtreg/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java line 102:

> 100: 
> 101:     /**
> 102:      * Select an arbitrary bytecode of the type associated with the Constant pool entry type

"Arbitrary" sounds dangerous. I think it's better to clarify what the intention is. You can remove the summary (the above line) and just have the `@return` tag to be something like this:


@return a bytecode that's suitable for passing to the following functions for the given cpType:
                - CompilerToVMHelper.lookupNameAndTypeRefIndexInPool()
                - CompilerToVMHelper.lookupNameInPool()
                - CompilerToVMHelper.lookupSignatureInPool()
                - CompilerToVMHelper.lookupKlassRefIndexInPool()

test/hotspot/jtreg/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java line 113:

> 111:           case CONSTANT_METHODREF:
> 112:           case CONSTANT_INTERFACEMETHODREF:
> 113:               return Bytecodes.INVOKEVIRTUAL;

It's better to return INVOKEINTERFACE for CONSTANT_METHODREF.

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

Marked as reviewed by iklam (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13872#pullrequestreview-1435036930
PR Review Comment: https://git.openjdk.org/jdk/pull/13872#discussion_r1199337560
PR Review Comment: https://git.openjdk.org/jdk/pull/13872#discussion_r1199333392


More information about the hotspot-dev mailing list