RFR: 8314249: Refactor handling of invokedynamic in JVMCI ConstantPool

Ioi Lam iklam at openjdk.org
Tue Aug 15 22:24:29 UTC 2023


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)

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

Commit messages:
 - fixed whitespace
 - fixed test
 - added test case for ConstantPool.lookupAppendix; other code touch by this PR already have test cases
 - fixed comments
 - Added docs about the names we use for indices: cpi, rawIndex, cpci and which
 - 8314249: Refactor handling of invokedynamic in JVMCI ConstantPool

Changes: https://git.openjdk.org/jdk/pull/15297/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15297&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8314249
  Stats: 188 lines in 6 files changed: 120 ins; 23 del; 45 mod
  Patch: https://git.openjdk.org/jdk/pull/15297.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15297/head:pull/15297

PR: https://git.openjdk.org/jdk/pull/15297


More information about the hotspot-compiler-dev mailing list