Skip to content

Commit

Permalink
InvokerHelperVisitor visit the frame (#225)
Browse files Browse the repository at this point in the history
* fix frame visit

* force build

* make static
  • Loading branch information
Ecdcaeb authored Aug 20, 2024
1 parent 1c859cd commit 2cd1799
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,28 @@ public void visitMethodInsn(int opcode, String owner, String name, String desc,
}
super.visitMethodInsn(opcode, owner, name, desc, itf);
}

@Override
public void visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack) {
super.visitFrame(type, nLocal, remapEntries(nLocal, local), nStack, remapEntries(nStack, stack));
}

private static Object[] remapEntries(int n, Object[] entries) {
for (int i = 0; i < n; i++) {
if (entries[i] instanceof String) {
Object[] newEntries = new Object[n];
if (i > 0) {
System.arraycopy(entries, 0, newEntries, 0, i);
}
do {
Object t = entries[i];
if (LINKED_HASH_MAP_TYPE.equals(t)) t = FAST_UTIL_MAP_TYPE;
newEntries[i++] = t;
} while (i < n);
return newEntries;
}
}
return entries;
}
}
}

0 comments on commit 2cd1799

Please sign in to comment.