Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/hotspot/share/jvmci/jvmciCompilerToVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1587,16 +1587,16 @@ C2V_VMENTRY_NULL(jobject, iterateFrames, (JNIEnv* env, jobject compilerToVM, job
return nullptr;
C2V_END

C2V_VMENTRY_0(int, invokeDynamicOperandToCPIndex, (JNIEnv* env, jobject, ARGUMENT_PAIR(cp), jint operand, jboolean resolve))
if (!ConstantPool::is_invokedynamic_index(operand)) {
JVMCI_THROW_MSG_0(IllegalStateException, err_msg("not an invokedynamic index %d", operand));
C2V_VMENTRY_0(int, decodeIndyIndexToCPIndex, (JNIEnv* env, jobject, ARGUMENT_PAIR(cp), jint encoded_indy_index, jboolean resolve))
if (!ConstantPool::is_invokedynamic_index(encoded_indy_index)) {
JVMCI_THROW_MSG_0(IllegalStateException, err_msg("not an encoded indy index %d", encoded_indy_index));
}

constantPoolHandle cp(THREAD, UNPACK_PAIR(ConstantPool, cp));
CallInfo callInfo;
int indy_index = cp->decode_invokedynamic_index(operand);
int indy_index = cp->decode_invokedynamic_index(encoded_indy_index);
if (resolve) {
LinkResolver::resolve_invoke(callInfo, Handle(), cp, operand, Bytecodes::_invokedynamic, CHECK_0);
LinkResolver::resolve_invoke(callInfo, Handle(), cp, encoded_indy_index, Bytecodes::_invokedynamic, CHECK_0);
cp->cache()->set_dynamic_call(callInfo, indy_index);
}
return cp->resolved_indy_entry_at(indy_index)->constant_pool_index();
Expand Down Expand Up @@ -3125,7 +3125,7 @@ JNINativeMethod CompilerToVM::methods[] = {
{CC "getUncachedStringInPool", CC "(" HS_CONSTANT_POOL2 "I)" JAVACONSTANT, FN_PTR(getUncachedStringInPool)},
{CC "resolveTypeInPool", CC "(" HS_CONSTANT_POOL2 "I)" HS_KLASS, FN_PTR(resolveTypeInPool)},
{CC "resolveFieldInPool", CC "(" HS_CONSTANT_POOL2 "I" HS_METHOD2 "B[I)" HS_KLASS, FN_PTR(resolveFieldInPool)},
{CC "invokeDynamicOperandToCPIndex", CC "(" HS_CONSTANT_POOL2 "IZ)I", FN_PTR(invokeDynamicOperandToCPIndex)},
{CC "decodeIndyIndexToCPIndex", CC "(" HS_CONSTANT_POOL2 "IZ)I", FN_PTR(decodeIndyIndexToCPIndex)},
{CC "resolveInvokeHandleInPool", CC "(" HS_CONSTANT_POOL2 "I)V", FN_PTR(resolveInvokeHandleInPool)},
{CC "isResolvedInvokeHandleInPool", CC "(" HS_CONSTANT_POOL2 "I)I", FN_PTR(isResolvedInvokeHandleInPool)},
{CC "resolveMethod", CC "(" HS_KLASS2 HS_METHOD2 HS_KLASS2 ")" HS_METHOD, FN_PTR(resolveMethod)},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,16 @@ JavaConstant getUncachedStringInPool(HotSpotConstantPool constantPool, int cpi)
private native JavaConstant getUncachedStringInPool(HotSpotConstantPool constantPool, long constantPoolPointer, int cpi);

/**
* Resolves the entry at index {@code cpi} in {@code constantPool} to an object, looking in the
* Gets the entry at index {@code cpi} in {@code constantPool}, looking in the
* constant pool cache first.
*
* The behavior of this method is undefined if {@code cpi} does not denote one of the following
* entry types: {@code JVM_CONSTANT_Dynamic}, {@code JVM_CONSTANT_String},
* {@code JVM_CONSTANT_MethodHandle}, {@code JVM_CONSTANT_MethodHandleInError},
* {@code JVM_CONSTANT_MethodType} and {@code JVM_CONSTANT_MethodTypeInError}.
*
* @param resolve specifies if a resolved entry is expected. If {@code false},
* {@code null} is returned for an unresolved entry.
*/
JavaConstant lookupConstantInPool(HotSpotConstantPool constantPool, int cpi, boolean resolve) {
return lookupConstantInPool(constantPool, constantPool.getConstantPoolPointer(), cpi, resolve);
Expand Down Expand Up @@ -387,18 +390,18 @@ private native HotSpotResolvedJavaMethodImpl lookupMethodInPool(HotSpotConstantP
long callerMethodPointer);

/**
* Converts the operand of an invokedynamic instruction in {@code operand}
* Converts the encoded indy index operand of an invokedynamic instruction
* to an index directly into {@code constantPool}.
*
* @param resolve if {@true}, then resolve the entry (which may call the bootstrap method)
* @throws IllegalArgumentException if {@code operand} is not a valid invokedynamic operand
* @param resolve if {@true}, then resolve the entry (which may call a bootstrap method)
* @throws IllegalArgumentException if {@code encoded_indy_index} is not an encoded indy index
* @return {@code JVM_CONSTANT_InvokeDynamic} constant pool entry index for the invokedynamic
*/
int invokeDynamicOperandToCPIndex(HotSpotConstantPool constantPool, int operand, boolean resolve) {
return invokeDynamicOperandToCPIndex(constantPool, constantPool.getConstantPoolPointer(), operand, resolve);
int decodeIndyIndexToCPIndex(HotSpotConstantPool constantPool, int encoded_indy_index, boolean resolve) {
return decodeIndyIndexToCPIndex(constantPool, constantPool.getConstantPoolPointer(), encoded_indy_index, resolve);
}

private native int invokeDynamicOperandToCPIndex(HotSpotConstantPool constantPool, long constantPoolPointer, int operand, boolean resolve);
private native int decodeIndyIndexToCPIndex(HotSpotConstantPool constantPool, long constantPoolPointer, int encoded_indy_index, boolean resolve);

/**
* Resolves the details for invoking the bootstrap method associated with the
Expand Down Expand Up @@ -441,7 +444,7 @@ void resolveInvokeHandleInPool(HotSpotConstantPool constantPool, int cpi) {

/**
* If {@code cpi} denotes an entry representing a resolved dynamic adapter (see
* {@link #invokeDynamicOperandToCPIndex} and {@link #resolveInvokeHandleInPool}), return the
* {@link #decodeIndyIndexToCPIndex} and {@link #resolveInvokeHandleInPool}), return the
* opcode of the instruction for which the resolution was performed ({@code invokedynamic} or
* {@code invokevirtual}), or {@code -1} otherwise.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ public int rawIndexToConstantPoolIndex(int rawIndex, int opcode) {
if (opcode != Bytecodes.INVOKEDYNAMIC) {
throw new IllegalArgumentException("expected INVOKEDYNAMIC at " + rawIndex + ", got " + opcode);
}
return compilerToVM().invokeDynamicOperandToCPIndex(this, rawIndex, false);
return compilerToVM().decodeIndyIndexToCPIndex(this, rawIndex, false);
}
if (opcode == Bytecodes.INVOKEDYNAMIC) {
throw new IllegalArgumentException("unexpected INVOKEDYNAMIC at " + rawIndex);
Expand Down Expand Up @@ -862,7 +862,7 @@ public void loadReferencedType(int cpi, int opcode, boolean initialize) {
if (!isInvokedynamicIndex(cpi)) {
throw new IllegalArgumentException("must use invokedynamic index but got " + cpi);
}
index = compilerToVM().invokeDynamicOperandToCPIndex(this, cpi, true);
index = compilerToVM().decodeIndyIndexToCPIndex(this, cpi, true);
break;
}
case Bytecodes.GETSTATIC:
Expand Down