Skip to content

Commit aec0884

Browse files
committed
8296960: [JVMCI] list HotSpotConstantPool.loadReferencedType to ConstantPool
Backport-of: b3ef337566c2cf78de1f636e039c799a1bfcb17e
1 parent 20f2218 commit aec0884

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java

+1
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,7 @@ public void loadReferencedType(int cpi, int opcode) {
716716
loadReferencedType(cpi, opcode, true /* initialize */);
717717
}
718718

719+
@Override
719720
@SuppressWarnings("fallthrough")
720721
public void loadReferencedType(int cpi, int opcode, boolean initialize) {
721722
int index;

src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ConstantPool.java

+18
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,24 @@ public interface ConstantPool {
4646
*/
4747
void loadReferencedType(int cpi, int opcode);
4848

49+
/**
50+
* Ensures that the type referenced by the specified constant pool entry is loaded. This can be
51+
* used to compile time resolve a type. It works for field, method, or type constant pool
52+
* entries.
53+
*
54+
* @param cpi the index of the constant pool entry that references the type
55+
* @param opcode the opcode of the instruction that references the type
56+
* @param initialize if {@code true}, the referenced type is either guaranteed to be initialized
57+
* upon return or an initialization exception is thrown
58+
*/
59+
default void loadReferencedType(int cpi, int opcode, boolean initialize) {
60+
if (initialize) {
61+
loadReferencedType(cpi, opcode);
62+
} else {
63+
throw new UnsupportedOperationException();
64+
}
65+
}
66+
4967
/**
5068
* Looks up the type referenced by the constant pool entry at {@code cpi} as referenced by the
5169
* {@code opcode} bytecode instruction.

0 commit comments

Comments
 (0)