Mercurial > hg > graal-jvmci-8
comparison src/share/vm/graal/graalRuntime.cpp @ 8506:c3657d00e343
-Merge with tip
author | Christos Kotselidis <christos.kotselidis@oracle.com> |
---|---|
date | Thu, 21 Mar 2013 14:11:13 +0100 |
parents | 86b4965f0c9a 3d41998c30de |
children | bb2447c64055 |
comparison
equal
deleted
inserted
replaced
8505:dee7c8b578c7 | 8506:c3657d00e343 |
---|---|
125 | 125 |
126 #ifdef ASSERT | 126 #ifdef ASSERT |
127 // Make sure that stubs that need oopmaps have them | 127 // Make sure that stubs that need oopmaps have them |
128 switch (id) { | 128 switch (id) { |
129 // These stubs don't need to have an oopmap | 129 // These stubs don't need to have an oopmap |
130 case graal_slow_subtype_check_id: | |
131 #if defined(SPARC) || defined(PPC) | 130 #if defined(SPARC) || defined(PPC) |
132 case graal_handle_exception_nofpu_id: // Unused on sparc | 131 case handle_exception_nofpu_id: // Unused on sparc |
133 #endif | 132 #endif |
134 case graal_verify_oop_id: | 133 case verify_oop_id: |
135 case graal_unwind_exception_call_id: | 134 case unwind_exception_call_id: |
136 case graal_OSR_migration_end_id: | 135 case OSR_migration_end_id: |
137 case graal_arithmetic_frem_id: | 136 case arithmetic_frem_id: |
138 case graal_arithmetic_drem_id: | 137 case arithmetic_drem_id: |
139 case graal_set_deopt_info_id: | 138 break; |
140 break; | |
141 | |
142 // All other stubs should have oopmaps | 139 // All other stubs should have oopmaps |
143 default: | 140 default: |
144 assert(oop_maps != NULL, "must have an oopmap"); | 141 assert(oop_maps != NULL, "must have an oopmap"); |
145 } | 142 } |
146 #endif | 143 #endif |
441 | 438 |
442 assert(continuation != NULL, "no handler found"); | 439 assert(continuation != NULL, "no handler found"); |
443 return continuation; | 440 return continuation; |
444 } | 441 } |
445 | 442 |
446 JRT_ENTRY(void, GraalRuntime::graal_create_null_exception(JavaThread* thread)) | 443 JRT_ENTRY(void, GraalRuntime::create_null_exception(JavaThread* thread)) |
447 thread->set_vm_result(Exceptions::new_exception(thread, vmSymbols::java_lang_NullPointerException(), NULL)()); | 444 thread->set_vm_result(Exceptions::new_exception(thread, vmSymbols::java_lang_NullPointerException(), NULL)()); |
448 JRT_END | 445 JRT_END |
449 | 446 |
450 JRT_ENTRY(void, GraalRuntime::graal_create_out_of_bounds_exception(JavaThread* thread, jint index)) | 447 JRT_ENTRY(void, GraalRuntime::create_out_of_bounds_exception(JavaThread* thread, jint index)) |
451 char message[jintAsStringSize]; | 448 char message[jintAsStringSize]; |
452 sprintf(message, "%d", index); | 449 sprintf(message, "%d", index); |
453 thread->set_vm_result(Exceptions::new_exception(thread, vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message)()); | 450 thread->set_vm_result(Exceptions::new_exception(thread, vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message)()); |
454 JRT_END | 451 JRT_END |
455 | 452 |
456 JRT_ENTRY_NO_ASYNC(void, GraalRuntime::graal_monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock)) | 453 JRT_ENTRY_NO_ASYNC(void, GraalRuntime::monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock)) |
457 if (TraceGraal >= 3) { | 454 if (TraceGraal >= 3) { |
458 char type[O_BUFLEN]; | 455 char type[O_BUFLEN]; |
459 obj->klass()->name()->as_C_string(type, O_BUFLEN); | 456 obj->klass()->name()->as_C_string(type, O_BUFLEN); |
460 markOop mark = obj->mark(); | 457 markOop mark = obj->mark(); |
461 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); | 458 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); |
482 if (TraceGraal >= 3) { | 479 if (TraceGraal >= 3) { |
483 tty->print_cr("%s: exiting locking slow with obj=" INTPTR_FORMAT, thread->name(), obj); | 480 tty->print_cr("%s: exiting locking slow with obj=" INTPTR_FORMAT, thread->name(), obj); |
484 } | 481 } |
485 JRT_END | 482 JRT_END |
486 | 483 |
487 JRT_LEAF(void, GraalRuntime::graal_wb_pre_call(JavaThread* thread, oopDesc* obj)) | 484 JRT_LEAF(void, GraalRuntime::wb_pre_call(JavaThread* thread, oopDesc* obj)) |
488 thread->satb_mark_queue().enqueue(obj); | 485 thread->satb_mark_queue().enqueue(obj); |
489 JRT_END | 486 JRT_END |
490 | 487 |
491 JRT_LEAF(void, GraalRuntime::graal_wb_post_call(JavaThread* thread, oopDesc* obj, void* card_addr)) | 488 JRT_LEAF(void, GraalRuntime::wb_post_call(JavaThread* thread, oopDesc* obj, void* card_addr)) |
492 thread->dirty_card_queue().enqueue(card_addr); | 489 thread->dirty_card_queue().enqueue(card_addr); |
493 JRT_END | 490 JRT_END |
494 | 491 |
495 JRT_LEAF(void, GraalRuntime::graal_monitorexit(JavaThread* thread, oopDesc* obj, BasicLock* lock)) | 492 JRT_LEAF(void, GraalRuntime::monitorexit(JavaThread* thread, oopDesc* obj, BasicLock* lock)) |
496 assert(thread == JavaThread::current(), "threads must correspond"); | 493 assert(thread == JavaThread::current(), "threads must correspond"); |
497 assert(thread->last_Java_sp(), "last_Java_sp must be set"); | 494 assert(thread->last_Java_sp(), "last_Java_sp must be set"); |
498 // monitorexit is non-blocking (leaf routine) => no exceptions can be thrown | 495 // monitorexit is non-blocking (leaf routine) => no exceptions can be thrown |
499 EXCEPTION_MARK; | 496 EXCEPTION_MARK; |
500 | 497 |
522 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); | 519 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); |
523 tty->flush(); | 520 tty->flush(); |
524 } | 521 } |
525 JRT_END | 522 JRT_END |
526 | 523 |
527 JRT_ENTRY(void, GraalRuntime::graal_log_object(JavaThread* thread, oop obj, jint flags)) | 524 JRT_ENTRY(void, GraalRuntime::log_object(JavaThread* thread, oop obj, jint flags)) |
528 bool string = mask_bits_are_true(flags, LOG_OBJECT_STRING); | 525 bool string = mask_bits_are_true(flags, LOG_OBJECT_STRING); |
529 bool address = mask_bits_are_true(flags, LOG_OBJECT_ADDRESS); | 526 bool address = mask_bits_are_true(flags, LOG_OBJECT_ADDRESS); |
530 bool newline = mask_bits_are_true(flags, LOG_OBJECT_NEWLINE); | 527 bool newline = mask_bits_are_true(flags, LOG_OBJECT_NEWLINE); |
531 if (!string) { | 528 if (!string) { |
532 if (!address && obj->is_oop_or_null(true)) { | 529 if (!address && obj->is_oop_or_null(true)) { |
544 if (newline) { | 541 if (newline) { |
545 tty->cr(); | 542 tty->cr(); |
546 } | 543 } |
547 JRT_END | 544 JRT_END |
548 | 545 |
549 JRT_ENTRY(void, GraalRuntime::graal_vm_error(JavaThread* thread, oop where, oop format, jlong value)) | 546 JRT_ENTRY(void, GraalRuntime::vm_error(JavaThread* thread, oop where, oop format, jlong value)) |
550 ResourceMark rm; | 547 ResourceMark rm; |
551 assert(where == NULL || java_lang_String::is_instance(where), "must be"); | 548 assert(where == NULL || java_lang_String::is_instance(where), "must be"); |
552 const char *error_msg = where == NULL ? "<internal Graal error>" : java_lang_String::as_utf8_string(where); | 549 const char *error_msg = where == NULL ? "<internal Graal error>" : java_lang_String::as_utf8_string(where); |
553 char *detail_msg = NULL; | 550 char *detail_msg = NULL; |
554 if (format != NULL) { | 551 if (format != NULL) { |
558 jio_snprintf(detail_msg, detail_msg_length, buf, value); | 555 jio_snprintf(detail_msg, detail_msg_length, buf, value); |
559 } | 556 } |
560 report_vm_error(__FILE__, __LINE__, error_msg, detail_msg); | 557 report_vm_error(__FILE__, __LINE__, error_msg, detail_msg); |
561 JRT_END | 558 JRT_END |
562 | 559 |
563 JRT_LEAF(void, GraalRuntime::graal_log_printf(JavaThread* thread, oop format, jlong v1, jlong v2, jlong v3)) | 560 |
561 JRT_LEAF(void, GraalRuntime::log_printf(JavaThread* thread, oop format, jlong v1, jlong v2, jlong v3)) | |
564 ResourceMark rm; | 562 ResourceMark rm; |
565 assert(format != NULL && java_lang_String::is_instance(format), "must be"); | 563 assert(format != NULL && java_lang_String::is_instance(format), "must be"); |
566 char *buf = java_lang_String::as_utf8_string(format); | 564 char *buf = java_lang_String::as_utf8_string(format); |
567 tty->print(buf, v1, v2, v3); | 565 tty->print(buf, v1, v2, v3); |
568 JRT_END | 566 JRT_END |
569 | 567 |
570 JRT_ENTRY(void, GraalRuntime::graal_log_primitive(JavaThread* thread, jchar typeChar, jlong value, jboolean newline)) | 568 JRT_ENTRY(void, GraalRuntime::log_primitive(JavaThread* thread, jchar typeChar, jlong value, jboolean newline)) |
571 union { | 569 union { |
572 jlong l; | 570 jlong l; |
573 jdouble d; | 571 jdouble d; |
574 jfloat f; | 572 jfloat f; |
575 } uu; | 573 } uu; |
588 if (newline) { | 586 if (newline) { |
589 tty->cr(); | 587 tty->cr(); |
590 } | 588 } |
591 JRT_END | 589 JRT_END |
592 | 590 |
593 JRT_ENTRY(jint, GraalRuntime::graal_identity_hash_code(JavaThread* thread, oop obj)) | 591 JRT_ENTRY(jint, GraalRuntime::identity_hash_code(JavaThread* thread, oop obj)) |
594 return (jint) obj->identity_hash(); | 592 return (jint) obj->identity_hash(); |
595 JRT_END | 593 JRT_END |
596 | 594 |
597 JRT_ENTRY(jboolean, GraalRuntime::graal_thread_is_interrupted(JavaThread* thread, oop receiver, jboolean clear_interrupted)) | 595 JRT_ENTRY(jboolean, GraalRuntime::thread_is_interrupted(JavaThread* thread, oop receiver, jboolean clear_interrupted)) |
598 // Ensure that the C++ Thread and OSThread structures aren't freed before we operate | 596 // Ensure that the C++ Thread and OSThread structures aren't freed before we operate |
599 Handle receiverHandle(thread, receiver); | 597 Handle receiverHandle(thread, receiver); |
600 MutexLockerEx ml(thread->threadObj() == receiver ? NULL : Threads_lock); | 598 MutexLockerEx ml(thread->threadObj() == receiver ? NULL : Threads_lock); |
601 JavaThread* receiverThread = java_lang_Thread::thread(receiverHandle()); | 599 JavaThread* receiverThread = java_lang_Thread::thread(receiverHandle()); |
602 return (jint) Thread::is_interrupted(receiverThread, clear_interrupted != 0); | 600 return (jint) Thread::is_interrupted(receiverThread, clear_interrupted != 0); |