This page aims to document the current VM interface used by the
current OpenJDK 7 trees
and the new interface proposed in the
CVMI repository. The
latter moves the native methods from classes like java.lang.Object
to a new class such as java.lang.VMObject. The intention is
that VMs can replace these VMxxx classes as needed rather than having to
supply specifically named C functions.
This class declares six native methods, five of which are redirected to the
VM by registerNatives in the JDK7 tree and by their absence
in VMObject in the new tree. The VMObject methods
are static and take the Object as a parameter, thus avoiding
instance creation.
getClass: This is the one method implemented in the JDK rather
than HotSpot. It returns the class of the object by using the existing JNI
method, JNIEnv.GetObjectClass.hashCode: In the current tree, this resolves to a
JVM_IHashCode symbol. The VM should compute the hashcode of
the object and return it.wait, notify, notifyAll: These three
methods implement conditional wait support for threads and map to
JVM_MonitorWait, JVM_MonitorNotify and
JVM_MonitorNotifyAll respectively in the current tree.clone: This should return a shallow copy of the Object,
by assigning each field in the new object to the values used by the old one (thus
copying primitive fields, but not reference fields). An object not implementing
Cloneable (all arrays do) should fail with a
CloneNotSupportedException. In the current tree, this is provided
by JVM_Clone.