< prev index next >

src/java.base/share/classes/jdk/internal/misc/Unsafe.java

Print this page




 301     @ForceInline
 302     public void putAddress(Object o, long offset, long x) {
 303         if (ADDRESS_SIZE == 4) {
 304             putInt(o, offset, (int)x);
 305         } else {
 306             putLong(o, offset, x);
 307         }
 308     }
 309 
 310     // These read VM internal data.
 311 
 312     /**
 313      * Fetches an uncompressed reference value from a given native variable
 314      * ignoring the VM's compressed references mode.
 315      *
 316      * @param address a memory address locating the variable
 317      * @return the value fetched from the indicated native variable
 318      */
 319     public native Object getUncompressedObject(long address);
 320 
 321     /**
 322      * Fetches the {@link java.lang.Class} Java mirror for the given native
 323      * metaspace {@code Klass} pointer.
 324      *
 325      * @param metaspaceKlass a native metaspace {@code Klass} pointer
 326      * @return the {@link java.lang.Class} Java mirror
 327      */
 328     public native Class<?> getJavaMirror(long metaspaceKlass);
 329 
 330     /**
 331      * Fetches a native metaspace {@code Klass} pointer for the given Java
 332      * object.
 333      *
 334      * @param o Java heap object for which to fetch the class pointer
 335      * @return a native metaspace {@code Klass} pointer
 336      */
 337     public native long getKlassPointer(Object o);
 338 
 339     // These work on values in the C heap.
 340 
 341     /**
 342      * Fetches a value from a given memory address.  If the address is zero, or
 343      * does not point into a block obtained from {@link #allocateMemory}, the
 344      * results are undefined.
 345      *
 346      * @see #allocateMemory
 347      */
 348     @ForceInline
 349     public byte getByte(long address) {
 350         return getByte(null, address);
 351     }
 352 
 353     /**
 354      * Stores a value into a given memory address.  If the address is zero, or
 355      * does not point into a block obtained from {@link #allocateMemory}, the
 356      * results are undefined.
 357      *
 358      * @see #getByte(long)




 301     @ForceInline
 302     public void putAddress(Object o, long offset, long x) {
 303         if (ADDRESS_SIZE == 4) {
 304             putInt(o, offset, (int)x);
 305         } else {
 306             putLong(o, offset, x);
 307         }
 308     }
 309 
 310     // These read VM internal data.
 311 
 312     /**
 313      * Fetches an uncompressed reference value from a given native variable
 314      * ignoring the VM's compressed references mode.
 315      *
 316      * @param address a memory address locating the variable
 317      * @return the value fetched from the indicated native variable
 318      */
 319     public native Object getUncompressedObject(long address);
 320 


















 321     // These work on values in the C heap.
 322 
 323     /**
 324      * Fetches a value from a given memory address.  If the address is zero, or
 325      * does not point into a block obtained from {@link #allocateMemory}, the
 326      * results are undefined.
 327      *
 328      * @see #allocateMemory
 329      */
 330     @ForceInline
 331     public byte getByte(long address) {
 332         return getByte(null, address);
 333     }
 334 
 335     /**
 336      * Stores a value into a given memory address.  If the address is zero, or
 337      * does not point into a block obtained from {@link #allocateMemory}, the
 338      * results are undefined.
 339      *
 340      * @see #getByte(long)


< prev index next >