RFR: 8314078: HotSpotConstantPool.lookupField() asserts due to field changes in ConstantPool.cpp [v2]

Ioi Lam iklam at openjdk.org
Fri Aug 11 20:28:58 UTC 2023


> This PR updates Java code in JVMCI to match the C code changes in [JDK-8301996](https://bugs.openjdk.java.net/browse/JDK-8301996) that modified the constant pool layout. Essentially, the indices after a getfield/putfield/getstatic/putstatic bytecode is no longer a CpCacheIndex, but an index for `ConstantPool::resolved_field_entry_at(int field_index)`.
> 
> The assertion (and subsequent crash) happen only in debug builds. Out of pure luck, in product build JVMCI produces the correct output even after [JDK-8301996](https://bugs.openjdk.java.net/browse/JDK-8301996), although the code was doing the wrong thing.
> 
> This PR has (so far) two commits:
> 
> - 6527e67b1832087d180d2b50b65aaeca2e244c28 The actual functional change to use the `rawIndex` that follows a field bytecode.
> - c322b8e71d4d9e33bd065e64420101010f9127fc Fixed incorrectly named parameters and variables in the JVMCI code and JavaDoc. In most cases, `cpi` needs to be changed to `rawIndex` to reflect the correct type of the index.
> 
> To help reviewing, I am limiting the renaming to just those affected by the field changes (without the renames, it's hard to validate that I am actually doing the right thing).
> 
> There are still some cases of `cpi` that need to be changed to `rawIndex`. I will fix those in a separate RFE. E.g. in ConstantPool.java:
> 
> 
> default JavaMethod lookupMethod(int cpi, int opcode) {
>     return lookupMethod(cpi, opcode, null);
> }

Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:

  @dougxc review: Added comments about rawIndex vs cpi

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/15237/files
  - new: https://git.openjdk.org/jdk/pull/15237/files/c322b8e7..21976c06

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=15237&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15237&range=00-01

  Stats: 11 lines in 1 file changed: 8 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/15237.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15237/head:pull/15237

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


More information about the hotspot-compiler-dev mailing list