Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ public boolean appendExpression(StringBuilder b) {
}

StringBuilder bld = new StringBuilder();
boolean isVirtualCall = false;
if(origOpcode == Opcodes.INVOKEINTERFACE || origOpcode == Opcodes.INVOKEVIRTUAL) {
b.append(" ");

Expand All @@ -179,6 +180,7 @@ public boolean appendExpression(StringBuilder b) {
}
if (isVirtual) {
bld.append("virtual_");
isVirtualCall = true;
}
} else {
b.append(" ");
Expand Down Expand Up @@ -207,6 +209,9 @@ public boolean appendExpression(StringBuilder b) {
bld.append("__");
ArrayList<String> args = new ArrayList<String>();
String returnVal = BytecodeMethod.appendMethodSignatureSuffixFromDesc(desc, bld, args);
if (isVirtualCall) {
BytecodeMethod.addVirtualMethodsInvoked(bld.substring("virtual_".length()));
}
int numLiteralArgs = this.getNumLiteralArgs();
if (numLiteralArgs > 0) {
b.append("/* CustomInvoke */");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,10 @@ public void appendInstruction(StringBuilder b) {
}

StringBuilder bld = new StringBuilder();
boolean isVirtualCall = false;
if(opcode == Opcodes.INVOKEINTERFACE || opcode == Opcodes.INVOKEVIRTUAL) {
b.append(" ");

// Well, it is actually legal to call private methods with invoke virtual, and kotlin
// generates such calls. But ParparVM strips out these virtual method definitions
// so we need to check if the method is private, and remove the virtual invocation
Expand All @@ -162,6 +163,7 @@ public void appendInstruction(StringBuilder b) {
}
if (isVirtual) {
bld.append("virtual_");
isVirtualCall = true;
}
} else {
b.append(" ");
Expand Down Expand Up @@ -195,6 +197,9 @@ public void appendInstruction(StringBuilder b) {
bld.append("__");
ArrayList<String> args = new ArrayList<String>();
String returnVal = BytecodeMethod.appendMethodSignatureSuffixFromDesc(desc, bld, args);
if (isVirtualCall) {
BytecodeMethod.addVirtualMethodsInvoked(bld.substring("virtual_".length()));
}
boolean noPop = false;
if(returnVal == null) {
b.append(bld);
Expand Down
Loading