RFR: 8314249: Refactor handling of invokedynamic in JVMCI ConstantPool
Doug Simon
dnsimon at openjdk.org
Wed Aug 16 07:17:07 UTC 2023
On Tue, 15 Aug 2023 20:03:20 GMT, Ioi Lam <iklam at openjdk.org> wrote:
> This PR is part of the clean up JVMCI to track [JDK-8301993](https://bugs.openjdk.org/browse/JDK-8301993), where the constant pool cache is being removed (as of now, only method references use the CpCache).
>
> 1. `rawIndexToConstantPoolIndex()` is used only for the `invokedynamic` bytecode. It should be renamed to `indyIndexConstantPoolIndex()`
>
> 2. `rawIndexToConstantPoolCacheIndex()` should not be called for the `invokedynamic` bytecode, which doesn't use cpCache entries after [JDK-8301995](https://bugs.openjdk.org/browse/JDK-8301995).
>
> 3. Some `cpi` parameters should be renamed to `rawIndex` or `which`
>
> 4. Added a test case for `ConstantPool.lookupAppendix()`, which was not tested in the JDK repo.
>
> I added comments about the 4 types of indices used in HotSpotConstantPool.java: `cpi`, `rawIndex`, `cpci` and `which`. The latter two types will be removed after [JDK-8301993](https://bugs.openjdk.org/browse/JDK-8301993) is complete.
>
> Note that there are still some incorrect use of `cpi` in the implementation and test cases. Those will be cleaned up in [JDK-8314172](https://bugs.openjdk.org/browse/JDK-8314172)
Marked as reviewed by dnsimon (Reviewer).
Thanks a lot for this cleanup and adding the extra tests.
src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/CompilerToVM.java line 565:
> 563: * Gets the appendix object (if any) associated with the entry identified by {@code which}.
> 564: *
> 565: * @param which if negative, is treated as an encoded indy index for INVONEDYNAMIC;
INVONEDYNAMIC -> INVOKEDYNAMIC
src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstantPool.java line 60:
> 58: * </ul>
> 59: *
> 60: * Note that {@code cpci} and {@code which} are used only in the HotSpot-specific implementation. They are not used by the public iterface in jdk.vm.ci.meta.*.
iterface -> iterface
src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ConstantPool.java line 179:
> 177: *
> 178: * @param index if {@code opcode} is -1, {@code index} is a constant pool index. Otherwise {@code opcode}
> 179: * must be ${code Bytecodes.INVOKEDYNAMIC}, and {@code index} must be the operand of that
`${code Bytecodes.INVOKEDYNAMIC}` -> `{@code INVOKEDYNAMIC}` (in numerous places)
-------------
PR Review: https://git.openjdk.org/jdk/pull/15297#pullrequestreview-1579923317
PR Comment: https://git.openjdk.org/jdk/pull/15297#issuecomment-1680085580
PR Review Comment: https://git.openjdk.org/jdk/pull/15297#discussion_r1295459900
PR Review Comment: https://git.openjdk.org/jdk/pull/15297#discussion_r1295461310
PR Review Comment: https://git.openjdk.org/jdk/pull/15297#discussion_r1295466901
More information about the graal-dev
mailing list