if (SuspendMethodTracer.quiteFlags.get()) {
return classfileBuffer;
}
try {
ClassReader cr = new ClassReader(classfileBuffer);
ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_FRAMES) {
@Override
protected String getCommonSuperClass(String type1, String type2) {
return db.getCommonSuperClass(type1, type2);
}
};
ClassEntry ce = MethodDatabaseUtil.buildClassEntryFamily(db, cr);
// if (className.startsWith("sun/launcher/")
// || className.startsWith("clojure/asm")
// || className.startsWith("org/objectweb/asm/")
// || className.startsWith("clojure/asm")
// || className.startsWith("org/junit")
//// || className.startsWith("clojure/main")
//// || className.startsWith("clojure/lang")
// || className.startsWith("sun/misc/ClassFileTransformer")
// || className.startsWith("nginx/clojure/asm")
// || className.startsWith("nginx/clojure/wave")
// || className.startsWith("java/util/ArrayList")
// || className.startsWith("org/eclipse/jetty/server/")
// || className.startsWith("clojure/lang/Compiler")
// || className.startsWith("java/net/URLClassLoader")
// || className.startsWith("java/io/PrintStream")
// || className.startsWith("java/util/concurrent/ConcurrentHashMap")
// || className.startsWith("java/util/concurrent/atomic/AtomicBoolean")
// || className.startsWith("java/")
// || className.startsWith("sun/")
// || className.startsWith("com/sun/")
// || className.startsWith("org/eclipse/jdt/")
// || className.endsWith("ClassLoader")
// || className.startsWith("clojure/lang/PersistentHashMap")
// || className.startsWith("clojure/lang/Keyword")
// || className.startsWith("clojure/lang/Symbol")
// || className.startsWith("clojure/lang/Namespace")
// || className.startsWith("clojure/lang/Persistent")
// || className.startsWith("java/lang"))
if (db.shouldIgnore(className)){
db.debug("skip class %s", className);
return classfileBuffer;
}
db.debug("loading class %s", className);
// ClassVisitor cv = db.isVerbose() ? new TraceClassVisitor(cw, new PrintWriter(System.out)) : cw;
ClassVisitor cv = new ClassVisitor(Opcodes.ASM4, cw) {
@Override
public MethodVisitor visitMethod(int access, String name,
String desc, String signature, String[] exceptions) {
MethodVisitor mv = super.visitMethod(access, name,
desc, signature, exceptions);
if ( (Opcodes.ACC_NATIVE & access) != 0
|| (Opcodes.ACC_ABSTRACT & access) != 0
// || name.startsWith("<cinit>")
) {
db.debug("skip native or abstract method: %s.%s%s", className, name, desc);
return mv;
}
return new JSRInlinerAdapter(new SuspendMethodTracerAdvice(db, className, mv, access, name, desc), access, name, desc, signature, exceptions);
}
};
cr.accept(cv, ClassReader.EXPAND_FRAMES);
byte[] rt = cw.toByteArray();
if (db.isDump()) {
File wavedFile = new File(new File(db.getDumpDir() + "/waved-by-tool"), className + ".class");
wavedFile.getParentFile().mkdirs();