JDK-8314078 : HotSpotConstantPool.lookupField() asserts due to field changes in ConstantPool.cpp
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 22
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2023-08-10
  • Updated: 2024-01-22
  • Resolved: 2023-08-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 22
22 b11Fixed
Related Reports
Relates :  
Relates :  
Description
After JDK-8301996, the encoding of getfield/putfield/getstatic/putstatic has been changed in constantPool.cpp. However, jdk/vm/ci/hotspot/HotSpotConstantPool.java has not been updated accordingly:

#  assert(i >= 0 && i< _length) failed: oob: 0 <= 65536 < 13
V  [libjvm.so+0xa530c4]  ConstantPool::to_cp_index(int, Bytecodes::Code)+0x134  (array.hpp:128)
V  [libjvm.so+0xa532d2]  ConstantPool::name_and_type_ref_index_at(int, Bytecodes::Code)+0x12  (constantPool.cpp:926)
V  [libjvm.so+0x10744f8]  c2v_lookupNameAndTypeRefIndexInPool(JNIEnv_*, _jobject*, _jobject*, long, int, int)+0x148  (jvmciCompilerToVM.cpp:828)
j  jdk.vm.ci.hotspot.CompilerToVM.lookupNameAndTypeRefIndexInPool(Ljdk/vm/ci/hotspot/HotSpotConstantPool;JII)I+0 jdk.internal.vm.ci@22-internal
j  jdk.vm.ci.hotspot.CompilerToVM.lookupNameAndTypeRefIndexInPool(Ljdk/vm/ci/hotspot/HotSpotConstantPool;II)I+8 jdk.internal.vm.ci@22-internal
j  jdk.vm.ci.hotspot.HotSpotConstantPool.getNameAndTypeRefIndexAt(II)I+6 jdk.internal.vm.ci@22-internal
j  jdk.vm.ci.hotspot.HotSpotConstantPool.lookupField(ILjdk/vm/ci/meta/ResolvedJavaMethod;I)Ljdk/vm/ci/meta/JavaField;+11 jdk.internal.vm.ci@22-internal
j  org.graalvm.compiler.java.BytecodeParser.lookupField(II)Ljdk/vm/ci/meta/JavaField;+16 jdk.internal.vm.compiler@21-internal
Comments
Changeset: 911d1dbb Author: Ioi Lam <iklam@openjdk.org> Date: 2023-08-14 15:37:44 +0000 URL: https://git.openjdk.org/jdk/commit/911d1dbbf7362693c736b905b42e5150fc4f8a96
14-08-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/15237 Date: 2023-08-11 01:15:01 +0000
11-08-2023

Sounds good, thanks!
10-08-2023

[~thartmann] I looked under test/hotspot/jtreg/compiler/jvmci but could not find any test that call jdk.vm.ci.hotspot.HotSpotConstantPool.lookupField (or jdk.vm.ci.meta.ConstantPool.lookupField). I'll try to add a test case as part of the fix.
10-08-2023

Why did our testing not catch this? ILW = Assert due to unexpected encoding in field lookup (regression), with JVMCI but no tests caught this, no workaround = HLH = P2
10-08-2023