37 #include "memory/metaspaceShared.hpp"
38 #include "memory/iterator.hpp"
39 #include "memory/resourceArea.hpp"
40 #include "memory/universe.hpp"
41 #include "memory/oopFactory.hpp"
42 #include "oops/array.hpp"
43 #include "oops/constantPool.hpp"
44 #include "oops/objArrayKlass.hpp"
45 #include "oops/objArrayOop.inline.hpp"
46 #include "oops/oop.inline.hpp"
47 #include "prims/wbtestmethods/parserTests.hpp"
48 #include "prims/whitebox.hpp"
49 #include "runtime/arguments.hpp"
50 #include "runtime/compilationPolicy.hpp"
51 #include "runtime/deoptimization.hpp"
52 #include "runtime/interfaceSupport.hpp"
53 #include "runtime/javaCalls.hpp"
54 #include "runtime/os.hpp"
55 #include "runtime/sweeper.hpp"
56 #include "runtime/thread.hpp"
57 #include "runtime/vm_version.hpp"
58 #include "utilities/align.hpp"
59 #include "utilities/debug.hpp"
60 #include "utilities/exceptions.hpp"
61 #include "utilities/macros.hpp"
62 #if INCLUDE_ALL_GCS
63 #include "gc/g1/concurrentMarkThread.hpp"
64 #include "gc/g1/g1CollectedHeap.inline.hpp"
65 #include "gc/g1/g1ConcurrentMark.hpp"
66 #include "gc/g1/heapRegionRemSet.hpp"
67 #include "gc/parallel/parallelScavengeHeap.inline.hpp"
68 #include "gc/parallel/adjoiningGenerations.hpp"
69 #endif // INCLUDE_ALL_GCS
70 #if INCLUDE_NMT
71 #include "services/mallocSiteTable.hpp"
72 #include "services/memTracker.hpp"
73 #include "utilities/nativeCallStack.hpp"
74 #endif // INCLUDE_NMT
75
76 #ifdef LINUX
646 WB_END
647 #endif // INCLUDE_NMT
648
649 static jmethodID reflected_method_to_jmid(JavaThread* thread, JNIEnv* env, jobject method) {
650 assert(method != NULL, "method should not be null");
651 ThreadToNativeFromVM ttn(thread);
652 return env->FromReflectedMethod(method);
653 }
654
655 // Deoptimizes all compiled frames and makes nmethods not entrant if it's requested
656 class VM_WhiteBoxDeoptimizeFrames : public VM_WhiteBoxOperation {
657 private:
658 int _result;
659 const bool _make_not_entrant;
660 public:
661 VM_WhiteBoxDeoptimizeFrames(bool make_not_entrant) :
662 _result(0), _make_not_entrant(make_not_entrant) { }
663 int result() const { return _result; }
664
665 void doit() {
666 for (JavaThread* t = Threads::first(); t != NULL; t = t->next()) {
667 if (t->has_last_Java_frame()) {
668 for (StackFrameStream fst(t, UseBiasedLocking); !fst.is_done(); fst.next()) {
669 frame* f = fst.current();
670 if (f->can_be_deoptimized() && !f->is_deoptimized_frame()) {
671 RegisterMap* reg_map = fst.register_map();
672 Deoptimization::deoptimize(t, *f, reg_map);
673 if (_make_not_entrant) {
674 CompiledMethod* cm = CodeCache::find_compiled(f->pc());
675 assert(cm != NULL, "sanity check");
676 cm->make_not_entrant();
677 }
678 ++_result;
679 }
680 }
681 }
682 }
683 }
684 };
685
686 WB_ENTRY(jint, WB_DeoptimizeFrames(JNIEnv* env, jobject o, jboolean make_not_entrant))
|
37 #include "memory/metaspaceShared.hpp"
38 #include "memory/iterator.hpp"
39 #include "memory/resourceArea.hpp"
40 #include "memory/universe.hpp"
41 #include "memory/oopFactory.hpp"
42 #include "oops/array.hpp"
43 #include "oops/constantPool.hpp"
44 #include "oops/objArrayKlass.hpp"
45 #include "oops/objArrayOop.inline.hpp"
46 #include "oops/oop.inline.hpp"
47 #include "prims/wbtestmethods/parserTests.hpp"
48 #include "prims/whitebox.hpp"
49 #include "runtime/arguments.hpp"
50 #include "runtime/compilationPolicy.hpp"
51 #include "runtime/deoptimization.hpp"
52 #include "runtime/interfaceSupport.hpp"
53 #include "runtime/javaCalls.hpp"
54 #include "runtime/os.hpp"
55 #include "runtime/sweeper.hpp"
56 #include "runtime/thread.hpp"
57 #include "runtime/threadSMR.hpp"
58 #include "runtime/vm_version.hpp"
59 #include "utilities/align.hpp"
60 #include "utilities/debug.hpp"
61 #include "utilities/exceptions.hpp"
62 #include "utilities/macros.hpp"
63 #if INCLUDE_ALL_GCS
64 #include "gc/g1/concurrentMarkThread.hpp"
65 #include "gc/g1/g1CollectedHeap.inline.hpp"
66 #include "gc/g1/g1ConcurrentMark.hpp"
67 #include "gc/g1/heapRegionRemSet.hpp"
68 #include "gc/parallel/parallelScavengeHeap.inline.hpp"
69 #include "gc/parallel/adjoiningGenerations.hpp"
70 #endif // INCLUDE_ALL_GCS
71 #if INCLUDE_NMT
72 #include "services/mallocSiteTable.hpp"
73 #include "services/memTracker.hpp"
74 #include "utilities/nativeCallStack.hpp"
75 #endif // INCLUDE_NMT
76
77 #ifdef LINUX
647 WB_END
648 #endif // INCLUDE_NMT
649
650 static jmethodID reflected_method_to_jmid(JavaThread* thread, JNIEnv* env, jobject method) {
651 assert(method != NULL, "method should not be null");
652 ThreadToNativeFromVM ttn(thread);
653 return env->FromReflectedMethod(method);
654 }
655
656 // Deoptimizes all compiled frames and makes nmethods not entrant if it's requested
657 class VM_WhiteBoxDeoptimizeFrames : public VM_WhiteBoxOperation {
658 private:
659 int _result;
660 const bool _make_not_entrant;
661 public:
662 VM_WhiteBoxDeoptimizeFrames(bool make_not_entrant) :
663 _result(0), _make_not_entrant(make_not_entrant) { }
664 int result() const { return _result; }
665
666 void doit() {
667 for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) {
668 if (t->has_last_Java_frame()) {
669 for (StackFrameStream fst(t, UseBiasedLocking); !fst.is_done(); fst.next()) {
670 frame* f = fst.current();
671 if (f->can_be_deoptimized() && !f->is_deoptimized_frame()) {
672 RegisterMap* reg_map = fst.register_map();
673 Deoptimization::deoptimize(t, *f, reg_map);
674 if (_make_not_entrant) {
675 CompiledMethod* cm = CodeCache::find_compiled(f->pc());
676 assert(cm != NULL, "sanity check");
677 cm->make_not_entrant();
678 }
679 ++_result;
680 }
681 }
682 }
683 }
684 }
685 };
686
687 WB_ENTRY(jint, WB_DeoptimizeFrames(JNIEnv* env, jobject o, jboolean make_not_entrant))
|