Jasmin (Java assembler)
Encyclopedia
Jasmin is a free
open source
assembler
to create class files from human readable assembler-like syntax using the Java Virtual Machine instruction sets. Jasmin is not a Java programming language compiler.
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.
Then, to run Jasmin, use:
java -jar jasmin.jar examples\HelloWorld.j [Windows]
or
java -jar jasmin.jar examples/HelloWorld.j [Unix/Mac OS X]
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 an 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.
Free software
Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...
open source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...
assembler
Assembly language
An assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices. It implements a symbolic representation of the machine codes and other constants needed to program a given CPU architecture...
to create class files from human readable assembler-like syntax using the Java Virtual Machine instruction sets. Jasmin is not a Java programming language compiler.
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.
Example
The traditional HelloWorld starter in Jasmin:
.class public HelloWorld
.super java/lang/Object
.method public static main([Ljava/lang/String;)V
.limit stack 2
.limit locals 1
getstatic java/lang/System/out Ljava/io/PrintStream;
ldc "Hello World."
invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
return
.end method
Invoking
Referenced from the Readme fileThen, to run Jasmin, use:
java -jar jasmin.jar examples\HelloWorld.j [Windows]
or
java -jar jasmin.jar examples/HelloWorld.j [Unix/Mac OS X]
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 an 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 bytecodeJava bytecodeJava bytecode is the form of instructions that the Java virtual machine executes. Each bytecode opcode is one byte in length, although some require parameters, resulting in some multi-byte instructions. Not all of the possible 256 opcodes are used. 51 are reserved for future use...
- the Java .class file formatClass (file format)In the Java programming language, source files are compiled into machine-readable class files which have a .class extension. Since Java is a platform-independent language, source code is compiled into an output file known as bytecode, which it stores in a .class file. If a source file has more...
- C to Java Virtual Machine compilers
- ARM9EARM9EARM9 is an ARM architecture 32-bit RISC CPU family. With this design generation, ARM moved from a von Neumann architecture to a Harvard architecture with separate instruction and data buses , significantly increasing its potential speed...
, a CPUCentral processing unitThe central processing unit is the portion of a computer system that carries out the instructions of a computer program, to perform the basic arithmetical, logical, and input/output operations of the system. The CPU plays a role somewhat analogous to the brain in the computer. The term has been in...
family with direct Java bytecode execution ability - Common Intermediate LanguageCommon Intermediate LanguageCommon Intermediate Language is the lowest-level human-readable programming language defined by the Common Language Infrastructure specification and is used by the .NET Framework and Mono...
(CIL), a similar bytecode specification that runs on the CLRCommon Language RuntimeThe Common Language Runtime is the virtual machine component of Microsoft's .NET framework and is responsible for managing the execution of .NET programs. In a process known as just-in-time compilation, the CLR compiles the intermediate language code known as CIL into the machine instructions...
of the .NET Framework.NET FrameworkThe .NET Framework is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allows language interoperability...
. - CompilerCompilerA compiler is a computer program that transforms source code written in a programming language into another computer language...
- DisassemblerDisassemblerA disassembler is a computer program that translates machine language into assembly language—the inverse operation to that of an assembler. A disassembler differs from a decompiler, which targets a high-level language rather than an assembly language...
- List of assemblers
- Instruction setInstruction setAn instruction set, or instruction set architecture , is the part of the computer architecture related to programming, including the native data types, instructions, registers, addressing modes, memory architecture, interrupt and exception handling, and external I/O...
- MicroassemblerMicroassemblerA microassembler is a computer program that helps prepare a microprogram to control the low level operation of a computer in much the same way an assembler helps prepare higher level code for a processor. The difference is that the microprogram is usually only developed by the processor...
Further reading
- Jon Meyer: Java Virtual Machine. O'Reilly Associates, 1st Edition March 1997. ISBN 9781565921948