6
6
import org .objectweb .asm .MethodVisitor ;
7
7
import org .objectweb .asm .Opcodes ;
8
8
import org .objectweb .asm .Type ;
9
- import org .objectweb .asm .commons .CodeSizeEvaluator ;
10
9
import org .objectweb .asm .tree .AbstractInsnNode ;
11
10
import org .objectweb .asm .tree .FieldInsnNode ;
12
11
import org .objectweb .asm .tree .IincInsnNode ;
@@ -85,10 +84,11 @@ public AutosplitMethodWriter(ClassVisitor target, String tgtype, int access, Str
85
84
public void visitEnd () {
86
85
super .visitEnd ();
87
86
88
- CodeSizeEvaluator cse = new CodeSizeEvaluator (null );
89
- accept (cse );
87
+ int maxsize = 0 ;
88
+ for (AbstractInsnNode ai = instructions .getFirst (); ai != null ; ai = ai .getNext ())
89
+ maxsize += insnSize (ai );
90
90
91
- if (cse . getMaxSize () <= MAX_UNSPLIT_METHOD ) {
91
+ if (maxsize <= MAX_UNSPLIT_METHOD ) {
92
92
// hey cool, we don't need to do anything fancy here
93
93
MethodVisitor mw = target .visitMethod (access , name , desc , signature , ((List <String >)exceptions ).toArray (new String [0 ]));
94
94
accept (mw );
@@ -97,7 +97,7 @@ public void visitEnd() {
97
97
98
98
/* we need to split this thing */
99
99
100
- if (DEBUG_FRAGMENT ) System .out .printf ("method=%s min=%d max=%d\n " , name , cse . getMinSize (), cse . getMaxSize () );
100
+ if (DEBUG_FRAGMENT ) System .out .printf ("method=%s max=%d\n " , name , maxsize );
101
101
102
102
splitSwitches ();
103
103
getInstructions ();
@@ -946,7 +946,7 @@ private int insnSize(AbstractInsnNode ai) {
946
946
case AbstractInsnNode .MULTIANEWARRAY_INSN :
947
947
return 4 ;
948
948
default :
949
- throw new RuntimeException () ;
949
+ return 0 ;
950
950
}
951
951
}
952
952
0 commit comments