Skip to content

Commit

Permalink
Fix an operandstack bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Boerman committed Mar 23, 2024
1 parent 423155f commit cb62fd3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ private static <ScalaPluginClassLoader extends ClassLoader & IScalaPluginClassLo
methodVisitor.visitVarInsn(ALOAD, argumentSetIndex); operandStack.push(Type.getType(java.util.Set.class));
methodVisitor.visitLdcInsn("set"); operandStack.push(Type.getType(java.lang.String.class));
methodVisitor.visitMethodInsn(INVOKEINTERFACE, "java/util/Map", "get", "(Ljava/lang/Object;)Ljava/lang/Object;", true); operandStack.replaceTop(2, Type.getType(Object.class));
methodVisitor.visitTypeInsn(CHECKCAST, "java/util/Set");
methodVisitor.visitTypeInsn(CHECKCAST, "java/util/Set"); operandStack.push(Type.getType(java.util.Set.class));
final int serializedSetIndex = localCounter.getSlotIndex(), serializedSetFrameIndex = localCounter.getFrameIndex();
methodVisitor.visitVarInsn(ASTORE, serializedSetIndex); operandStack.pop();
Label label1 = new Label();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ private static <ScalaPluginClassLoader extends ClassLoader & IScalaPluginClassLo
}

//now invoke the constructors: new MapNAdapter(new MapN(arguments));
methodVisitor.visitMethodInsn(INVOKESPECIAL, mapNClassName, "<init>", "(" + Compat.stringRepeat("Ljava/lang/Object;Ljava/lang/Object;", N) + ")V", false); operandStack.pop(N + 1); //arguments + the type itself
methodVisitor.visitMethodInsn(INVOKESPECIAL, mapNClassName, "<init>", "(" + Compat.stringRepeat("Ljava/lang/Object;Ljava/lang/Object;", N) + ")V", false); operandStack.pop(2 * N + 1); //arguments + the type itself
methodVisitor.visitMethodInsn(INVOKESPECIAL, generatedClassName, "<init>", "(" + mapNClassDescriptor + ")V", false); operandStack.pop(2);
methodVisitor.visitInsn(ARETURN);

Expand Down

0 comments on commit cb62fd3

Please sign in to comment.