Jasmin (Java assembler)
Jasmin is NOT a Java programming language compiler.
Jasmin is a Free Open Source assembler to create class files from human readable assembler-like syntax using the Java Virtual Machine instruction sets.
It could be said as of writing a program by GAS assembly, instead of using a modern day C++ compiler, assembler, and linker.
Jasmin as an assembler takes ASCII descriptions of JVM Classes, written in a simple assembler-like syntax using the Java Virtual Machine instruction set. It converts them into binary JVM Class files, suitable for loading by a Java runtime system.
There are now tools allowing for the low-level manipulation of Java classes and Java Archive (JAR) files in a hostile environment, such as tinapoc
Example
From the examples/HelloWorld.j file (Copyright Jonathan Meyer Under GPL)
.class public NoJad.j
.super java/lang/Object
;
; standard initializer
.method public ()V
aload_0
invokenonvirtual java/lang/Object/()V
return
.end method
.method public static main([Ljava/lang/String;)V
.limit stack 2
.limit locals 2
bipush 2
astore 0
bipush 3
astore 1
aload 0
aload 1
astore 0
astore 1
return
.end method
Invoking
Referenced from the Readme file
Then, to run Jasmin, use:
java -jar jasmin.jar examples\HelloWorld.j [Windows]
or
java -jar jasmin.jar examples/HelloWorld.j [Unix/MacOsX]
History
Jon Meyer and Troy Downing wrote Jasmin for their published book "Java Virtual Machine".
At the time of writing there were no known freely available assembler for the Java Virtual Machine instruction set. The only known compilers at the time required input in Java syntax source code, and explicitly using a JVM instruction was impossible. Therefore the authors set out to create a assembler suitable for manipulating and producing a class file to be executed on the Virtual machine.
Jasmin remains the oldest and the original Java assembler known for JVM.
Jasmin is currently located under a SourceForge Open Source project.
See also
- Java bytecode
- the Java .class file format
- C to Java Virtual Machine compilers
- ARM9E, a CPU family with direct Java bytecode execution ability
- Common Intermediate Language (CIL), a similar bytecode specification that runs on the CLR of the .NET Framework.
- Compiler
- Disassembler
- List of assemblers
- Instruction set
- Microassembler
Books
- Jon Meyer: Java Virtual Machine. O'Reilly Associates, 1st Edition March 1997. ISBN 9781565921948
External links
- Jasmin Official page at Sourceforge
- Sun's Java Virtual Machine Specification
- Jasmin instructions
- Publisher of "Java Virtual Machine"
- personal website of Jon Meyer
- Programming Languages for the Java Virtual Machine
- Organization for Java Technology Specification
de:Jasmin (Programmiersprache)