ObjectWeb ASM explained

ASM
Author:Eric Bruneton
Developer:OW2
Latest Release Version:9.3
Operating System:Cross-platform
Programming Language:Java
Genre:bytecode Engineering Library
License:BSD License

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.[1]

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.[2] [3]

    Release history

    This table presents only releases with significant steps in ObjectWeb ASM history, aside from versions that mainly fixed bugs and improved performance.[4]

    width=60Releasewidth=110Release Datewidth=500Highlights
    2.02005-05-17Java 5 language support
    3.22009-06-11support for the new invokedynamic code.
    4.02011-10-29Java 7 language support
    5.02014-03-16Java 8 language support
    6.02017-09-23Codebase migrated to Gitlab
    Java 9 language support
    6.12018-03-11Java 10 language support
    7.02018-10-27Java 11 language support
    7.12019-03-03Java 13 language support
    8.02020-03-28Java 14 language support
    9.02020-09-22Java 16 language support
    9.12021-02-06Java 17 language support
    9.22021-06-20Java 18 language support
    9.32022-04-03Java 19 language support, new Maven BOM

    See also

    External links

    Notes and References

    1. Web site: ASM: a code manipulation tool to implement adaptable systems. FranceTélécom R&D, DTL/ASR. 2002. Éric. Bruneton. Romain. Lenglet. Thierry. Coupaye. 10.1.1.117.5769. August 23, 2023.
    2. Web site: ASM now supports invokedynamic. Forax. Remi. 2009-06-11. 2009-11-14.
    3. Web site: 11 June 2009: ASM 3.2 (cvs-tag: ASM_3_2). ObjectWeb. 2009-06-11. 2009-11-14.
    4. Web site: Versions. ObjectWeb. 2020-06-06.