< prev index next >

src/hotspot/share/runtime/deoptimization.cpp

Print this page
rev 57156 : imported patch 8234796-v3


 784             vframeArrayElement* el = cur_array->element(k);
 785             tty->print_cr("    %s (bci %d)", el->method()->name_and_sig_as_C_string(), el->bci());
 786           }
 787           cur_array->print_on_2(tty);
 788         } // release tty lock before calling guarantee
 789         guarantee(false, "wrong number of expression stack elements during deopt");
 790       }
 791       VerifyOopClosure verify;
 792       iframe->oops_interpreted_do(&verify, &rm, false);
 793       callee_size_of_parameters = mh->size_of_parameters();
 794       callee_max_locals = mh->max_locals();
 795       is_top_frame = false;
 796     }
 797   }
 798 #endif /* !PRODUCT */
 799 
 800 
 801   return bt;
 802 JRT_END
 803 
 804 class DeoptimizeMarkedTC : public ThreadClosure {
 805  public:
 806   virtual void do_thread(Thread* thread) {
 807     assert(thread->is_Java_thread(), "must be");
 808     JavaThread* jt = (JavaThread*)thread;
 809     jt->deoptimize_marked_methods();
 810   }
 811 };
 812 
 813 void Deoptimization::deoptimize_all_marked() {
 814   ResourceMark rm;
 815   DeoptimizationMarker dm;
 816 
 817   if (SafepointSynchronize::is_at_safepoint()) {
 818     DeoptimizeMarkedTC deopt;
 819     // Make the dependent methods not entrant
 820     CodeCache::make_marked_nmethods_not_entrant();
 821     Threads::java_threads_do(&deopt);
 822   } else {
 823     // Make the dependent methods not entrant
 824     {
 825       MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 826       CodeCache::make_marked_nmethods_not_entrant();
 827     }
 828     DeoptimizeMarkedTC deopt;
 829     Handshake::execute(&deopt);
 830   }
 831 }
 832 
 833 Deoptimization::DeoptAction Deoptimization::_unloaded_action
 834   = Deoptimization::Action_reinterpret;
 835 
 836 
 837 
 838 #if INCLUDE_JVMCI || INCLUDE_AOT
 839 template<typename CacheType>
 840 class BoxCacheBase : public CHeapObj<mtCompiler> {
 841 protected:
 842   static InstanceKlass* find_cache_klass(Symbol* klass_name, TRAPS) {
 843     ResourceMark rm;
 844     char* klass_name_str = klass_name->as_C_string();
 845     Klass* k = SystemDictionary::find(klass_name, Handle(), Handle(), THREAD);
 846     guarantee(k != NULL, "%s must be loaded", klass_name_str);
 847     InstanceKlass* ik = InstanceKlass::cast(k);
 848     guarantee(ik->is_initialized(), "%s must be initialized", klass_name_str);




 784             vframeArrayElement* el = cur_array->element(k);
 785             tty->print_cr("    %s (bci %d)", el->method()->name_and_sig_as_C_string(), el->bci());
 786           }
 787           cur_array->print_on_2(tty);
 788         } // release tty lock before calling guarantee
 789         guarantee(false, "wrong number of expression stack elements during deopt");
 790       }
 791       VerifyOopClosure verify;
 792       iframe->oops_interpreted_do(&verify, &rm, false);
 793       callee_size_of_parameters = mh->size_of_parameters();
 794       callee_max_locals = mh->max_locals();
 795       is_top_frame = false;
 796     }
 797   }
 798 #endif /* !PRODUCT */
 799 
 800 
 801   return bt;
 802 JRT_END
 803 
 804 class DeoptimizeMarkedClosure : public HandshakeClosure {
 805  public:
 806   DeoptimizeMarkedClosure() : HandshakeClosure("Deoptimize") {}
 807   void do_thread(Thread* thread) {
 808     JavaThread* jt = (JavaThread*)thread;
 809     jt->deoptimize_marked_methods();
 810   }
 811 };
 812 
 813 void Deoptimization::deoptimize_all_marked() {
 814   ResourceMark rm;
 815   DeoptimizationMarker dm;
 816 
 817   if (SafepointSynchronize::is_at_safepoint()) {
 818     DeoptimizeMarkedClosure deopt;
 819     // Make the dependent methods not entrant
 820     CodeCache::make_marked_nmethods_not_entrant();
 821     Threads::java_threads_do(&deopt);
 822   } else {
 823     // Make the dependent methods not entrant
 824     {
 825       MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 826       CodeCache::make_marked_nmethods_not_entrant();
 827     }
 828     DeoptimizeMarkedClosure deopt;
 829     Handshake::execute(&deopt);
 830   }
 831 }
 832 
 833 Deoptimization::DeoptAction Deoptimization::_unloaded_action
 834   = Deoptimization::Action_reinterpret;
 835 
 836 
 837 
 838 #if INCLUDE_JVMCI || INCLUDE_AOT
 839 template<typename CacheType>
 840 class BoxCacheBase : public CHeapObj<mtCompiler> {
 841 protected:
 842   static InstanceKlass* find_cache_klass(Symbol* klass_name, TRAPS) {
 843     ResourceMark rm;
 844     char* klass_name_str = klass_name->as_C_string();
 845     Klass* k = SystemDictionary::find(klass_name, Handle(), Handle(), THREAD);
 846     guarantee(k != NULL, "%s must be loaded", klass_name_str);
 847     InstanceKlass* ik = InstanceKlass::cast(k);
 848     guarantee(ik->is_initialized(), "%s must be initialized", klass_name_str);


< prev index next >