< prev index next >

src/hotspot/share/prims/whitebox.cpp

Print this page
rev 47819 : imported patch 10.07.open.rebase_20171110.dcubed


  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


 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 (JavaThread* t = Threads::first(); t != NULL; t = t->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))




  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


 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 (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.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))


< prev index next >