Skip to content

Commit

Permalink
Box the result of a nested constant dynamic if the expected type is n…
Browse files Browse the repository at this point in the history
…ot a primitive
  • Loading branch information
Zeavee committed May 27, 2024
1 parent 86fa5f6 commit 0464752
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,12 @@ protected Object resolveLinkedObject(int bci, int cpi, int opcode, BootstrapMeth
int argCpi = primitiveConstant.asInt();
Object argConstant = loadConstantDynamic(argCpi, opcode == Opcodes.INVOKEDYNAMIC ? Opcodes.LDC : opcode);
if (argConstant instanceof ValueNode valueNode) {
currentNode = valueNode;
ResolvedJavaMethod.Parameter[] parameters = bootstrapMethod.getParameters();
if (valueNode.getStackKind().isPrimitive() && i + 3 <= parameters.length && !parameters[i + 3].getKind().isPrimitive()) {
currentNode = append(BoxNode.create(valueNode, getMetaAccess().lookupJavaType(valueNode.getStackKind().toBoxedJavaClass()), valueNode.getStackKind()));
} else {
currentNode = valueNode;
}
} else if (argConstant instanceof Throwable || argConstant instanceof UnresolvedJavaType) {
/* A nested constant dynamic threw. */
return argConstant;
Expand Down

0 comments on commit 0464752

Please sign in to comment.