rlm@10: rlm@10: rlm@10: rlm@10: Provides a small and fast bytecode manipulation framework. rlm@10: rlm@10:

rlm@10: The ASM framework is organized rlm@10: around the {@link clojure.asm.ClassVisitor ClassVisitor}, rlm@10: {@link clojure.asm.FieldVisitor FieldVisitor} and rlm@10: {@link clojure.asm.MethodVisitor MethodVisitor} interfaces, which allow rlm@10: one to visit the fields and methods of a class, including the bytecode rlm@10: instructions of each method. rlm@10: rlm@10:

rlm@10: In addition to these main interfaces, ASM provides a {@link rlm@10: clojure.asm.ClassReader ClassReader} class, that can parse an rlm@10: existing class and make a given visitor visit it. ASM also provides rlm@10: a {@link clojure.asm.ClassWriter ClassWriter} class, which is rlm@10: a visitor that generates Java class files. rlm@10: rlm@10:

rlm@10: In order to generate a class from scratch, only the {@link rlm@10: clojure.asm.ClassWriter ClassWriter} class is necessary. Indeed, rlm@10: in order to generate a class, one must just call its visitXXX rlm@10: methods with the appropriate arguments to generate the desired fields rlm@10: and methods. See the "helloworld" example in the ASM distribution for rlm@10: more details about class generation. rlm@10: rlm@10:

rlm@10: In order to modify existing classes, one must use a {@link rlm@10: clojure.asm.ClassReader ClassReader} class to analyze rlm@10: the original class, a class modifier, and a {@link clojure.asm.ClassWriter rlm@10: ClassWriter} to construct the modified class. The class modifier rlm@10: is just a {@link clojure.asm.ClassVisitor ClassVisitor} rlm@10: that delegates most of the work to another {@link clojure.asm.ClassVisitor rlm@10: ClassVisitor}, but that sometimes changes some parameter values, rlm@10: or call additional methods, in order to implement the desired rlm@10: modification process. In order to make it easier to implement such rlm@10: class modifiers, ASM provides the {@link clojure.asm.ClassAdapter rlm@10: ClassAdapter} and {@link clojure.asm.MethodAdapter MethodAdapter} rlm@10: classes, which implement the {@link clojure.asm.ClassVisitor ClassVisitor} rlm@10: and {@link clojure.asm.MethodVisitor MethodVisitor} interfaces by rlm@10: delegating all work to other visitors. See the "adapt" example in the ASM rlm@10: distribution for more details about class modification. rlm@10: rlm@10:

rlm@10: The size of the core ASM library, asm.jar, is only 42KB, which is much rlm@10: smaller than the size of the rlm@10: BCEL library (504KB), and than the rlm@10: size of the rlm@10: SERP library (150KB). ASM is also rlm@10: much faster than these tools. Indeed the overhead of a load time class rlm@10: transformation process is of the order of 60% with ASM, 700% or more with BCEL, rlm@10: and 1100% or more with SERP (see the test/perf directory in the ASM rlm@10: distribution)! rlm@10: rlm@10: @since ASM 1.3 rlm@10: rlm@10: