< prev index next >

src/share/vm/jvmci/jvmciRuntime.cpp

Print this page




 346   DEBUG_ONLY(ResetNoHandleMark rnhm);
 347   nmethod* nm = NULL;
 348   address continuation = NULL;
 349   {
 350     // Enter VM mode by calling the helper
 351     ResetNoHandleMark rnhm;
 352     continuation = exception_handler_for_pc_helper(thread, exception, pc, nm);
 353   }
 354   // Back in JAVA, use no oops DON'T safepoint
 355 
 356   // Now check to see if the compiled method we were called from is now deoptimized.
 357   // If so we must return to the deopt blob and deoptimize the nmethod
 358   if (nm != NULL && caller_is_deopted()) {
 359     continuation = SharedRuntime::deopt_blob()->unpack_with_exception_in_tls();
 360   }
 361 
 362   assert(continuation != NULL, "no handler found");
 363   return continuation;
 364 }
 365 
 366 JRT_ENTRY(void, JVMCIRuntime::create_null_exception(JavaThread* thread))
 367   SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_NullPointerException());
 368   thread->set_vm_result(PENDING_EXCEPTION);
 369   CLEAR_PENDING_EXCEPTION;
 370 JRT_END
 371 
 372 JRT_ENTRY(void, JVMCIRuntime::create_out_of_bounds_exception(JavaThread* thread, jint index))
 373   char message[jintAsStringSize];
 374   sprintf(message, "%d", index);
 375   SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message);
 376   thread->set_vm_result(PENDING_EXCEPTION);
 377   CLEAR_PENDING_EXCEPTION;
 378 JRT_END
 379 
 380 JRT_ENTRY_NO_ASYNC(void, JVMCIRuntime::monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock))
 381   IF_TRACE_jvmci_3 {
 382     char type[O_BUFLEN];
 383     obj->klass()->name()->as_C_string(type, O_BUFLEN);
 384     markOop mark = obj->mark();
 385     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, p2i(mark), p2i(lock));
 386     tty->flush();
 387   }
 388 #ifdef ASSERT
 389   if (PrintBiasedLockingStatistics) {
 390     Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
 391   }
 392 #endif
 393   Handle h_obj(thread, obj);
 394   assert(h_obj()->is_oop(), "must be NULL or an object");
 395   if (UseBiasedLocking) {
 396     // Retry fast entry if bias is revoked to avoid unnecessary inflation
 397     ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK);
 398   } else {
 399     if (JVMCIUseFastLocking) {


 419     if (method != NULL) {
 420       tty->print_cr("ERROR in monitorexit in method %s wrong obj " INTPTR_FORMAT, method->name(), p2i(obj));
 421     }
 422     thread->print_stack_on(tty);
 423     assert(false, "invalid lock object pointer dected");
 424   }
 425 #endif
 426 
 427   if (JVMCIUseFastLocking) {
 428     // When using fast locking, the compiled code has already tried the fast case
 429     ObjectSynchronizer::slow_exit(obj, lock, THREAD);
 430   } else {
 431     ObjectSynchronizer::fast_exit(obj, lock, THREAD);
 432   }
 433   IF_TRACE_jvmci_3 {
 434     char type[O_BUFLEN];
 435     obj->klass()->name()->as_C_string(type, O_BUFLEN);
 436     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, p2i(obj->mark()), p2i(lock));
 437     tty->flush();
 438   }















 439 JRT_END
 440 
 441 JRT_LEAF(void, JVMCIRuntime::log_object(JavaThread* thread, oopDesc* obj, bool as_string, bool newline))
 442   ttyLocker ttyl;
 443 
 444   if (obj == NULL) {
 445     tty->print("NULL");
 446   } else if (obj->is_oop_or_null(true) && (!as_string || !java_lang_String::is_instance(obj))) {
 447     if (obj->is_oop_or_null(true)) {
 448       char buf[O_BUFLEN];
 449       tty->print("%s@" INTPTR_FORMAT, obj->klass()->name()->as_C_string(buf, O_BUFLEN), p2i(obj));
 450     } else {
 451       tty->print(INTPTR_FORMAT, p2i(obj));
 452     }
 453   } else {
 454     ResourceMark rm;
 455     assert(obj != NULL && java_lang_String::is_instance(obj), "must be");
 456     char *buf = java_lang_String::as_utf8_string(obj);
 457     tty->print_raw(buf);
 458   }




 346   DEBUG_ONLY(ResetNoHandleMark rnhm);
 347   nmethod* nm = NULL;
 348   address continuation = NULL;
 349   {
 350     // Enter VM mode by calling the helper
 351     ResetNoHandleMark rnhm;
 352     continuation = exception_handler_for_pc_helper(thread, exception, pc, nm);
 353   }
 354   // Back in JAVA, use no oops DON'T safepoint
 355 
 356   // Now check to see if the compiled method we were called from is now deoptimized.
 357   // If so we must return to the deopt blob and deoptimize the nmethod
 358   if (nm != NULL && caller_is_deopted()) {
 359     continuation = SharedRuntime::deopt_blob()->unpack_with_exception_in_tls();
 360   }
 361 
 362   assert(continuation != NULL, "no handler found");
 363   return continuation;
 364 }
 365 














 366 JRT_ENTRY_NO_ASYNC(void, JVMCIRuntime::monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock))
 367   IF_TRACE_jvmci_3 {
 368     char type[O_BUFLEN];
 369     obj->klass()->name()->as_C_string(type, O_BUFLEN);
 370     markOop mark = obj->mark();
 371     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, p2i(mark), p2i(lock));
 372     tty->flush();
 373   }
 374 #ifdef ASSERT
 375   if (PrintBiasedLockingStatistics) {
 376     Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
 377   }
 378 #endif
 379   Handle h_obj(thread, obj);
 380   assert(h_obj()->is_oop(), "must be NULL or an object");
 381   if (UseBiasedLocking) {
 382     // Retry fast entry if bias is revoked to avoid unnecessary inflation
 383     ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK);
 384   } else {
 385     if (JVMCIUseFastLocking) {


 405     if (method != NULL) {
 406       tty->print_cr("ERROR in monitorexit in method %s wrong obj " INTPTR_FORMAT, method->name(), p2i(obj));
 407     }
 408     thread->print_stack_on(tty);
 409     assert(false, "invalid lock object pointer dected");
 410   }
 411 #endif
 412 
 413   if (JVMCIUseFastLocking) {
 414     // When using fast locking, the compiled code has already tried the fast case
 415     ObjectSynchronizer::slow_exit(obj, lock, THREAD);
 416   } else {
 417     ObjectSynchronizer::fast_exit(obj, lock, THREAD);
 418   }
 419   IF_TRACE_jvmci_3 {
 420     char type[O_BUFLEN];
 421     obj->klass()->name()->as_C_string(type, O_BUFLEN);
 422     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, p2i(obj->mark()), p2i(lock));
 423     tty->flush();
 424   }
 425 JRT_END
 426 
 427 JRT_ENTRY(void, JVMCIRuntime::throw_and_post_jvmti_exception(JavaThread* thread, Symbol* name, const char* message))
 428   SharedRuntime::throw_and_post_jvmti_exception(thread, name, message);
 429 JRT_END
 430 
 431 JRT_ENTRY(void, JVMCIRuntime::throw_klass_external_name_exception(JavaThread* thread, Symbol* exception, Klass* klass))
 432   ResourceMark rm(thread);
 433   SharedRuntime::throw_and_post_jvmti_exception(thread, exception, klass->external_name());
 434 JRT_END
 435 
 436 JRT_ENTRY(void, JVMCIRuntime::throw_class_cast_exception(JavaThread* thread, Symbol* exception, Klass* objKlass, Klass* targetKlass, const char* desc))
 437   ResourceMark rm(thread);
 438   const char* message = SharedRuntime::generate_class_cast_message(objKlass->external_name(), targetKlass->external_name(), desc);
 439   SharedRuntime::throw_and_post_jvmti_exception(thread, exception, message);
 440 JRT_END
 441 
 442 JRT_LEAF(void, JVMCIRuntime::log_object(JavaThread* thread, oopDesc* obj, bool as_string, bool newline))
 443   ttyLocker ttyl;
 444 
 445   if (obj == NULL) {
 446     tty->print("NULL");
 447   } else if (obj->is_oop_or_null(true) && (!as_string || !java_lang_String::is_instance(obj))) {
 448     if (obj->is_oop_or_null(true)) {
 449       char buf[O_BUFLEN];
 450       tty->print("%s@" INTPTR_FORMAT, obj->klass()->name()->as_C_string(buf, O_BUFLEN), p2i(obj));
 451     } else {
 452       tty->print(INTPTR_FORMAT, p2i(obj));
 453     }
 454   } else {
 455     ResourceMark rm;
 456     assert(obj != NULL && java_lang_String::is_instance(obj), "must be");
 457     char *buf = java_lang_String::as_utf8_string(obj);
 458     tty->print_raw(buf);
 459   }


< prev index next >