Commit 5efe4bd8 authored by Skylot's avatar Skylot

fix: add labels from NOP instructions in fallback mode (#666)

parent 75a67140
...@@ -241,10 +241,11 @@ public class MethodGen { ...@@ -241,10 +241,11 @@ public class MethodGen {
} }
public static void addFallbackInsns(CodeWriter code, MethodNode mth, InsnNode[] insnArr, boolean addLabels) { public static void addFallbackInsns(CodeWriter code, MethodNode mth, InsnNode[] insnArr, boolean addLabels) {
code.incIndent();
InsnGen insnGen = new InsnGen(getFallbackMethodGen(mth), true); InsnGen insnGen = new InsnGen(getFallbackMethodGen(mth), true);
InsnNode prevInsn = null; InsnNode prevInsn = null;
for (InsnNode insn : insnArr) { for (InsnNode insn : insnArr) {
if (insn == null || insn.getType() == InsnType.NOP) { if (insn == null) {
continue; continue;
} }
if (addLabels && needLabel(insn, prevInsn)) { if (addLabels && needLabel(insn, prevInsn)) {
...@@ -252,6 +253,9 @@ public class MethodGen { ...@@ -252,6 +253,9 @@ public class MethodGen {
code.startLine(getLabelName(insn.getOffset()) + ':'); code.startLine(getLabelName(insn.getOffset()) + ':');
code.incIndent(); code.incIndent();
} }
if (insn.getType() == InsnType.NOP) {
continue;
}
try { try {
code.startLine(); code.startLine();
RegisterArg resArg = insn.getResult(); RegisterArg resArg = insn.getResult();
...@@ -272,6 +276,7 @@ public class MethodGen { ...@@ -272,6 +276,7 @@ public class MethodGen {
} }
prevInsn = insn; prevInsn = insn;
} }
code.decIndent();
} }
private static boolean needLabel(InsnNode insn, InsnNode prevInsn) { private static boolean needLabel(InsnNode insn, InsnNode prevInsn) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment