What is Oolong in terms of JVM?

1.8k Views Asked by At

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?

3

There are 3 best solutions below

0
Stephen C On BEST ANSWER

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.

1
Kenny Ho On

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.

0
Mike Shapiro On

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.