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