hotspot/src/share/vm/prims/unsafe.cpp
changeset 15482 470d0b0c09f1
parent 14832 61b025224ac9
child 16617 6235d2c7549f
equal deleted inserted replaced
15224:0f9e3436040d 15482:470d0b0c09f1
    22  *
    22  *
    23  */
    23  */
    24 
    24 
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
    26 #include "classfile/vmSymbols.hpp"
    26 #include "classfile/vmSymbols.hpp"
    27 #ifndef SERIALGC
    27 #include "utilities/macros.hpp"
       
    28 #if INCLUDE_ALL_GCS
    28 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
    29 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
    29 #endif // SERIALGC
    30 #endif // INCLUDE_ALL_GCS
    30 #include "memory/allocation.inline.hpp"
    31 #include "memory/allocation.inline.hpp"
    31 #include "prims/jni.h"
    32 #include "prims/jni.h"
    32 #include "prims/jvm.h"
    33 #include "prims/jvm.h"
    33 #include "runtime/globals.hpp"
    34 #include "runtime/globals.hpp"
    34 #include "runtime/interfaceSupport.hpp"
    35 #include "runtime/interfaceSupport.hpp"
   187 UNSAFE_ENTRY(jobject, Unsafe_GetObject140(JNIEnv *env, jobject unsafe, jobject obj, jint offset))
   188 UNSAFE_ENTRY(jobject, Unsafe_GetObject140(JNIEnv *env, jobject unsafe, jobject obj, jint offset))
   188   UnsafeWrapper("Unsafe_GetObject");
   189   UnsafeWrapper("Unsafe_GetObject");
   189   if (obj == NULL)  THROW_0(vmSymbols::java_lang_NullPointerException());
   190   if (obj == NULL)  THROW_0(vmSymbols::java_lang_NullPointerException());
   190   GET_OOP_FIELD(obj, offset, v)
   191   GET_OOP_FIELD(obj, offset, v)
   191   jobject ret = JNIHandles::make_local(env, v);
   192   jobject ret = JNIHandles::make_local(env, v);
   192 #ifndef SERIALGC
   193 #if INCLUDE_ALL_GCS
   193   // We could be accessing the referent field in a reference
   194   // We could be accessing the referent field in a reference
   194   // object. If G1 is enabled then we need to register a non-null
   195   // object. If G1 is enabled then we need to register a non-null
   195   // referent with the SATB barrier.
   196   // referent with the SATB barrier.
   196   if (UseG1GC) {
   197   if (UseG1GC) {
   197     bool needs_barrier = false;
   198     bool needs_barrier = false;
   210     if (needs_barrier) {
   211     if (needs_barrier) {
   211       oop referent = JNIHandles::resolve(ret);
   212       oop referent = JNIHandles::resolve(ret);
   212       G1SATBCardTableModRefBS::enqueue(referent);
   213       G1SATBCardTableModRefBS::enqueue(referent);
   213     }
   214     }
   214   }
   215   }
   215 #endif // SERIALGC
   216 #endif // INCLUDE_ALL_GCS
   216   return ret;
   217   return ret;
   217 UNSAFE_END
   218 UNSAFE_END
   218 
   219 
   219 UNSAFE_ENTRY(void, Unsafe_SetObject140(JNIEnv *env, jobject unsafe, jobject obj, jint offset, jobject x_h))
   220 UNSAFE_ENTRY(void, Unsafe_SetObject140(JNIEnv *env, jobject unsafe, jobject obj, jint offset, jobject x_h))
   220   UnsafeWrapper("Unsafe_SetObject");
   221   UnsafeWrapper("Unsafe_SetObject");
   245 // That is, it should be in the range [0, MAX_OBJECT_SIZE].
   246 // That is, it should be in the range [0, MAX_OBJECT_SIZE].
   246 UNSAFE_ENTRY(jobject, Unsafe_GetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset))
   247 UNSAFE_ENTRY(jobject, Unsafe_GetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset))
   247   UnsafeWrapper("Unsafe_GetObject");
   248   UnsafeWrapper("Unsafe_GetObject");
   248   GET_OOP_FIELD(obj, offset, v)
   249   GET_OOP_FIELD(obj, offset, v)
   249   jobject ret = JNIHandles::make_local(env, v);
   250   jobject ret = JNIHandles::make_local(env, v);
   250 #ifndef SERIALGC
   251 #if INCLUDE_ALL_GCS
   251   // We could be accessing the referent field in a reference
   252   // We could be accessing the referent field in a reference
   252   // object. If G1 is enabled then we need to register non-null
   253   // object. If G1 is enabled then we need to register non-null
   253   // referent with the SATB barrier.
   254   // referent with the SATB barrier.
   254   if (UseG1GC) {
   255   if (UseG1GC) {
   255     bool needs_barrier = false;
   256     bool needs_barrier = false;
   268     if (needs_barrier) {
   269     if (needs_barrier) {
   269       oop referent = JNIHandles::resolve(ret);
   270       oop referent = JNIHandles::resolve(ret);
   270       G1SATBCardTableModRefBS::enqueue(referent);
   271       G1SATBCardTableModRefBS::enqueue(referent);
   271     }
   272     }
   272   }
   273   }
   273 #endif // SERIALGC
   274 #endif // INCLUDE_ALL_GCS
   274   return ret;
   275   return ret;
   275 UNSAFE_END
   276 UNSAFE_END
   276 
   277 
   277 UNSAFE_ENTRY(void, Unsafe_SetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h))
   278 UNSAFE_ENTRY(void, Unsafe_SetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h))
   278   UnsafeWrapper("Unsafe_SetObject");
   279   UnsafeWrapper("Unsafe_SetObject");