ObjectWeb ASM
{{Infobox software
| name = ASM
| logo =
| screenshot =
| caption =
| author = Eric Bruneton
| developer = OW2
| released = {{Start date and age|2002}}
| latest release version = 9.7.1
| latest release date = {{start date and age|2024|10|06}}
| latest preview version =
| latest preview date =
| operating system = Cross-platform
| programming language = Java
| genre = bytecode Engineering Library
| license = BSD License
| website = {{Official URL}}
}}
The ASM library is a project of the OW2 consortium. It provides a simple API for decomposing, modifying, and recomposing binary Java classes (i.e. bytecode). The project was originally conceived and developed by Eric Bruneton. ASM is Java-centric at present, and does not currently have a backend that exposes other bytecode implementations (such as .NET bytecode, Python bytecode, etc.).
The name "ASM" is not an acronym: it is just a reference to the asm keyword of C, which allows some functions to be implemented in assembly language.{{cite web
| title=ASM: a code manipulation tool to implement adaptable systems
| publisher=FranceTélécom R&D, DTL/ASR
| date=2002
| first1=Éric|last1=Bruneton|first2=Romain|last2=Lenglet|first3=Thierry|last3=Coupaye
| citeseerx=10.1.1.117.5769
| url=https://citeseerx.ist.psu.edu/pdf/5f4da1df76b8878bf8358ec24d6592a8008d2b0d
| access-date=August 23, 2023
}}
Uses
ASM provides a simple library that exposes the internal aggregate components of a given Java class through its visitor oriented API. ASM also provides, on top of this visitor API, a tree API that represents classes as object constructs. Both APIs can be used for modifying the binary bytecode, as well as generating new bytecode (via injection of new code into the existing code, or through generation of new classes altogether.) The ASM library has been used in several diverse applications, such as:
;Performance and Profiling
:Instrumentation calls that capture performance metrics can be injected into Java class binaries to examine memory/coverage data. (For example, injecting instrumentation at entry/exit points.)
;Implementation of New Language Semantics
:For example, Groovy uses ASM to generate its bytecode. Also, Aspect-Oriented additions to the Java language have been implemented by using ASM to decompose class structures for point-cut identification, and then again when reconstituting the class by injecting aspect-related code back into the binary. (See: AspectWerkz)
=Invokedynamic=
{{see also|Da Vinci Machine}}
Since version 3.2, ASM has added support for the new invokedynamic
code, which allows method invocation relying on dynamic type checking on the latest JDK 7 binaries, thus easing support for dynamically typed languages.{{cite web
| url=http://weblogs.java.net/blog/forax/#011890
|title=ASM now supports invokedynamic
|last=Forax|first=Remi
| date=2009-06-11
| accessdate=2009-11-14}}{{cite web
| url=http://asm.ow2.org/history.html#11_June_2009:_ASM_3.2_(cvs-tag:_ASM_3_2)
| title=11 June 2009: ASM 3.2 (cvs-tag: ASM_3_2)
| publisher=ObjectWeb
| date=2009-06-11
| accessdate=2009-11-14}}
Release history
This table presents only releases with significant steps in ObjectWeb ASM history, aside from versions that mainly fixed bugs and improved performance.{{cite web
| url=https://asm.ow2.io/versions.html
| title=Versions
| publisher=ObjectWeb
| accessdate=2020-06-06}}
See also
- Byte Code Engineering Library
- Javassist
References
{{reflist}}
External links
- {{official website}}
- [https://www.ow2.org/ OW2 Home] - The OW2 Consortium Home Page.
- [https://web.archive.org/web/20060706114810/http://aspectwerkz.codehaus.org/ AspectWerkz] - The AspectWerkz Project Home Page. (One of the high-visibility projects that makes use of ASM.)
- [https://web.archive.org/web/20130618025348/http://www.drgarbage.com/bytecode-visualizer.html Bytecode Visualizer - free Eclipse plugin for viewing and debugging Java bytecode which makes use of ASM library]