Questions tagged [jasmin]

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.

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.

Jasmin was originally created as a companion to the book "Java Virtual Machine", written by Jon Meyer and Troy Downing and published by O'Reilly Associates. Since then, it has become the de-facto standard assembly format for Java. It is used in dozens of compiler classes throughout the world, and has been ported and cloned multiple times. For better or worse, Jasmin remains the oldest and the original Java assembler.

The O'Reilly JVM book is now out of print. Jasmin continues to survive as a SourceForge Open Source project.

83 questions
2
votes
0 answers

ASM: assemble Textifier output into classfile

Does anybody know if any tool/library exists able to assemble output of ASM Textifier into a classfile? So, I have the following code: final ClassReader classReader = new ClassReader(bytes); final StringWriter writer = new StringWriter(); final…
Pavel S.
  • 1,267
  • 14
  • 19
2
votes
1 answer

Logical NOT operation in JVM

I'm trying to mimic the behavior of a NOT gate using Jasmin. The behavior is as follows: Pop an integer off the stack if the integer is 0, push 1 back onto the stack else push 0 back onto the stack I've tried two different attempts at this but to…
Calseon
  • 325
  • 3
  • 18
2
votes
1 answer

Java bytecode final field assignment (jasmin)

In the java language, a final field takes an immediate value at initialisation and cannot be changed anymore. In java bytecode (jasmin), if I make a final field, it ignores the immediate value I assigned it at initialisation and I can change it like…
Henri Latreille
  • 263
  • 1
  • 11
2
votes
2 answers

How to print a long in jasmin?

I can print an integer in jasmin like so: getstatic java/lang/System/out Ljava/io/PrintStream; bipush 7 invokevirtual java/io/PrintStream/println(I)V What would the argument to println be to print a long (64-bit integer)? I have tried…
Tyler Gaona
  • 479
  • 1
  • 4
  • 14
2
votes
2 answers

CLASSPATH to launch a simple local class file

I've got a .class file in my local directory, assembled from following jasmin code: .class public default_class .super java/lang/Object .method public static main([Ljava/lang/String;)V .limit locals 10 .limit stack 10 invokestatic…
k_wisniewski
  • 2,439
  • 3
  • 24
  • 31
2
votes
2 answers

jasmin hacking and verify error

I'm playing with jasmin and I try to launch my .class file, which is supposed to perform simple string concatenation. My jasmin source looks like this: .class public default_class .super java/lang/Object .method public static…
k_wisniewski
  • 2,439
  • 3
  • 24
  • 31
2
votes
1 answer

Why use aload_0 in Jasmin HelloWorld?

There is the start of official Jasmin HelloWorld example. .class public NoJad.j .super java/lang/Object .method public ()V aload_0 invokenonvirtual java/lang/Object/()V return .end method .method public static…
Nelson Tatius
  • 7,693
  • 8
  • 47
  • 70
1
vote
1 answer

Java Bytecode Subroutines - Cannot load return address

I have been trying to write some Java bytecode and assemble it using Jasmin. I am trying to get my head around subroutines, and am not sure why I obtain the following error message when running my program: >java -jar jasmin.jar test.j Generated:…
Jack
  • 2,153
  • 5
  • 28
  • 43
1
vote
1 answer

How to declare nested function for Jasmin byte code?

I am writing a compiler and I need to convert Mini Pascal (a simple version of Pascal) to Jasmin byte code. But how do I declare the nested function in the Jasmin language? Because function tt(I): I can only pass in one Integer (which is rr) how…
sdragon
  • 27
  • 6
1
vote
1 answer

([Ljava/lang/String;)V) Unable to pop operand off an empty stack

For school I have to make my own programming language. One part of the language is that the user is able to make and use arrays. I am using antlr 4.1 to generate the grammar, and the bytecode is in Jasmin since the compiler and code generator are…
1
vote
2 answers

Jasmin Assembler VerifyError : Expecting to find object/array on stack

I get this error after "java testphase": C:\jasmin-2.4>java testphase Exception in thread "main" java.lang.VerifyError: (class: testphase, method: main signature: ([Ljava/lang/String;)V) Expecting to find object/array on stack Could not find…
vik
  • 11
  • 1
  • 2
1
vote
0 answers

VerifyError empty stack in bytecode while something is on the stack

I've got the following code that gives an error when ran with the 2 print statements but when I only do one it runs fine. If I'm correct ldc just pushes the string on the stack, so while invoking the second printline it should still have something…
user7137459
1
vote
1 answer

Why doesn't Jasmin like this assembly code?

I am reading the programming for the Java Virtual Machine by Joshua Engel, and I tried typing in one of the examples in the book. I understand that the book uses Oolong, and I am using Jasmin, however for such a simple example, and because the…
Blake F.
  • 153
  • 13
1
vote
1 answer

NullPointerException in code created with jasmin bytecode assembler

This code is throwing a java.lang.NullPointerException. I am attempting to compile a bit of code to the jvm and this is what my compiler outputs .class public test .super java/lang/Object .field static i [I .method public static …
Vladimir_314159
  • 1,457
  • 1
  • 9
  • 21
1
vote
1 answer

How does Java bytecode mnemonics differ from Jasmin?

Java bytecode mnemonics are assembly-like instructions for JVM. Jasmin is also defined as a Java-assembler in the link given below. http://jasmin.sourceforge.net/