This commit is contained in:
Redkale
2016-07-02 16:41:58 +08:00
parent a2d4b6ec37
commit a98d5f32a1

View File

@@ -10,8 +10,10 @@ import jdk.internal.org.objectweb.asm.*;
/**
* MethodVisitor 的调试类
* <p>
* <p>
* 详情见: http://redkale.org
*
* <p> 详情见: http://redkale.org
* @author zhangjx
*/
public class AsmMethodVisitor {
@@ -25,6 +27,13 @@ public class AsmMethodVisitor {
return this;
}
public void debugLine() {
if (!debug) return;
System.out.println();
System.out.println();
System.out.println();
}
private final Map<Label, Integer> labels = new LinkedHashMap();
private static final String[] opcodes = new String[200]; //0 -18
@@ -137,7 +146,15 @@ public class AsmMethodVisitor {
public void visitLdcInsn(Object o) {
visitor.visitLdcInsn(o);
if (debug) System.out.println("mv.visitLdcInsn(" + o + ");");
if (debug) {
if (o instanceof CharSequence) {
System.out.println("mv.visitLdcInsn(\"" + o + "\");");
} else if (o instanceof jdk.internal.org.objectweb.asm.Type) {
System.out.println("mv.visitLdcInsn(Type.getType(\"" + o + "\"));");
} else {
System.out.println("mv.visitLdcInsn(" + o + ");");
}
}
}
public void visitMaxs(int maxStack, int maxLocals) {