Skip to content

Commit b3ef337

Browse files
author
Doug Simon
committed
8296960: [JVMCI] list HotSpotConstantPool.loadReferencedType to ConstantPool
Reviewed-by: never
1 parent f0474b8 commit b3ef337

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
@@ -836,6 +836,7 @@ public void loadReferencedType(int cpi, int opcode) {
836836
loadReferencedType(cpi, opcode, true /* initialize */);
837837
}
838838

839+
@Override
839840
@SuppressWarnings("fallthrough")
840841
public void loadReferencedType(int cpi, int opcode, boolean initialize) {
841842
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
@@ -49,6 +49,24 @@ public interface ConstantPool {
4949
*/
5050
void loadReferencedType(int cpi, int opcode);
5151

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

0 commit comments

Comments
 (0)