New Blog Post on VM Interfaces

David Holmes - Sun Microsystems David.Holmes at Sun.COM
Mon Jul 28 16:06:56 PDT 2008


Hi Andrew,

Another dimension to this "VM interface" issue is determining when a 
library requires VM support and when it just need native support. For 
example Object.wait needs VM support, but I/O normally just needs native 
support ... except it isn't that clear cut because if we take for 
example the infamous "interruptible I/O" on Solaris we find that some 
I/O operations have to go through the VM to get the interruption 
support. So a future change in semantics might change whether a library 
needs VM support or just native support.

In a sense every native method can potentially interface to the VM, 
depending on what the actual C code does. This makes things a bit 
inconsistent in Classpath where the VMxxx classes define the VM 
interface layer, but the direct use of native methods defines another 
implicit interface layer. When I worked on the OVM project (Jan Vitek at 
Purdue - 2001-2004) we actually had to redirect may of those native 
methods back into the VM because we had a single-native-thread and so 
had to use non-blocking I/O within that thread. We would have preferred 
if instead of native methods every class delegated to a VMxxx class 
first and that it then could define Java or native methods as required 
(just as VMObject et al do). I don't know if Classpath eventually moved 
to this level of moving every native method into a VMxxx class?

Now for OpenJDK, without rewriting the Java code to call VMxxx methods 
you could say that native methods are the interface layer and that the C 
code can then either delegate to a JVM_xxx method or else use a direct 
implementation. Or you could define a JVM_xxx method for every native 
call and have a default implementation that provides a simple/direct C 
implementation or else calls a "real" VM method. But you end up with a 
very fat interface layer.

Anyway just some comments ...

Cheers,
David Holmes
Senior Java Technologist
Java SE VM Real-time and Embedded Group
---------------------------------------

Andrew John Hughes said the following on 07/29/08 07:25:
> http://blog.fuseyism.com/index.php/2008/07/28/comparing-and-contrasting-vm-interfaces/



More information about the cvmi-dev mailing list