377 continuation = SharedRuntime::deopt_blob()->unpack_with_exception_in_tls(); 378 } 379 380 assert(continuation != NULL, "no handler found"); 381 return continuation; 382 } 383 384 JRT_ENTRY_NO_ASYNC(void, JVMCIRuntime::monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock)) 385 IF_TRACE_jvmci_3 { 386 char type[O_BUFLEN]; 387 obj->klass()->name()->as_C_string(type, O_BUFLEN); 388 markWord mark = obj->mark(); 389 TRACE_jvmci_3("%s: entered locking slow case with obj=" INTPTR_FORMAT ", type=%s, mark=" INTPTR_FORMAT ", lock=" INTPTR_FORMAT, thread->name(), p2i(obj), type, mark.value(), p2i(lock)); 390 tty->flush(); 391 } 392 if (PrintBiasedLockingStatistics) { 393 Atomic::inc(BiasedLocking::slow_path_entry_count_addr()); 394 } 395 Handle h_obj(thread, obj); 396 assert(oopDesc::is_oop(h_obj()), "must be NULL or an object"); 397 if (UseBiasedLocking) { 398 // Retry fast entry if bias is revoked to avoid unnecessary inflation 399 ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK); 400 } else { 401 if (JVMCIUseFastLocking) { 402 // When using fast locking, the compiled code has already tried the fast case 403 ObjectSynchronizer::slow_enter(h_obj, lock, THREAD); 404 } else { 405 ObjectSynchronizer::fast_enter(h_obj, lock, false, THREAD); 406 } 407 } 408 TRACE_jvmci_3("%s: exiting locking slow with obj=" INTPTR_FORMAT, thread->name(), p2i(obj)); 409 JRT_END 410 411 JRT_LEAF(void, JVMCIRuntime::monitorexit(JavaThread* thread, oopDesc* obj, BasicLock* lock)) 412 assert(thread == JavaThread::current(), "threads must correspond"); 413 assert(thread->last_Java_sp(), "last_Java_sp must be set"); 414 // monitorexit is non-blocking (leaf routine) => no exceptions can be thrown 415 EXCEPTION_MARK; 416 417 #ifdef ASSERT 418 if (!oopDesc::is_oop(obj)) { 419 ResetNoHandleMark rhm; 420 nmethod* method = thread->last_frame().cb()->as_nmethod_or_null(); 421 if (method != NULL) { 422 tty->print_cr("ERROR in monitorexit in method %s wrong obj " INTPTR_FORMAT, method->name(), p2i(obj)); 423 } 424 thread->print_stack_on(tty); 425 assert(false, "invalid lock object pointer dected"); 426 } 427 #endif 428 429 if (JVMCIUseFastLocking) { 430 // When using fast locking, the compiled code has already tried the fast case 431 ObjectSynchronizer::slow_exit(obj, lock, THREAD); 432 } else { 433 ObjectSynchronizer::fast_exit(obj, lock, THREAD); 434 } 435 IF_TRACE_jvmci_3 { 436 char type[O_BUFLEN]; 437 obj->klass()->name()->as_C_string(type, O_BUFLEN); 438 TRACE_jvmci_3("%s: exited locking slow case with obj=" INTPTR_FORMAT ", type=%s, mark=" INTPTR_FORMAT ", lock=" INTPTR_FORMAT, thread->name(), p2i(obj), type, obj->mark().value(), p2i(lock)); 439 tty->flush(); 440 } 441 JRT_END 442 443 // Object.notify() fast path, caller does slow path 444 JRT_LEAF(jboolean, JVMCIRuntime::object_notify(JavaThread *thread, oopDesc* obj)) 445 446 // Very few notify/notifyAll operations find any threads on the waitset, so 447 // the dominant fast-path is to simply return. 448 // Relatedly, it's critical that notify/notifyAll be fast in order to 449 // reduce lock hold times. 450 if (!SafepointSynchronize::is_synchronizing()) { 451 if (ObjectSynchronizer::quick_notify(obj, thread, false)) { 452 return true; 453 } 454 } | 377 continuation = SharedRuntime::deopt_blob()->unpack_with_exception_in_tls(); 378 } 379 380 assert(continuation != NULL, "no handler found"); 381 return continuation; 382 } 383 384 JRT_ENTRY_NO_ASYNC(void, JVMCIRuntime::monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock)) 385 IF_TRACE_jvmci_3 { 386 char type[O_BUFLEN]; 387 obj->klass()->name()->as_C_string(type, O_BUFLEN); 388 markWord mark = obj->mark(); 389 TRACE_jvmci_3("%s: entered locking slow case with obj=" INTPTR_FORMAT ", type=%s, mark=" INTPTR_FORMAT ", lock=" INTPTR_FORMAT, thread->name(), p2i(obj), type, mark.value(), p2i(lock)); 390 tty->flush(); 391 } 392 if (PrintBiasedLockingStatistics) { 393 Atomic::inc(BiasedLocking::slow_path_entry_count_addr()); 394 } 395 Handle h_obj(thread, obj); 396 assert(oopDesc::is_oop(h_obj()), "must be NULL or an object"); 397 ObjectSynchronizer::enter(h_obj, lock, THREAD); 398 TRACE_jvmci_3("%s: exiting locking slow with obj=" INTPTR_FORMAT, thread->name(), p2i(obj)); 399 JRT_END 400 401 JRT_LEAF(void, JVMCIRuntime::monitorexit(JavaThread* thread, oopDesc* obj, BasicLock* lock)) 402 assert(thread == JavaThread::current(), "threads must correspond"); 403 assert(thread->last_Java_sp(), "last_Java_sp must be set"); 404 // monitorexit is non-blocking (leaf routine) => no exceptions can be thrown 405 EXCEPTION_MARK; 406 407 #ifdef ASSERT 408 if (!oopDesc::is_oop(obj)) { 409 ResetNoHandleMark rhm; 410 nmethod* method = thread->last_frame().cb()->as_nmethod_or_null(); 411 if (method != NULL) { 412 tty->print_cr("ERROR in monitorexit in method %s wrong obj " INTPTR_FORMAT, method->name(), p2i(obj)); 413 } 414 thread->print_stack_on(tty); 415 assert(false, "invalid lock object pointer dected"); 416 } 417 #endif 418 419 ObjectSynchronizer::exit(obj, lock, THREAD); 420 IF_TRACE_jvmci_3 { 421 char type[O_BUFLEN]; 422 obj->klass()->name()->as_C_string(type, O_BUFLEN); 423 TRACE_jvmci_3("%s: exited locking slow case with obj=" INTPTR_FORMAT ", type=%s, mark=" INTPTR_FORMAT ", lock=" INTPTR_FORMAT, thread->name(), p2i(obj), type, obj->mark().value(), p2i(lock)); 424 tty->flush(); 425 } 426 JRT_END 427 428 // Object.notify() fast path, caller does slow path 429 JRT_LEAF(jboolean, JVMCIRuntime::object_notify(JavaThread *thread, oopDesc* obj)) 430 431 // Very few notify/notifyAll operations find any threads on the waitset, so 432 // the dominant fast-path is to simply return. 433 // Relatedly, it's critical that notify/notifyAll be fast in order to 434 // reduce lock hold times. 435 if (!SafepointSynchronize::is_synchronizing()) { 436 if (ObjectSynchronizer::quick_notify(obj, thread, false)) { 437 return true; 438 } 439 } |