< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page
rev 56098 : imported patch 8226705-8221734-baseline
rev 56100 : imported patch 8226705-inflate-on-deopt


2842   if (DebugDeoptimization && deopt) {
2843     tty->print_cr("[AFTER Deoptimization]");
2844     trace_frames();
2845   }
2846 }
2847 
2848 
2849 // Make zombies
2850 void JavaThread::make_zombies() {
2851   for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
2852     if (fst.current()->can_be_deoptimized()) {
2853       // it is a Java nmethod
2854       nmethod* nm = CodeCache::find_nmethod(fst.current()->pc());
2855       nm->make_not_entrant();
2856     }
2857   }
2858 }
2859 #endif // PRODUCT
2860 
2861 
2862 void JavaThread::deoptimized_wrt_marked_nmethods() {
2863   if (!has_last_Java_frame()) return;
2864   // BiasedLocking needs an updated RegisterMap for the revoke monitors pass
2865   StackFrameStream fst(this, UseBiasedLocking);
2866   for (; !fst.is_done(); fst.next()) {
2867     if (fst.current()->should_be_deoptimized()) {
2868       Deoptimization::deoptimize(this, *fst.current(), fst.register_map());
2869     }
2870   }
2871 }
2872 
2873 
2874 // If the caller is a NamedThread, then remember, in the current scope,
2875 // the given JavaThread in its _processed_thread field.
2876 class RememberProcessedThread: public StackObj {
2877   NamedThread* _cur_thr;
2878  public:
2879   RememberProcessedThread(JavaThread* jthr) {
2880     Thread* thread = Thread::current();
2881     if (thread->is_Named_thread()) {
2882       _cur_thr = (NamedThread *)thread;
2883       _cur_thr->set_processed_thread(jthr);
2884     } else {
2885       _cur_thr = NULL;
2886     }
2887   }
2888 
2889   ~RememberProcessedThread() {
2890     if (_cur_thr) {
2891       _cur_thr->set_processed_thread(NULL);
2892     }
2893   }


4529 void Threads::metadata_do(MetadataClosure* f) {
4530   ALL_JAVA_THREADS(p) {
4531     p->metadata_do(f);
4532   }
4533 }
4534 
4535 class ThreadHandlesClosure : public ThreadClosure {
4536   void (*_f)(Metadata*);
4537  public:
4538   ThreadHandlesClosure(void f(Metadata*)) : _f(f) {}
4539   virtual void do_thread(Thread* thread) {
4540     thread->metadata_handles_do(_f);
4541   }
4542 };
4543 
4544 void Threads::metadata_handles_do(void f(Metadata*)) {
4545   // Only walk the Handles in Thread.
4546   ThreadHandlesClosure handles_closure(f);
4547   threads_do(&handles_closure);
4548 }
4549 
4550 void Threads::deoptimized_wrt_marked_nmethods() {
4551   ALL_JAVA_THREADS(p) {
4552     p->deoptimized_wrt_marked_nmethods();
4553   }
4554 }
4555 
4556 
4557 // Get count Java threads that are waiting to enter the specified monitor.
4558 GrowableArray<JavaThread*>* Threads::get_pending_threads(ThreadsList * t_list,
4559                                                          int count,
4560                                                          address monitor) {
4561   GrowableArray<JavaThread*>* result = new GrowableArray<JavaThread*>(count);
4562 
4563   int i = 0;
4564   DO_JAVA_THREADS(t_list, p) {
4565     if (!p->can_call_java()) continue;
4566 
4567     address pending = (address)p->current_pending_monitor();
4568     if (pending == monitor) {             // found a match
4569       if (i < count) result->append(p);   // save the first count matches
4570       i++;
4571     }
4572   }
4573 
4574   return result;
4575 }




2842   if (DebugDeoptimization && deopt) {
2843     tty->print_cr("[AFTER Deoptimization]");
2844     trace_frames();
2845   }
2846 }
2847 
2848 
2849 // Make zombies
2850 void JavaThread::make_zombies() {
2851   for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
2852     if (fst.current()->can_be_deoptimized()) {
2853       // it is a Java nmethod
2854       nmethod* nm = CodeCache::find_nmethod(fst.current()->pc());
2855       nm->make_not_entrant();
2856     }
2857   }
2858 }
2859 #endif // PRODUCT
2860 
2861 
2862 void JavaThread::deoptimize_marked_methods() {
2863   if (!has_last_Java_frame()) return;
2864   // BiasedLocking needs an updated RegisterMap for the revoke monitors pass
2865   StackFrameStream fst(this, UseBiasedLocking);
2866   for (; !fst.is_done(); fst.next()) {
2867     if (fst.current()->should_be_deoptimized()) {
2868       Deoptimization::deoptimize(this, *fst.current(), fst.register_map());
2869     }
2870   }
2871 }
2872 

2873 // If the caller is a NamedThread, then remember, in the current scope,
2874 // the given JavaThread in its _processed_thread field.
2875 class RememberProcessedThread: public StackObj {
2876   NamedThread* _cur_thr;
2877  public:
2878   RememberProcessedThread(JavaThread* jthr) {
2879     Thread* thread = Thread::current();
2880     if (thread->is_Named_thread()) {
2881       _cur_thr = (NamedThread *)thread;
2882       _cur_thr->set_processed_thread(jthr);
2883     } else {
2884       _cur_thr = NULL;
2885     }
2886   }
2887 
2888   ~RememberProcessedThread() {
2889     if (_cur_thr) {
2890       _cur_thr->set_processed_thread(NULL);
2891     }
2892   }


4528 void Threads::metadata_do(MetadataClosure* f) {
4529   ALL_JAVA_THREADS(p) {
4530     p->metadata_do(f);
4531   }
4532 }
4533 
4534 class ThreadHandlesClosure : public ThreadClosure {
4535   void (*_f)(Metadata*);
4536  public:
4537   ThreadHandlesClosure(void f(Metadata*)) : _f(f) {}
4538   virtual void do_thread(Thread* thread) {
4539     thread->metadata_handles_do(_f);
4540   }
4541 };
4542 
4543 void Threads::metadata_handles_do(void f(Metadata*)) {
4544   // Only walk the Handles in Thread.
4545   ThreadHandlesClosure handles_closure(f);
4546   threads_do(&handles_closure);
4547 }







4548 
4549 // Get count Java threads that are waiting to enter the specified monitor.
4550 GrowableArray<JavaThread*>* Threads::get_pending_threads(ThreadsList * t_list,
4551                                                          int count,
4552                                                          address monitor) {
4553   GrowableArray<JavaThread*>* result = new GrowableArray<JavaThread*>(count);
4554 
4555   int i = 0;
4556   DO_JAVA_THREADS(t_list, p) {
4557     if (!p->can_call_java()) continue;
4558 
4559     address pending = (address)p->current_pending_monitor();
4560     if (pending == monitor) {             // found a match
4561       if (i < count) result->append(p);   // save the first count matches
4562       i++;
4563     }
4564   }
4565 
4566   return result;
4567 }


< prev index next >