777 // Deoptimizes all compiled frames and makes nmethods not entrant if it's requested
778 class VM_WhiteBoxDeoptimizeFrames : public VM_WhiteBoxOperation {
779 private:
780 int _result;
781 const bool _make_not_entrant;
782 public:
783 VM_WhiteBoxDeoptimizeFrames(bool make_not_entrant) :
784 _result(0), _make_not_entrant(make_not_entrant) { }
785 int result() const { return _result; }
786
787 void doit() {
788 for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) {
789 if (t->has_last_Java_frame()) {
790 for (StackFrameStream fst(t, false /* update */, true /* process_frames */); !fst.is_done(); fst.next()) {
791 frame* f = fst.current();
792 if (f->can_be_deoptimized() && !f->is_deoptimized_frame()) {
793 Deoptimization::deoptimize(t, *f);
794 if (_make_not_entrant) {
795 nmethod* nm = CodeCache::find_nmethod(f->pc());
796 assert(nm != nullptr, "did not find nmethod");
797 nm->make_not_entrant("Whitebox deoptimization");
798 }
799 ++_result;
800 }
801 }
802 }
803 }
804 }
805 };
806
807 WB_ENTRY(jint, WB_DeoptimizeFrames(JNIEnv* env, jobject o, jboolean make_not_entrant))
808 VM_WhiteBoxDeoptimizeFrames op(make_not_entrant == JNI_TRUE);
809 VMThread::execute(&op);
810 return op.result();
811 WB_END
812
813 WB_ENTRY(jboolean, WB_IsFrameDeoptimized(JNIEnv* env, jobject o, jint depth))
814 bool result = false;
815 if (thread->has_last_Java_frame()) {
816 ResourceMark rm(THREAD);
817 RegisterMap reg_map(thread,
|
777 // Deoptimizes all compiled frames and makes nmethods not entrant if it's requested
778 class VM_WhiteBoxDeoptimizeFrames : public VM_WhiteBoxOperation {
779 private:
780 int _result;
781 const bool _make_not_entrant;
782 public:
783 VM_WhiteBoxDeoptimizeFrames(bool make_not_entrant) :
784 _result(0), _make_not_entrant(make_not_entrant) { }
785 int result() const { return _result; }
786
787 void doit() {
788 for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) {
789 if (t->has_last_Java_frame()) {
790 for (StackFrameStream fst(t, false /* update */, true /* process_frames */); !fst.is_done(); fst.next()) {
791 frame* f = fst.current();
792 if (f->can_be_deoptimized() && !f->is_deoptimized_frame()) {
793 Deoptimization::deoptimize(t, *f);
794 if (_make_not_entrant) {
795 nmethod* nm = CodeCache::find_nmethod(f->pc());
796 assert(nm != nullptr, "did not find nmethod");
797 nm->make_not_entrant(nmethod::InvalidationReason::WHITEBOX_DEOPTIMIZATION);
798 }
799 ++_result;
800 }
801 }
802 }
803 }
804 }
805 };
806
807 WB_ENTRY(jint, WB_DeoptimizeFrames(JNIEnv* env, jobject o, jboolean make_not_entrant))
808 VM_WhiteBoxDeoptimizeFrames op(make_not_entrant == JNI_TRUE);
809 VMThread::execute(&op);
810 return op.result();
811 WB_END
812
813 WB_ENTRY(jboolean, WB_IsFrameDeoptimized(JNIEnv* env, jobject o, jint depth))
814 bool result = false;
815 if (thread->has_last_Java_frame()) {
816 ResourceMark rm(THREAD);
817 RegisterMap reg_map(thread,
|