Skip to main content

Tabbing into the JIT

3 replies [Last post]
Joined: 2007-07-27

This is my first post to the Java community, and to be honest I can't figure out where to post, so I'll try to ask here...
I'm part of the development team of GNU Octave ( Octave is a scripted language for Scientific Computing that is mostly compatible with Matlab. One problem with Octave is that it doesn't have a JIT compiler and hence can be quite slow at times. I'm under the impression that the Java JIT is the best JIT ever made, and since Java has been released under the GPL I thought it would make sense to use this JIT with Octave.
My question is really, "where should I ask questions on how to make Octave run on the Java JIT?".


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2004-09-02

Not sure about what exactly your plan is, put I'd personally suggest you to compile Octave code into Java bytecode, which you can then utilise any existing Java runtime infrastructure, like JIT & Hotspot.

To read more about Java bytecodes you can consult the JVM specifications:

Joined: 2007-07-27

Thanks for the reply!
I don't really have a plan, which is why my question was so vague. Assuming I go with your suggestion and compile Octave code into java bytecode, where would I ask questions on the issues that will come? Is this the right forum?
Already I would ask, can I do this all in memory, or do I need to write the bytecode to disc before it is executed? I've read somewhere that JavaScript runs in Java as well. What do the JavaScript people?


Joined: 2004-01-07

Hi Hauberg,

Well you're right. Java/Hotspot-Server is one of the best JITs available as it performs well across the board.
The javascript-guys (Rhino) did what other suggested, compile javascript to java-bytecode (the code emited by the java-compiler) and the run the bytecode like it would be normal java.

Since I guess you don't want to write for ages on a Octave->Java Bytecode compiler I guess it would be easier to write a Octave->Java converter and later compile the java-sourcecode to bytecode, for example with the new compiler-api or javaassist:
Java itself supports loading java-bytecode without storing it on disk - I don't know wether Javaassist also supports this.

However there are some (more or less small) drawbacks when using a JVM for what you would like to do with it:
- Hotspot does currently not support SIMD instructions very well, so compiled and vectorized C code is probably still faster under some circumstances.
- Java requires Boundy-Checks when arrays are accessed. However this is optimized pretty well and when e.g. walking through an array with a loop only very few check-instructions are generated.
- Acessing native data and functions is a bit complex (JNI) , but since NIO-Buffers (since java-1.4) can be done fast.

Good luck, and if you've further questions don't hestitate to ask, Clemens