Mercurial > hg > truffle
comparison src/share/vm/runtime/thread.cpp @ 7643:3ac7d10a6572
Merge with hsx25/hotspot.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Thu, 31 Jan 2013 15:42:25 +0100 |
parents | 729a79037bd5 f422634e5828 |
children | c6c72de0537e |
comparison
equal
deleted
inserted
replaced
7573:17b6a63fe7c2 | 7643:3ac7d10a6572 |
---|---|
1728 | 1728 |
1729 // For any new cleanup additions, please check to see if they need to be applied to | 1729 // For any new cleanup additions, please check to see if they need to be applied to |
1730 // cleanup_failed_attach_current_thread as well. | 1730 // cleanup_failed_attach_current_thread as well. |
1731 void JavaThread::exit(bool destroy_vm, ExitType exit_type) { | 1731 void JavaThread::exit(bool destroy_vm, ExitType exit_type) { |
1732 assert(this == JavaThread::current(), "thread consistency check"); | 1732 assert(this == JavaThread::current(), "thread consistency check"); |
1733 if (!InitializeJavaLangSystem) return; | |
1734 | 1733 |
1735 HandleMark hm(this); | 1734 HandleMark hm(this); |
1736 Handle uncaught_exception(this, this->pending_exception()); | 1735 Handle uncaught_exception(this, this->pending_exception()); |
1737 this->clear_pending_exception(); | 1736 this->clear_pending_exception(); |
1738 Handle threadObj(this, this->threadObj()); | 1737 Handle threadObj(this, this->threadObj()); |
3480 | 3479 |
3481 if (EagerXrunInit && Arguments::init_libraries_at_startup()) { | 3480 if (EagerXrunInit && Arguments::init_libraries_at_startup()) { |
3482 create_vm_init_libraries(); | 3481 create_vm_init_libraries(); |
3483 } | 3482 } |
3484 | 3483 |
3485 if (InitializeJavaLangString) { | 3484 initialize_class(vmSymbols::java_lang_String(), CHECK_0); |
3486 initialize_class(vmSymbols::java_lang_String(), CHECK_0); | |
3487 } else { | |
3488 warning("java.lang.String not initialized"); | |
3489 } | |
3490 | 3485 |
3491 if (AggressiveOpts) { | 3486 if (AggressiveOpts) { |
3492 { | 3487 { |
3493 // Forcibly initialize java/util/HashMap and mutate the private | 3488 // Forcibly initialize java/util/HashMap and mutate the private |
3494 // static final "frontCacheEnabled" field before we start creating instances | 3489 // static final "frontCacheEnabled" field before we start creating instances |
3525 } | 3520 } |
3526 } | 3521 } |
3527 } | 3522 } |
3528 | 3523 |
3529 // Initialize java_lang.System (needed before creating the thread) | 3524 // Initialize java_lang.System (needed before creating the thread) |
3530 if (InitializeJavaLangSystem) { | 3525 initialize_class(vmSymbols::java_lang_System(), CHECK_0); |
3531 initialize_class(vmSymbols::java_lang_System(), CHECK_0); | 3526 initialize_class(vmSymbols::java_lang_ThreadGroup(), CHECK_0); |
3532 initialize_class(vmSymbols::java_lang_ThreadGroup(), CHECK_0); | 3527 Handle thread_group = create_initial_thread_group(CHECK_0); |
3533 Handle thread_group = create_initial_thread_group(CHECK_0); | 3528 Universe::set_main_thread_group(thread_group()); |
3534 Universe::set_main_thread_group(thread_group()); | 3529 initialize_class(vmSymbols::java_lang_Thread(), CHECK_0); |
3535 initialize_class(vmSymbols::java_lang_Thread(), CHECK_0); | 3530 oop thread_object = create_initial_thread(thread_group, main_thread, CHECK_0); |
3536 oop thread_object = create_initial_thread(thread_group, main_thread, CHECK_0); | 3531 main_thread->set_threadObj(thread_object); |
3537 main_thread->set_threadObj(thread_object); | 3532 // Set thread status to running since main thread has |
3538 // Set thread status to running since main thread has | 3533 // been started and running. |
3539 // been started and running. | 3534 java_lang_Thread::set_thread_status(thread_object, |
3540 java_lang_Thread::set_thread_status(thread_object, | 3535 java_lang_Thread::RUNNABLE); |
3541 java_lang_Thread::RUNNABLE); | 3536 |
3542 | 3537 // The VM creates & returns objects of this class. Make sure it's initialized. |
3543 // The VM creates & returns objects of this class. Make sure it's initialized. | 3538 initialize_class(vmSymbols::java_lang_Class(), CHECK_0); |
3544 initialize_class(vmSymbols::java_lang_Class(), CHECK_0); | 3539 |
3545 | 3540 // The VM preresolves methods to these classes. Make sure that they get initialized |
3546 // The VM preresolves methods to these classes. Make sure that they get initialized | 3541 initialize_class(vmSymbols::java_lang_reflect_Method(), CHECK_0); |
3547 initialize_class(vmSymbols::java_lang_reflect_Method(), CHECK_0); | 3542 initialize_class(vmSymbols::java_lang_ref_Finalizer(), CHECK_0); |
3548 initialize_class(vmSymbols::java_lang_ref_Finalizer(), CHECK_0); | 3543 call_initializeSystemClass(CHECK_0); |
3549 call_initializeSystemClass(CHECK_0); | 3544 |
3550 | 3545 // get the Java runtime name after java.lang.System is initialized |
3551 // get the Java runtime name after java.lang.System is initialized | 3546 JDK_Version::set_runtime_name(get_java_runtime_name(THREAD)); |
3552 JDK_Version::set_runtime_name(get_java_runtime_name(THREAD)); | 3547 JDK_Version::set_runtime_version(get_java_runtime_version(THREAD)); |
3553 JDK_Version::set_runtime_version(get_java_runtime_version(THREAD)); | |
3554 } else { | |
3555 warning("java.lang.System not initialized"); | |
3556 } | |
3557 | 3548 |
3558 // an instance of OutOfMemory exception has been allocated earlier | 3549 // an instance of OutOfMemory exception has been allocated earlier |
3559 if (InitializeJavaLangExceptionsErrors) { | 3550 initialize_class(vmSymbols::java_lang_OutOfMemoryError(), CHECK_0); |
3560 initialize_class(vmSymbols::java_lang_OutOfMemoryError(), CHECK_0); | 3551 initialize_class(vmSymbols::java_lang_NullPointerException(), CHECK_0); |
3561 initialize_class(vmSymbols::java_lang_NullPointerException(), CHECK_0); | 3552 initialize_class(vmSymbols::java_lang_ClassCastException(), CHECK_0); |
3562 initialize_class(vmSymbols::java_lang_ClassCastException(), CHECK_0); | 3553 initialize_class(vmSymbols::java_lang_ArrayStoreException(), CHECK_0); |
3563 initialize_class(vmSymbols::java_lang_ArrayStoreException(), CHECK_0); | 3554 initialize_class(vmSymbols::java_lang_ArithmeticException(), CHECK_0); |
3564 initialize_class(vmSymbols::java_lang_ArithmeticException(), CHECK_0); | 3555 initialize_class(vmSymbols::java_lang_StackOverflowError(), CHECK_0); |
3565 initialize_class(vmSymbols::java_lang_StackOverflowError(), CHECK_0); | 3556 initialize_class(vmSymbols::java_lang_IllegalMonitorStateException(), CHECK_0); |
3566 initialize_class(vmSymbols::java_lang_IllegalMonitorStateException(), CHECK_0); | 3557 initialize_class(vmSymbols::java_lang_IllegalArgumentException(), CHECK_0); |
3567 initialize_class(vmSymbols::java_lang_IllegalArgumentException(), CHECK_0); | |
3568 } else { | |
3569 warning("java.lang.OutOfMemoryError has not been initialized"); | |
3570 warning("java.lang.NullPointerException has not been initialized"); | |
3571 warning("java.lang.ClassCastException has not been initialized"); | |
3572 warning("java.lang.ArrayStoreException has not been initialized"); | |
3573 warning("java.lang.ArithmeticException has not been initialized"); | |
3574 warning("java.lang.StackOverflowError has not been initialized"); | |
3575 warning("java.lang.IllegalArgumentException has not been initialized"); | |
3576 } | |
3577 } | 3558 } |
3578 | 3559 |
3579 // See : bugid 4211085. | 3560 // See : bugid 4211085. |
3580 // Background : the static initializer of java.lang.Compiler tries to read | 3561 // Background : the static initializer of java.lang.Compiler tries to read |
3581 // property"java.compiler" and read & write property "java.vm.info". | 3562 // property"java.compiler" and read & write property "java.vm.info". |
4022 // | 4003 // |
4023 Threads_lock->wait(!Mutex::_no_safepoint_check_flag, 0, | 4004 Threads_lock->wait(!Mutex::_no_safepoint_check_flag, 0, |
4024 Mutex::_as_suspend_equivalent_flag); | 4005 Mutex::_as_suspend_equivalent_flag); |
4025 } | 4006 } |
4026 | 4007 |
4027 // Shutdown NMT before exit. Otherwise, | |
4028 // it will run into trouble when system destroys static variables. | |
4029 MemTracker::shutdown(MemTracker::NMT_normal); | |
4030 | |
4031 // Hang forever on exit if we are reporting an error. | 4008 // Hang forever on exit if we are reporting an error. |
4032 if (ShowMessageBoxOnError && is_error_reported()) { | 4009 if (ShowMessageBoxOnError && is_error_reported()) { |
4033 os::infinite_sleep(); | 4010 os::infinite_sleep(); |
4034 } | 4011 } |
4035 os::wait_for_keypress_at_exit(); | 4012 os::wait_for_keypress_at_exit(); |