1674 _reserved_stack_activation = NULL; // stack base not known yet
1675 (void)const_cast<oop&>(_exception_oop = oop(NULL));
1676 _exception_pc = 0;
1677 _exception_handler_pc = 0;
1678 _is_method_handle_return = 0;
1679 _jvmti_thread_state= NULL;
1680 _should_post_on_exceptions_flag = JNI_FALSE;
1681 _interp_only_mode = 0;
1682 _special_runtime_exit_condition = _no_async_condition;
1683 _pending_async_exception = NULL;
1684 _thread_stat = NULL;
1685 _thread_stat = new ThreadStatistics();
1686 _jni_active_critical = 0;
1687 _pending_jni_exception_check_fn = NULL;
1688 _do_not_unlock_if_synchronized = false;
1689 _cached_monitor_info = NULL;
1690 _parker = Parker::Allocate(this);
1691 _SleepEvent = ParkEvent::Allocate(this);
1692 // Setup safepoint state info for this thread
1693 ThreadSafepointState::create(this);
1694
1695 debug_only(_java_call_counter = 0);
1696
1697 // JVMTI PopFrame support
1698 _popframe_condition = popframe_inactive;
1699 _popframe_preserved_args = NULL;
1700 _popframe_preserved_args_size = 0;
1701 _frames_to_pop_failed_realloc = 0;
1702
1703 SafepointMechanism::initialize_header(this);
1704
1705 _class_to_be_initialized = NULL;
1706
1707 pd_initialize();
1708 }
1709
1710 JavaThread::JavaThread(bool is_attaching_via_jni) :
1711 Thread() {
1712 initialize();
1713 if (is_attaching_via_jni) {
4449 // will be stopped at native=>Java/VM barriers. Note that we can't
4450 // simply kill or suspend them, as it is inherently deadlock-prone.
4451
4452 VM_Exit::set_vm_exited();
4453
4454 // Clean up ideal graph printers after the VMThread has started
4455 // the final safepoint which will block all the Compiler threads.
4456 // Note that this Thread has already logically exited so the
4457 // clean_up() function's use of a JavaThreadIteratorWithHandle
4458 // would be a problem except set_vm_exited() has remembered the
4459 // shutdown thread which is granted a policy exception.
4460 #if defined(COMPILER2) && !defined(PRODUCT)
4461 IdealGraphPrinter::clean_up();
4462 #endif
4463
4464 notify_vm_shutdown();
4465
4466 // exit_globals() will delete tty
4467 exit_globals();
4468
4469 // We are after VM_Exit::set_vm_exited() so we can't call
4470 // thread->smr_delete() or we will block on the Threads_lock.
4471 // Deleting the shutdown thread here is safe because another
4472 // JavaThread cannot have an active ThreadsListHandle for
4473 // this JavaThread.
4474 delete thread;
4475
4476 #if INCLUDE_JVMCI
4477 if (JVMCICounterSize > 0) {
4478 FREE_C_HEAP_ARRAY(jlong, JavaThread::_jvmci_old_thread_counters);
4479 }
4480 #endif
4481
4482 LogConfiguration::finalize();
4483
4484 return true;
4485 }
4486
4487
4488 jboolean Threads::is_supported_jni_version_including_1_1(jint version) {
4489 if (version == JNI_VERSION_1_1) return JNI_TRUE;
4490 return is_supported_jni_version(version);
4491 }
4492
4493
4494 jboolean Threads::is_supported_jni_version(jint version) {
|
1674 _reserved_stack_activation = NULL; // stack base not known yet
1675 (void)const_cast<oop&>(_exception_oop = oop(NULL));
1676 _exception_pc = 0;
1677 _exception_handler_pc = 0;
1678 _is_method_handle_return = 0;
1679 _jvmti_thread_state= NULL;
1680 _should_post_on_exceptions_flag = JNI_FALSE;
1681 _interp_only_mode = 0;
1682 _special_runtime_exit_condition = _no_async_condition;
1683 _pending_async_exception = NULL;
1684 _thread_stat = NULL;
1685 _thread_stat = new ThreadStatistics();
1686 _jni_active_critical = 0;
1687 _pending_jni_exception_check_fn = NULL;
1688 _do_not_unlock_if_synchronized = false;
1689 _cached_monitor_info = NULL;
1690 _parker = Parker::Allocate(this);
1691 _SleepEvent = ParkEvent::Allocate(this);
1692 // Setup safepoint state info for this thread
1693 ThreadSafepointState::create(this);
1694 _handshake.set_thread(this);
1695
1696 debug_only(_java_call_counter = 0);
1697
1698 // JVMTI PopFrame support
1699 _popframe_condition = popframe_inactive;
1700 _popframe_preserved_args = NULL;
1701 _popframe_preserved_args_size = 0;
1702 _frames_to_pop_failed_realloc = 0;
1703
1704 SafepointMechanism::initialize_header(this);
1705
1706 _class_to_be_initialized = NULL;
1707
1708 pd_initialize();
1709 }
1710
1711 JavaThread::JavaThread(bool is_attaching_via_jni) :
1712 Thread() {
1713 initialize();
1714 if (is_attaching_via_jni) {
4450 // will be stopped at native=>Java/VM barriers. Note that we can't
4451 // simply kill or suspend them, as it is inherently deadlock-prone.
4452
4453 VM_Exit::set_vm_exited();
4454
4455 // Clean up ideal graph printers after the VMThread has started
4456 // the final safepoint which will block all the Compiler threads.
4457 // Note that this Thread has already logically exited so the
4458 // clean_up() function's use of a JavaThreadIteratorWithHandle
4459 // would be a problem except set_vm_exited() has remembered the
4460 // shutdown thread which is granted a policy exception.
4461 #if defined(COMPILER2) && !defined(PRODUCT)
4462 IdealGraphPrinter::clean_up();
4463 #endif
4464
4465 notify_vm_shutdown();
4466
4467 // exit_globals() will delete tty
4468 exit_globals();
4469
4470 // We are here after VM_Exit::set_vm_exited() so we can't call
4471 // thread->smr_delete() or we will block on the Threads_lock.
4472 // We must check there are no active references to this thread
4473 // before attempting to delete it. A thread could be waiting
4474 // on _handshake_turn_sem trying to execute a direct handshake
4475 // with this thread.
4476 if (!ThreadsSMRSupport::is_a_protected_JavaThread_with_lock((JavaThread *) thread, true /* skiplock */)) {
4477 delete thread;
4478 } else {
4479 // Clear value for _thread_key in TLS to prevent, depending
4480 // on pthreads implementation, possible execution of
4481 // thread-specific destructor in infinite loop at thread
4482 // exit.
4483 Thread::clear_thread_current();
4484 }
4485
4486 #if INCLUDE_JVMCI
4487 if (JVMCICounterSize > 0) {
4488 FREE_C_HEAP_ARRAY(jlong, JavaThread::_jvmci_old_thread_counters);
4489 }
4490 #endif
4491
4492 LogConfiguration::finalize();
4493
4494 return true;
4495 }
4496
4497
4498 jboolean Threads::is_supported_jni_version_including_1_1(jint version) {
4499 if (version == JNI_VERSION_1_1) return JNI_TRUE;
4500 return is_supported_jni_version(version);
4501 }
4502
4503
4504 jboolean Threads::is_supported_jni_version(jint version) {
|