Lines Matching defs:thread

110   assert(myThread->is_VM_thread(), "Only VM thread may execute a safepoint");
172 // When returning from the native code, a Java thread must check
174 // VM thread sees a Java thread in native, it does
175 // not wait for this thread to block. The order of the memory
179 // the VM thread issues a memory barrier instruction
181 // a memory barrier for each Java thread making native calls, each Java
182 // thread performs a write to a single memory page after changing
183 // the thread state. The VM thread performs a sequence of
193 // A thread which is blocked will not be allowed to return from the
196 // If a Java thread is currently running in the VM or transitioning
197 // between states, the safepointing code will wait for the thread to
203 // Flush all thread states to memory
237 assert(!cur->is_ConcurrentGC_thread(), "A concurrent GC thread is unexpectly being suspended");
266 // vs spinning. As the VM thread spins, wasting cycles, it consumes CPU that
268 // spinning by the VM thread on a saturated system can increase rendezvous latency.
277 // can actually increase the time it takes the VM thread to detect that a system-wide
296 // This is tricky as the path used by a thread exiting the JVM (say on
298 // is placed on the VM thread, which must poll (spin).
333 // Alternately, the VM thread could transiently depress its scheduling priority or
349 if (TraceSafepoint) tty->print_cr("Waiting for %d thread(s) to block", _waiting_to_block);
388 assert(cur->was_visited_for_critical_count(), "missed a thread");
425 assert(myThread->is_VM_thread(), "Only VM thread can execute a safepoint");
557 bool SafepointSynchronize::safepoint_safe(JavaThread *thread, JavaThreadState state) {
561 return !thread->has_last_Java_frame() || thread->frame_anchor()->walkable();
565 assert(!thread->has_last_Java_frame() || thread->frame_anchor()->walkable(), "blocked and not walkable");
574 // See if the thread is running inside a lazy critical native and
575 // update the thread critical count if so. Also set a suspend flag to
578 void SafepointSynchronize::check_for_lazy_critical_native(JavaThread *thread, JavaThreadState state) {
580 thread->has_last_Java_frame() &&
581 thread->frame_anchor()->walkable()) {
582 // This thread might be in a critical native nmethod so look at
585 frame wrapper_frame = thread->last_frame();
590 // A thread could potentially be in a critical native across
593 if (!thread->do_critical_native_unlock()) {
595 if (!thread->in_critical()) {
599 thread->enter_critical();
602 thread->set_critical_native_unlock();
613 void SafepointSynchronize::block(JavaThread *thread) {
614 assert(thread != NULL, "thread must be set");
615 assert(thread->is_Java_thread(), "not a Java thread");
620 // Only bail from the block() call if the thread is gone from the
621 // thread list; starting to exit should still block.
622 if (thread->is_terminated()) {
623 // block current thread if we come here from native code when VM is gone
624 thread->block_if_vm_exited();
630 JavaThreadState state = thread->thread_state();
631 thread->frame_anchor()->make_walkable(thread);
640 thread->set_thread_state(_thread_in_vm);
647 // of a thread. Hence, the instructions between the Safepoint_lock->lock() and
651 // Decrement the number of threads to wait for and signal vm thread
654 thread->safepoint_state()->set_has_called_back(true);
656 DEBUG_ONLY(thread->set_visited_for_critical_count(true));
657 if (thread->in_critical()) {
658 // Notice that this thread is in a critical section
662 // Consider (_waiting_to_block < 2) to pipeline the wakeup of the VM thread
668 // We transition the thread to state _thread_blocked here, but
674 thread->set_thread_state(_thread_blocked);
677 // We now try to acquire the threads lock. Since this lock is hold by the VM thread during
680 // restore original state. This is important if the thread comes from compiled code, so it
682 thread->set_thread_state(state);
689 if (thread->safepoint_state()->type() == ThreadSafepointState::_call_back) {
690 thread->print_thread_state();
695 // We transition the thread to state _thread_blocked here, but
701 thread->set_thread_state(_thread_blocked);
703 // It is not safe to suspend a thread if we discover it is in _thread_in_native_trans. Hence,
711 thread->set_thread_state(state);
721 // thread was blocked inside the VM. has_special_runtime_exit_condition()
731 // We don't deliver an async exception if the thread state is
733 // a surprising pending exception. If the thread state is going back to java,
738 thread->has_special_runtime_exit_condition()) {
739 thread->handle_special_runtime_exit_condition(
740 !thread->is_at_poll_safepoint() && (state != _thread_in_native_trans));
803 void SafepointSynchronize::handle_polling_page_exception(JavaThread *thread) {
804 assert(thread->is_Java_thread(), "polling reference encountered by VM thread");
805 assert(thread->thread_state() == _thread_in_Java, "should come from Java code");
811 intptr_t* sp = thread->last_Java_sp();
827 ThreadSafepointState* state = thread->safepoint_state();
837 // Print out the thread infor which didn't reach the safepoint for debugging
881 ThreadSafepointState::ThreadSafepointState(JavaThread *thread) {
882 _thread = thread;
888 void ThreadSafepointState::create(JavaThread *thread) {
889 ThreadSafepointState *state = new ThreadSafepointState(thread);
890 thread->set_safepoint_state(state);
893 void ThreadSafepointState::destroy(JavaThread *thread) {
894 if (thread->safepoint_state()) {
895 delete(thread->safepoint_state());
896 thread->set_safepoint_state(NULL);
908 // Check for a thread that is suspended. Note that thread resume tries
909 // to grab the Threads_lock which we own here, so a thread cannot be
912 // We check to see if this thread is suspended without locking to
913 // avoid deadlocking with a third thread that is waiting for this
914 // thread to be suspended. The third thread can notice the safepoint
916 // call. If that happens, then the third thread will block on the
948 // All other thread states will continue to run until they
953 assert(is_running(), "examine_state_of_thread on non-running thread");
957 // Returns true is thread could not be rolled forward at present position.
966 // Notice that this thread is in a critical section
989 tty->print_cr("restart thread "INTPTR_FORMAT" with state %d",
1021 // Block the thread at the safepoint poll or poll return.
1024 // Check state. block() will set thread state to thread_in_vm which will
1027 "polling page exception on thread not running state");
1031 tty->print_cr("Polling page exception at " INTPTR_FORMAT, thread()->saved_exception_pc());
1033 address real_return_addr = thread()->saved_exception_pc();
1040 frame stub_fr = thread()->last_frame();
1043 RegisterMap map(thread(), true);
1064 return_value = Handle(thread(), result);
1068 // Block the thread
1069 SafepointSynchronize::block(thread());
1084 // Block the thread
1085 SafepointSynchronize::block(thread());
1090 if (thread()->has_async_condition()) {
1091 ThreadInVMfromJavaNoAsyncException __tiv(thread());
1092 Deoptimization::deoptimize_frame(thread(), caller_fr.id());
1098 if (thread()->has_pending_exception() ) {
1099 RegisterMap map(thread(), true);