Introduction to the ASM 2.0 Bytecode Framework
by Eugene Kuleshov
08/17/2005
Java features such as dynamic class loading and reflection make it a
dynamic
language. However, in many cases, reflection is not sufficient, and
developers
need to generate bytecode from non-Java source code, such as scripting
languages
like Groovy (JSR-241)
or
BeanShell (JSR-274),
or from
metadata such as an OR-mapping configuration. When working with existing
classes, and especially when original Java sources are not available,
some tools
may need to do a static analysis of the interdependencies or even method
behavior in order to produce test coverage or metrics, or to detect bugs
and
anti-patterns. New features added to into Java 5, such as annotations
and
generics, affected bytecode structure and require special attention from
bytecode manipulation tools to maintain good performance. This article
will give
an overview of one of the smallest and fastest bytecode manipulation
frameworks
available for Java.
Framework Structure
The ASM bytecode manipulation
framework is written in Java and uses a visitor-based approach to
generate
bytecode and drive transformations of existing classes. It allows
developers to
avoid dealing directly with a class constant pool and offsets within
method
bytecode, thus hiding bytecode complexity from the developer and
providing
better performance, compared to other tools such as BCEL, SERP, or Javassist.
ASM is divided into several packages that allow flexible bundling.
The
packaging arrangement is shown in Figure 1.
Figure
1. Arrangement of ASM packages
- The Core package provides an API to read, write, and
transform Java
bytecode and defines a foundation for the other packages. This package
is
sufficient to generate Java bytecode and to implement the majority of
bytecode
transformations.
- The Tree package provides in-memory representation of
Java
bytecode.
- The Analysis package provides basic data-flow analyses
and
type-checking algorithms for Java method bytecode stored in structures
from
the tree package.
- The Commons package (added in ASM 2.0) provides
several commonly
used bytecode transformations and adapters to simplify bytecode
generation.
- The Util package contains several helper classes and
simple
bytecode verifiers that can help in development or testing.
- The XML package provides an adapter to convert
bytecode structures
to and from XML, and SAX-compliant adapters that allow the use of XSLT
to
define bytecode transformations.
Ref:
分享到:
相关推荐
标签:asm-2.0.jar.zip,asm,2.0,jar.zip包下载,依赖包
AndroidStuido的插件ASM Bytecode Viewer用于展示kotlin/java的字节码,因为AndroidStudio的market经常打不开,现在提供离线包。 安装: File-Settings-Plugins,点击设置按钮,选择“Install Plugin from Disk...”...
下载后先解压!里面有2个版本的安装包!下载后先解压!下载后先解压!可以尝试在https://plugins.jetbrains.com/search?products=idea&search=Bytecode Outline下面搜“Bytecode Outline
标签:asm-util-2.0.jar.zip,asm,util,2.0,jar.zip包下载,依赖包
深入字节码 -- 玩转 ASM-Bytecode1
用于Android studio 查看 字节码,ASM Bytecode Viewer,打开Android Studio,FIle -> Setting -> Plugins -> Install Plugins from Disk,选择文件就行,然后重启AS
主题:Bring Native to the Web: an introduction to Emscripten and asm.js 演讲人:张频,谋智网络(Mozilla)软件经理 演讲介绍:Emscripten 是 Mozilla 推出的一个开源编译工具,它能将 C/C++ 程序编译为 ...
Integrated_Asm2.20的安装程序,支持XP和Vista
org.springframework.asm-3.0.5.RELEASE.jar
asm-2.0.jar, asm-2.1.jar, asm-2.2.1-sources.jar, asm-2.2.1.jar, asm-2.2.2-sources.jar, asm-2.2.2.jar, asm-2.2.3.jar, asm-2.2.4.jar, asm-2.2.jar, asm-20041228.180559.jar, asm-3.0.jar, asm-3.0_RC1.jar, ...
标签:asm-analysis-2.0.jar.zip,asm,analysis,2.0,jar.zip包下载,依赖包
rg.springframework.asm-3.0.1.RELEASE-A.jar
标签:asm-attrs-2.0.jar.zip,asm,attrs,2.0,jar.zip包下载,依赖包
org.springframework.asm-sources-3.0.5.release.jar
Examine the command to back up the ASM metadata: ASMCMD>md_backup /backup/ASM_backup In which three situations can you use the backup? A. when one or more disks in an ASM disk group are lost B. when ...
bytecode.pdfbytecode.pdfbytecode.pdf
oracleasm2.0 X86 64位
标签:asm-tree-2.0.jar.zip,asm,tree,2.0,jar.zip包下载,依赖包
标签:asm-commons-2.0.jar.zip,asm,commons,2.0,jar.zip包下载,依赖包
标签:asm-xml-2.0.jar.zip,asm,xml,2.0,jar.zip包下载,依赖包