■ ■ ■ ■ ■ ■
jadx-core/src/main/java/jadx/core/utils/InstructionRemover.java
| skipped 2 lines |
3 | 3 | | import jadx.core.Consts; |
4 | 4 | | import jadx.core.dex.attributes.AFlag; |
5 | 5 | | import jadx.core.dex.instructions.args.InsnArg; |
| 6 | + | import jadx.core.dex.instructions.args.InsnWrapArg; |
6 | 7 | | import jadx.core.dex.instructions.args.RegisterArg; |
7 | 8 | | import jadx.core.dex.instructions.args.SSAVar; |
8 | 9 | | import jadx.core.dex.nodes.BlockNode; |
| skipped 56 lines |
65 | 66 | | mth.removeSVar(r.getSVar()); |
66 | 67 | | } |
67 | 68 | | for (InsnArg arg : insn.getArguments()) { |
68 | | - | if (arg instanceof RegisterArg) { |
69 | | - | RegisterArg reg = (RegisterArg) arg; |
70 | | - | SSAVar sVar = reg.getSVar(); |
71 | | - | if (sVar != null) { |
72 | | - | sVar.removeUse(reg); |
73 | | - | } |
| 69 | + | unbindArgUsage(mth, arg); |
| 70 | + | } |
| 71 | + | insn.add(AFlag.INCONSISTENT_CODE); |
| 72 | + | } |
| 73 | + | |
| 74 | + | public static void unbindArgUsage(MethodNode mth, InsnArg arg) { |
| 75 | + | if (arg instanceof RegisterArg) { |
| 76 | + | RegisterArg reg = (RegisterArg) arg; |
| 77 | + | SSAVar sVar = reg.getSVar(); |
| 78 | + | if (sVar != null) { |
| 79 | + | sVar.removeUse(reg); |
74 | 80 | | } |
| 81 | + | } else if (arg instanceof InsnWrapArg) { |
| 82 | + | InsnWrapArg wrap = (InsnWrapArg) arg; |
| 83 | + | unbindInsn(mth, wrap.getWrapInsn()); |
75 | 84 | | } |
76 | | - | insn.add(AFlag.INCONSISTENT_CODE); |
77 | 85 | | } |
78 | 86 | | |
79 | 87 | | // Don't use 'insns.removeAll(toRemove)' because it will remove instructions by content |
| skipped 42 lines |