hotspot/src/share/vm/runtime/jniHandles.cpp
changeset 5896 c60924a89622
parent 5547 f4b087cbb361
child 7397 5b173b4ca846
equal deleted inserted replaced
5895:7127e98012e3 5896:c60924a89622
    64   }
    64   }
    65 }
    65 }
    66 
    66 
    67 
    67 
    68 jobject JNIHandles::make_global(Handle obj) {
    68 jobject JNIHandles::make_global(Handle obj) {
       
    69   assert(!Universe::heap()->is_gc_active(), "can't extend the root set during GC");
    69   jobject res = NULL;
    70   jobject res = NULL;
    70   if (!obj.is_null()) {
    71   if (!obj.is_null()) {
    71     // ignore null handles
    72     // ignore null handles
    72     MutexLocker ml(JNIGlobalHandle_lock);
    73     MutexLocker ml(JNIGlobalHandle_lock);
    73     assert(Universe::heap()->is_in_reserved(obj()), "sanity check");
    74     assert(Universe::heap()->is_in_reserved(obj()), "sanity check");
    79   return res;
    80   return res;
    80 }
    81 }
    81 
    82 
    82 
    83 
    83 jobject JNIHandles::make_weak_global(Handle obj) {
    84 jobject JNIHandles::make_weak_global(Handle obj) {
       
    85   assert(!Universe::heap()->is_gc_active(), "can't extend the root set during GC");
    84   jobject res = NULL;
    86   jobject res = NULL;
    85   if (!obj.is_null()) {
    87   if (!obj.is_null()) {
    86     // ignore null handles
    88     // ignore null handles
    87     MutexLocker ml(JNIGlobalHandle_lock);
    89     MutexLocker ml(JNIGlobalHandle_lock);
    88     assert(Universe::heap()->is_in_reserved(obj()), "sanity check");
    90     assert(Universe::heap()->is_in_reserved(obj()), "sanity check");