< prev index next >

src/share/vm/runtime/jniHandles.hpp

Print this page




 158   // Checked JNI support
 159   void set_planned_capacity(size_t planned_capacity) { _planned_capacity = planned_capacity; }
 160   const size_t get_planned_capacity() { return _planned_capacity; }
 161   const size_t get_number_of_live_handles();
 162 
 163   // Debugging
 164   bool chain_contains(jobject handle) const;    // Does this block or following blocks contain handle
 165   bool contains(jobject handle) const;          // Does this block contain handle
 166   int length() const;                           // Length of chain starting with this block
 167   long memory_usage() const;
 168   #ifndef PRODUCT
 169   static bool any_contains(jobject handle);     // Does any block currently in use contain handle
 170   static void print_statistics();
 171   #endif
 172 };
 173 
 174 
 175 inline oop JNIHandles::resolve(jobject handle) {
 176   oop result = (handle == NULL ? (oop)NULL : *(oop*)handle);
 177   assert(result != NULL || (handle == NULL || !CheckJNICalls || is_weak_global_handle(handle)), "Invalid value read from jni handle");
 178   assert(result != badJNIHandle, "Pointing to zapped jni handle area");
 179   return result;
 180 };
 181 
 182 
 183 inline oop JNIHandles::resolve_external_guard(jobject handle) {
 184   if (handle == NULL) return NULL;
 185   oop result = *(oop*)handle;
 186   if (result == NULL || result == badJNIHandle) return NULL;
 187   return result;
 188 };
 189 
 190 
 191 inline oop JNIHandles::resolve_non_null(jobject handle) {
 192   assert(handle != NULL, "JNI handle should not be null");
 193   oop result = *(oop*)handle;
 194   assert(result != NULL, "Invalid value read from jni handle");
 195   assert(result != badJNIHandle, "Pointing to zapped jni handle area");
 196   // Don't let that private _deleted_handle object escape into the wild.
 197   assert(result != deleted_handle(), "Used a deleted global handle.");
 198   return result;
 199 };
 200 
 201 inline void JNIHandles::destroy_local(jobject handle) {
 202   if (handle != NULL) {
 203     *((oop*)handle) = deleted_handle(); // Mark the handle as deleted, allocate will reuse it
 204   }
 205 }
 206 
 207 #endif // SHARE_VM_RUNTIME_JNIHANDLES_HPP


 158   // Checked JNI support
 159   void set_planned_capacity(size_t planned_capacity) { _planned_capacity = planned_capacity; }
 160   const size_t get_planned_capacity() { return _planned_capacity; }
 161   const size_t get_number_of_live_handles();
 162 
 163   // Debugging
 164   bool chain_contains(jobject handle) const;    // Does this block or following blocks contain handle
 165   bool contains(jobject handle) const;          // Does this block contain handle
 166   int length() const;                           // Length of chain starting with this block
 167   long memory_usage() const;
 168   #ifndef PRODUCT
 169   static bool any_contains(jobject handle);     // Does any block currently in use contain handle
 170   static void print_statistics();
 171   #endif
 172 };
 173 
 174 
 175 inline oop JNIHandles::resolve(jobject handle) {
 176   oop result = (handle == NULL ? (oop)NULL : *(oop*)handle);
 177   assert(result != NULL || (handle == NULL || !CheckJNICalls || is_weak_global_handle(handle)), "Invalid value read from jni handle");
 178   assert(! oopDesc::unsafe_equals(result, badJNIHandle), "Pointing to zapped jni handle area");
 179   return result;
 180 };
 181 
 182 
 183 inline oop JNIHandles::resolve_external_guard(jobject handle) {
 184   if (handle == NULL) return NULL;
 185   oop result = *(oop*)handle;
 186   if (result == NULL || oopDesc::unsafe_equals(result, badJNIHandle)) return NULL;
 187   return result;
 188 };
 189 
 190 
 191 inline oop JNIHandles::resolve_non_null(jobject handle) {
 192   assert(handle != NULL, "JNI handle should not be null");
 193   oop result = *(oop*)handle;
 194   assert(result != NULL, "Invalid value read from jni handle");
 195   assert(! oopDesc::unsafe_equals(result, badJNIHandle), "Pointing to zapped jni handle area");
 196   // Don't let that private _deleted_handle object escape into the wild.
 197   assert(! oopDesc::equals(result, deleted_handle()), "Used a deleted global handle.");
 198   return result;
 199 };
 200 
 201 inline void JNIHandles::destroy_local(jobject handle) {
 202   if (handle != NULL) {
 203     *((oop*)handle) = deleted_handle(); // Mark the handle as deleted, allocate will reuse it
 204   }
 205 }
 206 
 207 #endif // SHARE_VM_RUNTIME_JNIHANDLES_HPP
< prev index next >