changeset 11869:2ca2a6ae18f0

8022853: add ability to load uncompressed object and Klass references in a compressed environment to Unsafe Reviewed-by: coleenp, jrose, kvn
author twisti
date Mon, 27 Apr 2015 09:02:48 -0700
parents f57957a657e3
children 036695d7aa53 9b6bb178e525
files src/java.base/share/classes/sun/misc/Unsafe.java
diffstat 1 files changed, 30 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/sun/misc/Unsafe.java	Mon Apr 27 10:13:21 2015 +0200
+++ b/src/java.base/share/classes/sun/misc/Unsafe.java	Mon Apr 27 09:02:48 2015 -0700
@@ -183,7 +183,7 @@
      * <p>
      * Unless the reference {@code x} being stored is either null
      * or matches the field type, the results are undefined.
-     * If the reference {@code o} is non-null, car marks or
+     * If the reference {@code o} is non-null, card marks or
      * other store barriers for that object (if the VM requires them)
      * are updated.
      * @see #putInt(Object, long, int)
@@ -219,6 +219,35 @@
     /** @see #putInt(Object, long, int) */
     public native void    putDouble(Object o, long offset, double x);
 
+    // These read VM internal data.
+
+    /**
+     * Fetches an uncompressed reference value from a given native variable
+     * ignoring the VM's compressed references mode.
+     *
+     * @param address a memory address locating the variable
+     * @return the value fetched from the indicated native variable
+     */
+    public native Object getUncompressedObject(long address);
+
+    /**
+     * Fetches the {@link java.lang.Class} Java mirror for the given native
+     * metaspace {@code Klass} pointer.
+     *
+     * @param metaspaceKlass a native metaspace {@code Klass} pointer
+     * @return the {@link java.lang.Class} Java mirror
+     */
+    public native Class<?> getJavaMirror(long metaspaceKlass);
+
+    /**
+     * Fetches a native metaspace {@code Klass} pointer for the given Java
+     * object.
+     *
+     * @param o Java heap object for which to fetch the class pointer
+     * @return a native metaspace {@code Klass} pointer
+     */
+    public native long getKlassPointer(Object o);
+
     // These work on values in the C heap.
 
     /**