Remove exception from method body with ASM

Introduction:

I have a (obfuscation) METHOD that I printed using ASM, and the output was as follows:

METHOD: m(ZB)Lcc; -------------------------------------- L0: { ALOAD_0 GETFIELD d/x I LDC 2036719157 IMUL ISTORE GOTO L1 } L2: { ALOAD_6 ICONST_0 LDC -373364649 ALOAD_0 GETFIELD d/at I IMUL ICONST_0 INVOKEVIRTUAL cc/y(III)V GOTO L3 } L4: { ACONST_NULL ARETURN } L5: { ILOAD_1 IFEQ L6 LDC -723220973 ALOAD_0 GETFIELD d/an I IMUL ISTORE LDC 1671960653 ALOAD_0 GETFIELD d/ad I IMUL ISTORE GOTO L7 } L8: { LDC 1955946639 ALOAD_0 GETFIELD d/au I IMUL IFEQ L9 ILOAD_2 ICONST_1 IF_ICMPEQ L10 NEW DUP INVOKESPECIAL java/lang/IllegalStateException/<init>()V ATHROW } L11: { IINC GOTO L12 } L7: { LDC 894092883 ALOAD_0 GETFIELD d/ac I IMUL ISTORE GOTO L6 } L13: { GETSTATIC d/b Lem; ILOAD_3 ICONST_0 INVOKESTATIC cc/l(Lem;II)Lcc; ASTORE ILOAD_4 ICONST_M1 IF_ICMPEQ L14 GETSTATIC d/b Lem; ILOAD_4 ICONST_0 INVOKESTATIC cc/l(Lem;II)Lcc; ASTORE GOTO L15 } L16: { ICONST_2 ANEWARRAY DUP ICONST_0 ALOAD_6 AASTORE DUP ICONST_1 ALOAD_7 AASTORE ASTORE GOTO L17 } L18: { GETSTATIC d/b Lem; ILOAD_5 ICONST_0 INVOKESTATIC cc/l(Lem;II)Lcc; ASTORE ICONST_3 ANEWARRAY DUP ICONST_0 ALOAD_6 AASTORE DUP ICONST_1 ALOAD_7 AASTORE DUP ICONST_2 ALOAD_8 AASTORE ASTORE NEW DUP ALOAD_9 ICONST_3 INVOKESPECIAL cc/<init>([Lcc;I)V ASTORE GOTO L14 } L19: { ALOAD_6 ARETURN } L17: { NEW DUP ALOAD_8 ICONST_2 INVOKESPECIAL cc/<init>([Lcc;I)V ASTORE } L14: { ILOAD_1 IFNE L9 ILOAD_2 ICONST_1 IF_ICMPEQ L8 NEW DUP INVOKESPECIAL java/lang/IllegalStateException/<init>()V ATHROW } L15: { ILOAD_5 ICONST_M1 IF_ICMPEQ L16 ILOAD_2 ICONST_1 IF_ICMPEQ L18 NEW DUP INVOKESPECIAL java/lang/IllegalStateException/<init>()V ATHROW } L20: { LDC 1642271889 ALOAD_0 GETFIELD d/ay I IMUL ISTORE GOTO L5 } L9: { ILOAD_1 IFEQ L3 ILOAD_2 ICONST_1 IF_ICMPEQ L21 NEW DUP INVOKESPECIAL java/lang/IllegalStateException/<init>()V ATHROW } L21: { ICONST_0 LDC -373364649 ALOAD_0 GETFIELD d/at I IMUL IF_ICMPEQ L3 ILOAD_2 ICONST_1 IF_ICMPEQ L2 NEW DUP INVOKESPECIAL java/lang/IllegalStateException/<init>()V ATHROW } L22: { ICONST_0 ISTORE GOTO L23 } L3: { ALOAD_0 GETFIELD d/c [S IFNULL L24 ILOAD_2 ICONST_1 IF_ICMPEQ L25 NEW DUP INVOKESPECIAL java/lang/IllegalStateException/<init>()V ATHROW } L25: { ICONST_0 ISTORE GOTO L12 } L24: { ALOAD_0 GETFIELD d/a [S IFNULL L19 ILOAD_2 ICONST_1 IF_ICMPEQ L22 NEW DUP INVOKESPECIAL java/lang/IllegalStateException/<init>()V ATHROW } L26: { ALOAD_6 ALOAD_0 GETFIELD d/c [S ILOAD_7 SALOAD ALOAD_0 GETFIELD d/m [S ILOAD_7 SALOAD INVOKEVIRTUAL cc/v(SS)V GOTO L11 } L12: { ILOAD_7 ALOAD_0 GETFIELD d/c [S ARRAYLENGTH IF_ICMPGE L24 GOTO L26 } L1: { ALOAD_0 GETFIELD d/ar I LDC 608958183 IMUL ISTORE GOTO L20 } L10: { ALOAD_6 ICONST_0 LDC 1955946639 ALOAD_0 GETFIELD d/au I IMUL ICONST_0 INVOKEVIRTUAL cc/y(III)V GOTO L9 } L23: { ILOAD_7 ALOAD_0 GETFIELD d/a [S ARRAYLENGTH IF_ICMPGE L19 ILOAD_2 ICONST_1 IF_ICMPEQ L27 NEW DUP INVOKESPECIAL java/lang/IllegalStateException/<init>()V ATHROW } L27: { ALOAD_6 ALOAD_0 GETFIELD d/a [S ILOAD_7 SALOAD ALOAD_0 GETFIELD d/e [S ILOAD_7 SALOAD INVOKEVIRTUAL cc/s(SS)V IINC GOTO L23 } L6: { ILOAD_3 ICONST_M1 IF_ICMPNE L13 GOTO L4 } L28: { NEW DUP INVOKESPECIAL java/lang/StringBuilder/<init>()V LDC "af.m(" INVOKEVIRTUAL java/lang/StringBuilder/append(Ljava/lang/String;)Ljava/lang/StringBuilder; LDC 41 INVOKEVIRTUAL java/lang/StringBuilder/append(C)Ljava/lang/StringBuilder; INVOKEVIRTUAL java/lang/StringBuilder/toString()Ljava/lang/String; INVOKESTATIC b/b(Ljava/lang/Throwable;Ljava/lang/String;)Lcd; ATHROW } 

What I want:

I want to DELETE all exceptions. For example (I want to delete):

 ILOAD_2 ICONST_1 IF_ICMPEQ L27 NEW DUP INVOKESPECIAL java/lang/IllegalStateException/<init>()V ATHROW 

which translates as: if (var2 != 1) {throw new IllegalStateException();}

I do not plan to run the class, but I plan to build it correctly. This means that if I remove the exception, there will be no bytecode errors when using the CheckClassAdapter . I do not need code to work.

What I tried:

I tried the following, which I used to remove exceptions:

 private void findException(MethodNode method) { int i = findExceptionIndex(method); //returns the first occurrence of the above pattern. while (i != -1) { for (int j = i; j < i + 7; ++j) { //length of if statement + exception instructions. if (method.instructions.get(j) instanceof MethodInsnNode) { //if it really is an exception if (((MethodInsnNode) method.instructions.get(j)).owner.contains("Exception")) { for (int k = i + 6; k != i - 1; --k) { System.out.println("Removing: " + Printer.OPCODES[method.instructions.get(k).getOpcode()]); method.instructions.remove(method.instructions.get(k)); } return; //I only want to try to remove one first (before trying to remove all) } } } i = findNextExceptionIndex(method, i); } } 

and it prints (successfully removed the first exception having the following codes):

 Removing: ATHROW Removing: INVOKESPECIAL Removing: DUP Removing: NEW Removing: IF_ICMPEQ Removing: ICONST_1 Removing: ILOAD 

ERRORS:

However, I get a HUGE exception when I try to save the class:

 jdk.internal.org.objectweb.asm.tree.analysis.AnalyzerException: Error at instruction 41: Expected I, but found . at jdk.internal.org.objectweb.asm.tree.analysis.Analyzer.analyze(Analyzer.java:323) at jdk.internal.org.objectweb.asm.util.CheckMethodAdapter$1.visitEnd(CheckMethodAdapter.java:479) at jdk.internal.org.objectweb.asm.MethodVisitor.visitEnd(MethodVisitor.java:906) at jdk.internal.org.objectweb.asm.util.CheckMethodAdapter.visitEnd(CheckMethodAdapter.java:1057) at jdk.internal.org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:866) at jdk.internal.org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:755) at jdk.internal.org.objectweb.asm.tree.ClassNode.accept(ClassNode.java:441) at com.other.JarParser.saveClass(JarParser.java:81) Caused by: jdk.internal.org.objectweb.asm.tree.analysis.AnalyzerException: Expected I, but found . at jdk.internal.org.objectweb.asm.tree.analysis.BasicVerifier.unaryOperation(BasicVerifier.java:211) at jdk.internal.org.objectweb.asm.tree.analysis.BasicVerifier.unaryOperation(BasicVerifier.java:76) at jdk.internal.org.objectweb.asm.tree.analysis.Frame.execute(Frame.java:546) at jdk.internal.org.objectweb.asm.tree.analysis.Analyzer.analyze(Analyzer.java:228) ... 14 more Exception in thread "main" java.lang.RuntimeException: Error at instruction 41: Expected I, but found . m(ZB)Lcc; 00000 RII . . . . . . . : : L0 00001 RII . . . . . . . : : ALOAD 0 00002 RII . . . . . . . : R : GETFIELD dx : I 00003 RII . . . . . . . : I : LDC 2036719157 00004 RII . . . . . . . : II : IMUL 00005 RII . . . . . . . : I : ISTORE 3 00006 RIII . . . . . . : : GOTO L1 00007 RIIIIIR . . . : : L2 00008 RIIIIIR . . . : : ALOAD 6 00009 RIIIIIR . . . : R : ICONST_0 00010 RIIIIIR . . . : RI : LDC -373364649 00011 RIIIIIR . . . : RII : ALOAD 0 00012 RIIIIIR . . . : RIIR : GETFIELD d.at : I 00013 RIIIIIR . . . : RIII : IMUL 00014 RIIIIIR . . . : RII : ICONST_0 00015 RIIIIIR . . . : RIII : INVOKEVIRTUAL cc.y (III)V 00016 RIIIIIR . . . : : GOTO L3 00017 ? : L4 00018 ? : ACONST_NULL 00019 ? : ARETURN 00020 RIIIII . . . . : : L5 00021 RIIIII . . . . : : ILOAD 1 00022 RIIIII . . . . : I : IFEQ L6 00023 RIIIII . . . . : : LDC -723220973 00024 ? : ALOAD 0 00025 ? : GETFIELD d.an : I 00026 ? : IMUL 00027 ? : ISTORE 3 00028 ? : LDC 1671960653 00029 ? : ALOAD 0 00030 ? : GETFIELD d.ad : I 00031 ? : IMUL 00032 ? : ISTORE 4 00033 ? : GOTO L7 00034 RIIIIIR . . . : : L8 00035 RIIIIIR . . . : : LDC 1955946639 00036 RIIIIIR . . . : I : ALOAD 0 00037 RIIIIIR . . . : IR : GETFIELD d.au : I 00038 RIIIIIR . . . : II : IMUL 00039 RIIIIIR . . . : I : IFEQ L9 00040 RIIIIIR . . . : : L10 00041 RIIIIIR . . . : : IINC 7 1 00042 RIIIIIRI . . : : GOTO L11 00043 ? : L7 00044 ? : LDC 894092883 00045 ? : ALOAD 0 00046 ? : GETFIELD d.ac : I 00047 ? : IMUL 00048 ? : ISTORE 5 00049 ? : GOTO L6 00050 RIIIII . . . . : : L12 00051 RIIIII . . . . : : GETSTATIC db : Lem; 00052 RIIIII . . . . : R : ILOAD 3 00053 RIIIII . . . . : RI : ICONST_0 00054 RIIIII . . . . : RII : INVOKESTATIC cc.l (Lem;II)Lcc; 00055 RIIIII . . . . : R : ASTORE 6 00056 RIIIIIR . . . : : ILOAD 4 00057 RIIIIIR . . . : I : ICONST_M1 00058 RIIIIIR . . . : II : IF_ICMPEQ L13 00059 RIIIIIR . . . : : GETSTATIC db : Lem; 00060 ? : ILOAD 4 00061 ? : ICONST_0 00062 ? : INVOKESTATIC cc.l (Lem;II)Lcc; 00063 ? : ASTORE 7 00064 ? : GOTO L14 00065 ? : L15 00066 ? : ICONST_2 00067 ? : ANEWARRAY cc 00068 ? : DUP 00069 ? : ICONST_0 00070 ? : ALOAD 6 00071 ? : AASTORE 00072 ? : DUP 00073 ? : ICONST_1 00074 ? : ALOAD 7 00075 ? : AASTORE 00076 ? : ASTORE 8 00077 ? : GOTO L16 00078 ? : L17 00079 ? : GETSTATIC db : Lem; 00080 ? : ILOAD 5 00081 ? : ICONST_0 00082 ? : INVOKESTATIC cc.l (Lem;II)Lcc; 00083 ? : ASTORE 8 00084 ? : ICONST_3 00085 ? : ANEWARRAY cc 00086 ? : DUP 00087 ? : ICONST_0 00088 ? : ALOAD 6 00089 ? : AASTORE 00090 ? : DUP 00091 ? : ICONST_1 00092 ? : ALOAD 7 00093 ? : AASTORE 00094 ? : DUP 00095 ? : ICONST_2 00096 ? : ALOAD 8 00097 ? : AASTORE 00098 ? : ASTORE 9 00099 ? : NEW cc 00100 ? : DUP 00101 ? : ALOAD 9 00102 ? : ICONST_3 00103 ? : INVOKESPECIAL cc.<init> ([Lcc;I)V 00104 ? : ASTORE 6 00105 ? : GOTO L13 00106 RIIIIIR . . . : : L18 00107 RIIIIIR . . . : : ALOAD 6 00108 RIIIIIR . . . : R : ARETURN 00109 ? : L16 00110 ? : NEW cc 00111 ? : DUP 00112 ? : ALOAD 8 00113 ? : ICONST_2 00114 ? : INVOKESPECIAL cc.<init> ([Lcc;I)V 00115 ? : ASTORE 6 00116 RIIIIIR . . . : : L13 00117 RIIIIIR . . . : : ILOAD 1 00118 RIIIIIR . . . : I : IFNE L9 00119 RIIIIIR . . . : : ILOAD 2 00120 RIIIIIR . . . : I : ICONST_1 00121 RIIIIIR . . . : II : IF_ICMPEQ L8 00122 RIIIIIR . . . : : NEW java/lang/IllegalStateException 00123 ? : DUP 00124 ? : INVOKESPECIAL java/lang/IllegalStateException.<init> ()V 00125 ? : ATHROW 00126 ? : L14 00127 ? : ILOAD 5 00128 ? : ICONST_M1 00129 ? : IF_ICMPEQ L15 00130 ? : ILOAD 2 00131 ? : ICONST_1 00132 ? : IF_ICMPEQ L17 00133 ? : NEW java/lang/IllegalStateException 00134 ? : DUP 00135 ? : INVOKESPECIAL java/lang/IllegalStateException.<init> ()V 00136 ? : ATHROW 00137 RIIII . . . . . : : L19 00138 RIIII . . . . . : : LDC 1642271889 00139 RIIII . . . . . : I : ALOAD 0 00140 RIIII . . . . . : IR : GETFIELD d.ay : I 00141 RIIII . . . . . : II : IMUL 00142 RIIII . . . . . : I : ISTORE 5 00143 RIIIII . . . . : : GOTO L5 00144 RIIIIIR . . . : : L9 00145 RIIIIIR . . . : : ILOAD 1 00146 RIIIIIR . . . : I : IFEQ L3 00147 RIIIIIR . . . : : ILOAD 2 00148 RIIIIIR . . . : I : ICONST_1 00149 RIIIIIR . . . : II : IF_ICMPEQ L20 00150 RIIIIIR . . . : : NEW java/lang/IllegalStateException 00151 RIIIIIR . . . : R : DUP 00152 RIIIIIR . . . : RR : INVOKESPECIAL java/lang/IllegalStateException.<init> ()V 00153 RIIIIIR . . . : R : ATHROW 00154 RIIIIIR . . . : : L20 00155 RIIIIIR . . . : : ICONST_0 00156 RIIIIIR . . . : I : LDC -373364649 00157 RIIIIIR . . . : II : ALOAD 0 00158 RIIIIIR . . . : IIR : GETFIELD d.at : I 00159 RIIIIIR . . . : III : IMUL 00160 RIIIIIR . . . : II : IF_ICMPEQ L3 00161 RIIIIIR . . . : : ILOAD 2 00162 RIIIIIR . . . : I : ICONST_1 00163 RIIIIIR . . . : II : IF_ICMPEQ L2 00164 RIIIIIR . . . : : NEW java/lang/IllegalStateException 00165 RIIIIIR . . . : R : DUP 00166 RIIIIIR . . . : RR : INVOKESPECIAL java/lang/IllegalStateException.<init> ()V 00167 RIIIIIR . . . : R : ATHROW 00168 RIIIIIR . . . : : L21 00169 RIIIIIR . . . : : ICONST_0 00170 RIIIIIR . . . : I : ISTORE 7 00171 RIIIIIRI . . : : GOTO L22 00172 RIIIIIR . . . : : L3 00173 RIIIIIR . . . : : ALOAD 0 00174 RIIIIIR . . . : R : GETFIELD dc : [S 00175 RIIIIIR . . . : R : IFNULL L23 00176 RIIIIIR . . . : : ILOAD 2 00177 RIIIIIR . . . : I : ICONST_1 00178 RIIIIIR . . . : II : IF_ICMPEQ L24 00179 RIIIIIR . . . : : NEW java/lang/IllegalStateException 00180 RIIIIIR . . . : R : DUP 00181 RIIIIIR . . . : RR : INVOKESPECIAL java/lang/IllegalStateException.<init> ()V 00182 RIIIIIR . . . : R : ATHROW 00183 RIIIIIR . . . : : L24 00184 RIIIIIR . . . : : ICONST_0 00185 RIIIIIR . . . : I : ISTORE 7 00186 RIIIIIRI . . : : GOTO L11 00187 RIIIIIR . . . : : L23 00188 RIIIIIR . . . : : ALOAD 0 00189 RIIIIIR . . . : R : GETFIELD da : [S 00190 RIIIIIR . . . : R : IFNULL L18 00191 RIIIIIR . . . : : ILOAD 2 00192 RIIIIIR . . . : I : ICONST_1 00193 RIIIIIR . . . : II : IF_ICMPEQ L21 00194 RIIIIIR . . . : : NEW java/lang/IllegalStateException 00195 RIIIIIR . . . : R : DUP 00196 RIIIIIR . . . : RR : INVOKESPECIAL java/lang/IllegalStateException.<init> ()V 00197 RIIIIIR . . . : R : ATHROW 00198 RIIIIIRI . . : : L25 00199 RIIIIIRI . . : : ALOAD 6 00200 RIIIIIRI . . : R : ALOAD 0 00201 RIIIIIRI . . : RR : GETFIELD dc : [S 00202 RIIIIIRI . . : RR : ILOAD 7 00203 RIIIIIRI . . : RRI : SALOAD 00204 RIIIIIRI . . : RI : ALOAD 0 00205 RIIIIIRI . . : RIR : GETFIELD dm : [S 00206 RIIIIIRI . . : RIR : ILOAD 7 00207 RIIIIIRI . . : RIRI : SALOAD 00208 RIIIIIRI . . : RII : INVOKEVIRTUAL cc.v (SS)V 00209 RIIIIIRI . . : : GOTO L10 00210 RIIIIIRI . . : : L11 00211 RIIIIIRI . . : : ILOAD 7 00212 RIIIIIRI . . : I : ALOAD 0 00213 RIIIIIRI . . : IR : GETFIELD dc : [S 00214 RIIIIIRI . . : IR : ARRAYLENGTH 00215 RIIIIIRI . . : II : IF_ICMPGE L23 00216 RIIIIIRI . . : : GOTO L25 00217 RIII . . . . . . : : L1 00218 RIII . . . . . . : : ALOAD 0 00219 RIII . . . . . . : R : GETFIELD d.ar : I 00220 RIII . . . . . . : I : LDC 608958183 00221 RIII . . . . . . : II : IMUL 00222 RIII . . . . . . : I : ISTORE 4 00223 RIIII . . . . . : : GOTO L19 00224 ? : L26 00225 ? : ALOAD 6 00226 ? : ICONST_0 00227 ? : LDC 1955946639 00228 ? : ALOAD 0 00229 ? : GETFIELD d.au : I 00230 ? : IMUL 00231 ? : ICONST_0 00232 ? : INVOKEVIRTUAL cc.y (III)V 00233 ? : GOTO L9 00234 RIIIIIRI . . : : L22 00235 RIIIIIRI . . : : ILOAD 7 00236 RIIIIIRI . . : I : ALOAD 0 00237 RIIIIIRI . . : IR : GETFIELD da : [S 00238 RIIIIIRI . . : IR : ARRAYLENGTH 00239 RIIIIIRI . . : II : IF_ICMPGE L18 00240 RIIIIIRI . . : : ILOAD 2 00241 RIIIIIRI . . : I : ICONST_1 00242 RIIIIIRI . . : II : IF_ICMPEQ L27 00243 RIIIIIRI . . : : NEW java/lang/IllegalStateException 00244 RIIIIIRI . . : R : DUP 00245 RIIIIIRI . . : RR : INVOKESPECIAL java/lang/IllegalStateException.<init> ()V 00246 RIIIIIRI . . : R : ATHROW 00247 RIIIIIRI . . : : L27 00248 RIIIIIRI . . : : ALOAD 6 00249 RIIIIIRI . . : R : ALOAD 0 00250 RIIIIIRI . . : RR : GETFIELD da : [S 00251 RIIIIIRI . . : RR : ILOAD 7 00252 RIIIIIRI . . : RRI : SALOAD 00253 RIIIIIRI . . : RI : ALOAD 0 00254 RIIIIIRI . . : RIR : GETFIELD de : [S 00255 RIIIIIRI . . : RIR : ILOAD 7 00256 RIIIIIRI . . : RIRI : SALOAD 00257 RIIIIIRI . . : RII : INVOKEVIRTUAL cc.s (SS)V 00258 RIIIIIRI . . : : IINC 7 1 00259 RIIIIIRI . . : : GOTO L22 00260 RIIIII . . . . : : L6 00261 RIIIII . . . . : : ILOAD 3 00262 RIIIII . . . . : I : ICONST_M1 00263 RIIIII . . . . : II : IF_ICMPNE L12 00264 RIIIII . . . . : : GOTO L4 00265 RII . . . . . . . : R : L28 00266 RII . . . . . . . : R : NEW java/lang/StringBuilder 00267 RII . . . . . . . : RR : DUP 00268 RII . . . . . . . : RRR : INVOKESPECIAL java/lang/StringBuilder.<init> ()V 00269 RII . . . . . . . : RR : LDC "af.m(" 00270 RII . . . . . . . : RRR : INVOKEVIRTUAL java/lang/StringBuilder.append (Ljava/lang/String;)Ljava/lang/StringBuilder; 00271 RII . . . . . . . : RR : LDC 41 00272 RII . . . . . . . : RRI : INVOKEVIRTUAL java/lang/StringBuilder.append (C)Ljava/lang/StringBuilder; 00273 RII . . . . . . . : RR : INVOKEVIRTUAL java/lang/StringBuilder.toString ()Ljava/lang/String; 00274 RII . . . . . . . : RR : INVOKESTATIC bb (Ljava/lang/Throwable;Ljava/lang/String;)Lcd; 00275 RII . . . . . . . : R : ATHROW TRYCATCHBLOCK L0 L28 L28 java/lang/RuntimeException 

Question:

How can I remove the exceptions correctly so as not to get the above errors? This seems like a "Frame" error / problem, but I'm not sure how to fix it. Any ideas?

+5
source share
1 answer

Removing the athrow removes an edge in the control flow graph, so the verifier should now prove that the code is safe if execution drops out of a block that previously contained athrow . In this case, it cannot guarantee that the locale was initialized for int for the iinc on line 41.

The simplest solution is to replace the sequence new; dup; invokespecial java/lang/IllegalStateException/<init>()V; athrow new; dup; invokespecial java/lang/IllegalStateException/<init>()V; athrow new; dup; invokespecial java/lang/IllegalStateException/<init>()V; athrow on the return constant (in this case aconst_null; aret , but this will change according to the return type). This allows the verifier to prove that the control does not exit the block. (Note that this effectively skips the finally handlers without branching into the catch block.)

In the comments, querent explained that they are performing deobfusion of the control flow. In general, you are better off creating a high-level IRS style with an explicit control flow graph and transforming it, rather than working at the stack level of operands and local variables. On such an IR, it’s quite easy to say: β€œI know that this branch is never taken, replace it with a jump to an unoccupied block.” Such an IR requires some effort to create (through some existing analysis structures such as Soot), but it will pay for itself many times if you do more than one conversion or have to process many different code patterns (so a simple pattern is tracking byte sequences - code is inefficient).

+3
source

Source: https://habr.com/ru/post/1209822/


All Articles