Java bytecode mnemonics are assembly-like instructions for JVM. Jasmin is also defined as a Java-assembler in the link given below.
-
1One obvious difference is that you don't have to work with the constant table directly, Jasmin deduces it from the constants you use. – Peter Lawrey Apr 25 '17 at 15:51
-
Is it difference between JVM Instruction mnemonics(as described in JVM Specification) and Jasmin Instruction mnemonics? – JustStartedCoding Apr 25 '17 at 18:07
-
yes. Byte code introductions have id numbers to refer to constants. – Peter Lawrey Apr 25 '17 at 19:19
1 Answers
Jasmin is an assembler:
An assembler program creates object code by translating combinations of mnemonics and syntax for operations and addressing modes into their numerical equivalents. This representation typically includes an operation code ("opcode") as well as other control bits and data. The assembler also calculates constant expressions and resolves symbolic names for memory locations and other entities.[4] The use of symbolic references is a key feature of assemblers, saving tedious calculations and manual address updates after program modifications. Most assemblers also include macro facilities for performing textual substitution – e.g., to generate common short sequences of instructions as inline, instead of called subroutines.
So you write a software program using the JVM instruction mnemonics and compile it with Jasmin.
Take a look at the Jasmin User's Guide:
Jasmin is an assembler for the Java Virtual Machine. It takes ASCII descriptions of Java classes, written in a simple assembler-like syntax using the Java Virtual Machine instruction set. It converts them into binary Java class files, suitable for loading by a Java runtime system.
Additional reference this SO question: Difference between: Opcode, byte code, mnemonics, machine code and assembly
-
1Are those mnemonics standardized? Do all java assemblers use same mnemonics? – JustStartedCoding Apr 25 '17 at 17:10
-
[JVM instruction mnemonics](http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.4) are described in the [JVM Specification](http://docs.oracle.com/javase/specs/jvms/se8/html/index.html). For the list of instructions see 6.5. This specification is essentially the "standard" for the JVM. About the second question: Most probably yes. Otherwise it will not be wise to use them at all. Imagine you want to start to use another assembler that don't understand your current source files. You will have to spend time translating your current files to the new mnemonics. – zloster Apr 25 '17 at 17:40
-
Nevertheless, the purpose of the JVM specification is not to define a mandatory assembly language and it doesn’t. So while all bytecode assembly languages use the same instruction names derived from the specification, they still don’t have compatible syntax, simply because there is no binding standard. So when you want to switch between different assemblers, you should be prepared to spent some work on the source files. – Holger Apr 28 '17 at 10:57