Mercurial > hg > graal-jvmci-8
comparison src/share/vm/graal/graalRuntime.cpp @ 18043:f55f2d400797
Fix some format strings
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Wed, 15 Oct 2014 20:34:55 +0200 |
parents | 57b6965524a2 |
children | bcb1e5c232d8 |
comparison
equal
deleted
inserted
replaced
18042:3498d73280c8 | 18043:f55f2d400797 |
---|---|
353 // debugging support | 353 // debugging support |
354 // tracing | 354 // tracing |
355 if (TraceExceptions) { | 355 if (TraceExceptions) { |
356 ttyLocker ttyl; | 356 ttyLocker ttyl; |
357 ResourceMark rm; | 357 ResourceMark rm; |
358 int offset = pc - nm->code_begin(); | 358 tty->print_cr("Exception <%s> (" INTPTR_FORMAT ") thrown in compiled method <%s> at PC " INTPTR_FORMAT " for thread " INTPTR_FORMAT "", |
359 tty->print_cr("Exception <%s> (0x%x) thrown in compiled method <%s> at PC " PTR_FORMAT " [" PTR_FORMAT "+%d] for thread 0x%x", | 359 exception->print_value_string(), p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread)); |
360 exception->print_value_string(), (address)exception(), nm->method()->print_value_string(), pc, nm->code_begin(), offset, thread); | |
361 } | 360 } |
362 // for AbortVMOnException flag | 361 // for AbortVMOnException flag |
363 NOT_PRODUCT(Exceptions::debug_check_abort(exception)); | 362 NOT_PRODUCT(Exceptions::debug_check_abort(exception)); |
364 | 363 |
365 // Clear out the exception oop and pc since looking up an | 364 // Clear out the exception oop and pc since looking up an |
366 // exception handler can cause class loading, which might throw an | 365 // exception handler can cause class loading, which might throw an |
367 // exception and those fields are expected to be clear during | 366 // exception and those fields are expected to be clear during |
368 // normal bytecode execution. | 367 // normal bytecode execution. |
369 thread->set_exception_oop(NULL); | 368 thread->clear_exception_oop_and_pc(); |
370 thread->set_exception_pc(NULL); | |
371 | 369 |
372 continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false); | 370 continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false); |
373 // If an exception was thrown during exception dispatch, the exception oop may have changed | 371 // If an exception was thrown during exception dispatch, the exception oop may have changed |
374 thread->set_exception_oop(exception()); | 372 thread->set_exception_oop(exception()); |
375 thread->set_exception_pc(pc); | 373 thread->set_exception_pc(pc); |
385 | 383 |
386 if (TraceExceptions) { | 384 if (TraceExceptions) { |
387 ttyLocker ttyl; | 385 ttyLocker ttyl; |
388 ResourceMark rm; | 386 ResourceMark rm; |
389 tty->print_cr("Thread " PTR_FORMAT " continuing at PC " PTR_FORMAT " for exception thrown at PC " PTR_FORMAT, | 387 tty->print_cr("Thread " PTR_FORMAT " continuing at PC " PTR_FORMAT " for exception thrown at PC " PTR_FORMAT, |
390 thread, continuation, pc); | 388 p2i(thread), p2i(continuation), p2i(pc)); |
391 } | 389 } |
392 | 390 |
393 return continuation; | 391 return continuation; |
394 JRT_END | 392 JRT_END |
395 | 393 |
439 JRT_ENTRY_NO_ASYNC(void, GraalRuntime::monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock)) | 437 JRT_ENTRY_NO_ASYNC(void, GraalRuntime::monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock)) |
440 if (TraceGraal >= 3) { | 438 if (TraceGraal >= 3) { |
441 char type[O_BUFLEN]; | 439 char type[O_BUFLEN]; |
442 obj->klass()->name()->as_C_string(type, O_BUFLEN); | 440 obj->klass()->name()->as_C_string(type, O_BUFLEN); |
443 markOop mark = obj->mark(); | 441 markOop mark = obj->mark(); |
444 tty->print_cr("%s: entered locking slow case with obj=" INTPTR_FORMAT ", type=%s, mark=" INTPTR_FORMAT ", lock=" INTPTR_FORMAT, thread->name(), obj, type, mark, lock); | 442 tty->print_cr("%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)); |
445 tty->flush(); | 443 tty->flush(); |
446 } | 444 } |
447 #ifdef ASSERT | 445 #ifdef ASSERT |
448 if (PrintBiasedLockingStatistics) { | 446 if (PrintBiasedLockingStatistics) { |
449 Atomic::inc(BiasedLocking::slow_path_entry_count_addr()); | 447 Atomic::inc(BiasedLocking::slow_path_entry_count_addr()); |
461 } else { | 459 } else { |
462 ObjectSynchronizer::fast_enter(h_obj, lock, false, THREAD); | 460 ObjectSynchronizer::fast_enter(h_obj, lock, false, THREAD); |
463 } | 461 } |
464 } | 462 } |
465 if (TraceGraal >= 3) { | 463 if (TraceGraal >= 3) { |
466 tty->print_cr("%s: exiting locking slow with obj=" INTPTR_FORMAT, thread->name(), obj); | 464 tty->print_cr("%s: exiting locking slow with obj=" INTPTR_FORMAT, thread->name(), p2i(obj)); |
467 } | 465 } |
468 JRT_END | 466 JRT_END |
469 | 467 |
470 JRT_LEAF(void, GraalRuntime::monitorexit(JavaThread* thread, oopDesc* obj, BasicLock* lock)) | 468 JRT_LEAF(void, GraalRuntime::monitorexit(JavaThread* thread, oopDesc* obj, BasicLock* lock)) |
471 assert(thread == JavaThread::current(), "threads must correspond"); | 469 assert(thread == JavaThread::current(), "threads must correspond"); |
476 #ifdef DEBUG | 474 #ifdef DEBUG |
477 if (!obj->is_oop()) { | 475 if (!obj->is_oop()) { |
478 ResetNoHandleMark rhm; | 476 ResetNoHandleMark rhm; |
479 nmethod* method = thread->last_frame().cb()->as_nmethod_or_null(); | 477 nmethod* method = thread->last_frame().cb()->as_nmethod_or_null(); |
480 if (method != NULL) { | 478 if (method != NULL) { |
481 tty->print_cr("ERROR in monitorexit in method %s wrong obj " INTPTR_FORMAT, method->name(), obj); | 479 tty->print_cr("ERROR in monitorexit in method %s wrong obj " INTPTR_FORMAT, method->name(), p2i(obj)); |
482 } | 480 } |
483 thread->print_stack_on(tty); | 481 thread->print_stack_on(tty); |
484 assert(false, "invalid lock object pointer dected"); | 482 assert(false, "invalid lock object pointer dected"); |
485 } | 483 } |
486 #endif | 484 #endif |
492 ObjectSynchronizer::fast_exit(obj, lock, THREAD); | 490 ObjectSynchronizer::fast_exit(obj, lock, THREAD); |
493 } | 491 } |
494 if (TraceGraal >= 3) { | 492 if (TraceGraal >= 3) { |
495 char type[O_BUFLEN]; | 493 char type[O_BUFLEN]; |
496 obj->klass()->name()->as_C_string(type, O_BUFLEN); | 494 obj->klass()->name()->as_C_string(type, O_BUFLEN); |
497 tty->print_cr("%s: exited locking slow case with obj=" INTPTR_FORMAT ", type=%s, mark=" INTPTR_FORMAT ", lock=" INTPTR_FORMAT, thread->name(), obj, type, obj->mark(), lock); | 495 tty->print_cr("%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)); |
498 tty->flush(); | 496 tty->flush(); |
499 } | 497 } |
500 JRT_END | 498 JRT_END |
501 | 499 |
502 JRT_LEAF(void, GraalRuntime::log_object(JavaThread* thread, oopDesc* obj, jint flags)) | 500 JRT_LEAF(void, GraalRuntime::log_object(JavaThread* thread, oopDesc* obj, jint flags)) |
504 bool addr = mask_bits_are_true(flags, LOG_OBJECT_ADDRESS); | 502 bool addr = mask_bits_are_true(flags, LOG_OBJECT_ADDRESS); |
505 bool newline = mask_bits_are_true(flags, LOG_OBJECT_NEWLINE); | 503 bool newline = mask_bits_are_true(flags, LOG_OBJECT_NEWLINE); |
506 if (!string) { | 504 if (!string) { |
507 if (!addr && obj->is_oop_or_null(true)) { | 505 if (!addr && obj->is_oop_or_null(true)) { |
508 char buf[O_BUFLEN]; | 506 char buf[O_BUFLEN]; |
509 tty->print("%s@%p", obj->klass()->name()->as_C_string(buf, O_BUFLEN), (address)obj); | 507 tty->print("%s@" INTPTR_FORMAT, obj->klass()->name()->as_C_string(buf, O_BUFLEN), p2i(obj)); |
510 } else { | 508 } else { |
511 tty->print("%p", (address)obj); | 509 tty->print(INTPTR_FORMAT, p2i(obj)); |
512 } | 510 } |
513 } else { | 511 } else { |
514 ResourceMark rm; | 512 ResourceMark rm; |
515 assert(obj != NULL && java_lang_String::is_instance(obj), "must be"); | 513 assert(obj != NULL && java_lang_String::is_instance(obj), "must be"); |
516 char *buf = java_lang_String::as_utf8_string(obj); | 514 char *buf = java_lang_String::as_utf8_string(obj); |
517 tty->print(buf); | 515 tty->print_raw(buf); |
518 } | 516 } |
519 if (newline) { | 517 if (newline) { |
520 tty->cr(); | 518 tty->cr(); |
521 } | 519 } |
522 JRT_END | 520 JRT_END |
530 JRT_END | 528 JRT_END |
531 | 529 |
532 JRT_LEAF(jboolean, GraalRuntime::validate_object(JavaThread* thread, oopDesc* parent, oopDesc* child)) | 530 JRT_LEAF(jboolean, GraalRuntime::validate_object(JavaThread* thread, oopDesc* parent, oopDesc* child)) |
533 bool ret = true; | 531 bool ret = true; |
534 if(!Universe::heap()->is_in_closed_subset(parent)) { | 532 if(!Universe::heap()->is_in_closed_subset(parent)) { |
535 tty->print_cr("Parent Object "INTPTR_FORMAT" not in heap", parent); | 533 tty->print_cr("Parent Object "INTPTR_FORMAT" not in heap", p2i(parent)); |
536 parent->print(); | 534 parent->print(); |
537 ret=false; | 535 ret=false; |
538 } | 536 } |
539 if(!Universe::heap()->is_in_closed_subset(child)) { | 537 if(!Universe::heap()->is_in_closed_subset(child)) { |
540 tty->print_cr("Child Object "INTPTR_FORMAT" not in heap", child); | 538 tty->print_cr("Child Object "INTPTR_FORMAT" not in heap", p2i(child)); |
541 child->print(); | 539 child->print(); |
542 ret=false; | 540 ret=false; |
543 } | 541 } |
544 return (jint)ret; | 542 return (jint)ret; |
545 JRT_END | 543 JRT_END |
577 void* p = (void *)(address) v; | 575 void* p = (void *)(address) v; |
578 CodeBlob* cb = CodeCache::find_blob(p); | 576 CodeBlob* cb = CodeCache::find_blob(p); |
579 if (cb) { | 577 if (cb) { |
580 if (cb->is_nmethod()) { | 578 if (cb->is_nmethod()) { |
581 char buf[O_BUFLEN]; | 579 char buf[O_BUFLEN]; |
582 tty->print("%s [%p+%d]", cb->as_nmethod_or_null()->method()->name_and_sig_as_C_string(buf, O_BUFLEN), cb->code_begin(), (address)v - cb->code_begin()); | 580 tty->print("%s [" INTPTR_FORMAT "+" JLONG_FORMAT "]", cb->as_nmethod_or_null()->method()->name_and_sig_as_C_string(buf, O_BUFLEN), p2i(cb->code_begin()), (jlong)((address)v - cb->code_begin())); |
583 return; | 581 return; |
584 } | 582 } |
585 cb->print_value_on(tty); | 583 cb->print_value_on(tty); |
586 return; | 584 return; |
587 } | 585 } |
588 if (Universe::heap()->is_in(p)) { | 586 if (Universe::heap()->is_in(p)) { |
589 oop obj = oop(p); | 587 oop obj = oop(p); |
590 obj->print_value_on(tty); | 588 obj->print_value_on(tty); |
591 return; | 589 return; |
592 } | 590 } |
593 tty->print("%p [long: %d, double %f, char %c]", v, v, v, v); | 591 tty->print(INTPTR_FORMAT " [long: " JLONG_FORMAT ", double %lf, char %c]",p2i((void *)v), (jlong)v, (jdouble)v, (char)v); |
594 } | 592 } |
595 } | 593 } |
596 | 594 |
597 JRT_LEAF(void, GraalRuntime::vm_message(jboolean vmError, jlong format, jlong v1, jlong v2, jlong v3)) | 595 JRT_LEAF(void, GraalRuntime::vm_message(jboolean vmError, jlong format, jlong v1, jlong v2, jlong v3)) |
598 ResourceMark rm; | 596 ResourceMark rm; |
848 char* buffer = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, st.st_size); | 846 char* buffer = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, st.st_size); |
849 int num_read = (int) os::read(file_handle, (char*) buffer, st.st_size); | 847 int num_read = (int) os::read(file_handle, (char*) buffer, st.st_size); |
850 if (num_read == -1) { | 848 if (num_read == -1) { |
851 warning("Error reading file %s due to %s", path, strerror(errno)); | 849 warning("Error reading file %s due to %s", path, strerror(errno)); |
852 } else if (num_read != st.st_size) { | 850 } else if (num_read != st.st_size) { |
853 warning("Only read %d of %d bytes from %s", num_read, st.st_size, path); | 851 warning("Only read %d of " SIZE_FORMAT " bytes from %s", num_read, st.st_size, path); |
854 } | 852 } |
855 os::close(file_handle); | 853 os::close(file_handle); |
856 if (num_read == st.st_size) { | 854 if (num_read == st.st_size) { |
857 char* line = buffer; | 855 char* line = buffer; |
858 int lineNo = 1; | 856 int lineNo = 1; |
1024 } | 1022 } |
1025 | 1023 |
1026 void GraalRuntime::abort_on_pending_exception(Handle exception, const char* message, bool dump_core) { | 1024 void GraalRuntime::abort_on_pending_exception(Handle exception, const char* message, bool dump_core) { |
1027 Thread* THREAD = Thread::current(); | 1025 Thread* THREAD = Thread::current(); |
1028 CLEAR_PENDING_EXCEPTION; | 1026 CLEAR_PENDING_EXCEPTION; |
1029 tty->print_cr(message); | 1027 tty->print_raw_cr(message); |
1030 call_printStackTrace(exception, THREAD); | 1028 call_printStackTrace(exception, THREAD); |
1031 | 1029 |
1032 // Give other aborting threads to also print their stack traces. | 1030 // Give other aborting threads to also print their stack traces. |
1033 // This can be very useful when debugging class initialization | 1031 // This can be very useful when debugging class initialization |
1034 // failures. | 1032 // failures. |