< prev index next >

src/hotspot/share/runtime/jniHandles.cpp

Print this page




 310 
 311   st->print_cr("JNI global refs: " SIZE_FORMAT ", weak refs: " SIZE_FORMAT,
 312                global_handles()->allocation_count(),
 313                weak_global_handles()->allocation_count());
 314   st->cr();
 315   st->flush();
 316 }
 317 
 318 class VerifyJNIHandles: public OopClosure {
 319 public:
 320   virtual void do_oop(oop* root) {
 321     (*root)->verify();
 322   }
 323   virtual void do_oop(narrowOop* root) { ShouldNotReachHere(); }
 324 };
 325 
 326 void JNIHandles::verify() {
 327   VerifyJNIHandles verify_handle;
 328 
 329   oops_do(&verify_handle);
 330   weak_oops_do(&verify_handle);






 331 }
 332 
 333 // This method is implemented here to avoid circular includes between
 334 // jniHandles.hpp and thread.hpp.
 335 bool JNIHandles::current_thread_in_native() {
 336   Thread* thread = Thread::current();
 337   return (thread->is_Java_thread() &&
 338           JavaThread::current()->thread_state() == _thread_in_native);
 339 }
 340 
 341 
 342 void jni_handles_init() {
 343   JNIHandles::initialize();
 344 }
 345 
 346 
 347 int             JNIHandleBlock::_blocks_allocated     = 0;
 348 JNIHandleBlock* JNIHandleBlock::_block_free_list      = NULL;
 349 #ifndef PRODUCT
 350 JNIHandleBlock* JNIHandleBlock::_block_list           = NULL;




 310 
 311   st->print_cr("JNI global refs: " SIZE_FORMAT ", weak refs: " SIZE_FORMAT,
 312                global_handles()->allocation_count(),
 313                weak_global_handles()->allocation_count());
 314   st->cr();
 315   st->flush();
 316 }
 317 
 318 class VerifyJNIHandles: public OopClosure {
 319 public:
 320   virtual void do_oop(oop* root) {
 321     (*root)->verify();
 322   }
 323   virtual void do_oop(narrowOop* root) { ShouldNotReachHere(); }
 324 };
 325 
 326 void JNIHandles::verify() {
 327   VerifyJNIHandles verify_handle;
 328 
 329   oops_do(&verify_handle);
 330 #if INCLUDE_ZGC
 331   // In ZGC, JNI weaks are handled concurrently, so they can't be verified here
 332   if (!UseZGC)
 333 #endif
 334   {
 335     weak_oops_do(&verify_handle);
 336   }
 337 }
 338 
 339 // This method is implemented here to avoid circular includes between
 340 // jniHandles.hpp and thread.hpp.
 341 bool JNIHandles::current_thread_in_native() {
 342   Thread* thread = Thread::current();
 343   return (thread->is_Java_thread() &&
 344           JavaThread::current()->thread_state() == _thread_in_native);
 345 }
 346 
 347 
 348 void jni_handles_init() {
 349   JNIHandles::initialize();
 350 }
 351 
 352 
 353 int             JNIHandleBlock::_blocks_allocated     = 0;
 354 JNIHandleBlock* JNIHandleBlock::_block_free_list      = NULL;
 355 #ifndef PRODUCT
 356 JNIHandleBlock* JNIHandleBlock::_block_list           = NULL;


< prev index next >