4

I'm reading "Programming for Java Virtual Machine" by Joshua Engel book where the author offers "an assembly language for JVM" called Oolong.

As far as I understand this is the language which is compiled into java bytecode and which is really similar to the original java bytecode(big number of bytecode opcodes are used there). If it's so then why is it called assembly language? Is that because it's low-level language and looks like a bytecode?

Another question is about Jasmin. As Wikipedia says it's "a free open source assembler to create class files from human readable assembler-like syntax using the Java Virtual Machine instruction sets". The syntax of Jasmin files(which also have .j extension) looks like Oolong's syntax. Is it used there?

Sergey
  • 11,548
  • 24
  • 76
  • 113
  • See the [Java Virtual Machine Specification](http://docs.oracle.com/javase/specs/jvms/se7/html/index.html) - it specifies the Java bytecode instructions. – Jesper Jun 21 '12 at 07:43
  • @Sergey I am looking for the book `Programming for Java Virtual Machine`, do you have a pdf? Thx. – smwikipedia Jul 07 '15 at 08:18

3 Answers3

6

Joshua Engel's Oolong1 is an assembly language for the JVM.

... why is it called assembly language?

You are best off looking up what "assembly language" means in (for example) Wikipedia. It is essentially a language that has a direct one-to-one mapping2 between "statements" and machine instructions for the target machine. OOlong matches this description, if you view the JVM as the target machine. (There is a one-to-one mapping between Oolong statements and JVM bytecode instructions.)

The syntax of Jasmin files(which also have .j extension) looks like Oolong's syntax. Is it used there?

I've seen sources that say that Oolong's syntax is "based on Jasmin", but I can't find any stand-alone documents describing the syntax in any detail.

If you are interested in looking at Oolong, this SO question has details on where to download it from:


1 - There is another unrelated Oolong programming language; see https://github.com/thesquaregroot/oolong. And then there is Castegren & Wrigstad's OOlong: An Extensible Concurrent Object Calculus.
2 - I am oversimplifying. Some assembly languages support "macros" where a single source statement can map to multiple target instructions. Read the Wikipedia reference.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
0

It uses a stack, stack frame, and has bytecodes that correspond to real assembly language. It also has higher level instructions that will retrieve fields from memory, but not directly. You have to use getfield, putfield, invokespecial etc. Since JVM does not run in a true hardware environment(like the Unix Kernel) it does not do any of the heavy lifting that a real OS does like crafting processes, worrying about time slices and servicing interrupts, communicating with device drivers and on and on. I would have to say JVM is middleware between Java and the native OS. It is exactly what they call it .... a Virtual machine.

-1

Oolong is chinese tea and the name is not important. Remember that Java language is compiled by java compiler. Java Bytecode is not an assembly language but you can regard it as assembly language to (JVM)Java Virtual Machine.

Kenny Ho
  • 7
  • 1
  • I don't recall the OP asking about the origin of the name, how the Java language is compiled is largely irrelevant to the question, and Java bytecode is *not* "assembly language to the JVM". – Mac Jun 22 '12 at 09:36