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
331 // JNI weaks are handled concurrently in ZGC, so they can't be verified here
332 if (!UseZGC) {
333 weak_oops_do(&verify_handle);
334 }
335 }
336
337 // This method is implemented here to avoid circular includes between
338 // jniHandles.hpp and thread.hpp.
339 bool JNIHandles::current_thread_in_native() {
340 Thread* thread = Thread::current();
341 return (thread->is_Java_thread() &&
342 JavaThread::current()->thread_state() == _thread_in_native);
343 }
344
345
346 void jni_handles_init() {
347 JNIHandles::initialize();
348 }
349
350
351 int JNIHandleBlock::_blocks_allocated = 0;
352 JNIHandleBlock* JNIHandleBlock::_block_free_list = NULL;
353 #ifndef PRODUCT
354 JNIHandleBlock* JNIHandleBlock::_block_list = NULL;
|