109 } 110 return res; 111 } 112 113 template<bool external_guard> 114 oop JNIHandles::resolve_jweak(jweak handle) { 115 assert(is_jweak(handle), "precondition"); 116 oop result = jweak_ref(handle); 117 result = guard_value<external_guard>(result); 118 #if INCLUDE_ALL_GCS 119 if (result != NULL && UseG1GC) { 120 G1SATBCardTableModRefBS::enqueue(result); 121 } 122 #endif // INCLUDE_ALL_GCS 123 return result; 124 } 125 126 template oop JNIHandles::resolve_jweak<true>(jweak); 127 template oop JNIHandles::resolve_jweak<false>(jweak); 128 129 void JNIHandles::destroy_global(jobject handle) { 130 if (handle != NULL) { 131 assert(is_global_handle(handle), "Invalid delete of global JNI handle"); 132 jobject_ref(handle) = deleted_handle(); 133 } 134 } 135 136 137 void JNIHandles::destroy_weak_global(jobject handle) { 138 if (handle != NULL) { 139 jweak_ref(handle) = deleted_handle(); 140 } 141 } 142 143 144 void JNIHandles::oops_do(OopClosure* f) { 145 f->do_oop(&_deleted_handle); 146 _global_handles->oops_do(f); 147 } 148 | 109 } 110 return res; 111 } 112 113 template<bool external_guard> 114 oop JNIHandles::resolve_jweak(jweak handle) { 115 assert(is_jweak(handle), "precondition"); 116 oop result = jweak_ref(handle); 117 result = guard_value<external_guard>(result); 118 #if INCLUDE_ALL_GCS 119 if (result != NULL && UseG1GC) { 120 G1SATBCardTableModRefBS::enqueue(result); 121 } 122 #endif // INCLUDE_ALL_GCS 123 return result; 124 } 125 126 template oop JNIHandles::resolve_jweak<true>(jweak); 127 template oop JNIHandles::resolve_jweak<false>(jweak); 128 129 bool JNIHandles::is_global_weak_cleared(jweak handle) { 130 assert(is_jweak(handle), "not a weak handle"); 131 return guard_value<false>(jweak_ref(handle)) == NULL; 132 } 133 134 void JNIHandles::destroy_global(jobject handle) { 135 if (handle != NULL) { 136 assert(is_global_handle(handle), "Invalid delete of global JNI handle"); 137 jobject_ref(handle) = deleted_handle(); 138 } 139 } 140 141 142 void JNIHandles::destroy_weak_global(jobject handle) { 143 if (handle != NULL) { 144 jweak_ref(handle) = deleted_handle(); 145 } 146 } 147 148 149 void JNIHandles::oops_do(OopClosure* f) { 150 f->do_oop(&_deleted_handle); 151 _global_handles->oops_do(f); 152 } 153 |