< prev index next >

src/hotspot/share/prims/whitebox.cpp

Print this page
rev 47287 : Port 09.17.Thread_SMR_logging_update from JDK9 to JDK10
rev 47289 : eosterlund, stefank CR - refactor code into threadSMR.cpp and threadSMR.hpp
rev 47292 : stefank, coleenp CR - refactor most JavaThreadIterator usage to use JavaThreadIteratorWithHandle.


  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 


 643 WB_END
 644 #endif // INCLUDE_NMT
 645 
 646 static jmethodID reflected_method_to_jmid(JavaThread* thread, JNIEnv* env, jobject method) {
 647   assert(method != NULL, "method should not be null");
 648   ThreadToNativeFromVM ttn(thread);
 649   return env->FromReflectedMethod(method);
 650 }
 651 
 652 // Deoptimizes all compiled frames and makes nmethods not entrant if it's requested
 653 class VM_WhiteBoxDeoptimizeFrames : public VM_WhiteBoxOperation {
 654  private:
 655   int _result;
 656   const bool _make_not_entrant;
 657  public:
 658   VM_WhiteBoxDeoptimizeFrames(bool make_not_entrant) :
 659         _result(0), _make_not_entrant(make_not_entrant) { }
 660   int  result() const { return _result; }
 661 
 662   void doit() {
 663     for (JavaThread* t = Threads::first(); t != NULL; t = t->next()) {
 664       if (t->has_last_Java_frame()) {
 665         for (StackFrameStream fst(t, UseBiasedLocking); !fst.is_done(); fst.next()) {
 666           frame* f = fst.current();
 667           if (f->can_be_deoptimized() && !f->is_deoptimized_frame()) {
 668             RegisterMap* reg_map = fst.register_map();
 669             Deoptimization::deoptimize(t, *f, reg_map);
 670             if (_make_not_entrant) {
 671                 CompiledMethod* cm = CodeCache::find_compiled(f->pc());
 672                 assert(cm != NULL, "sanity check");
 673                 cm->make_not_entrant();
 674             }
 675             ++_result;
 676           }
 677         }
 678       }
 679     }
 680   }
 681 };
 682 
 683 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 


 644 WB_END
 645 #endif // INCLUDE_NMT
 646 
 647 static jmethodID reflected_method_to_jmid(JavaThread* thread, JNIEnv* env, jobject method) {
 648   assert(method != NULL, "method should not be null");
 649   ThreadToNativeFromVM ttn(thread);
 650   return env->FromReflectedMethod(method);
 651 }
 652 
 653 // Deoptimizes all compiled frames and makes nmethods not entrant if it's requested
 654 class VM_WhiteBoxDeoptimizeFrames : public VM_WhiteBoxOperation {
 655  private:
 656   int _result;
 657   const bool _make_not_entrant;
 658  public:
 659   VM_WhiteBoxDeoptimizeFrames(bool make_not_entrant) :
 660         _result(0), _make_not_entrant(make_not_entrant) { }
 661   int  result() const { return _result; }
 662 
 663   void doit() {
 664     for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) {
 665       if (t->has_last_Java_frame()) {
 666         for (StackFrameStream fst(t, UseBiasedLocking); !fst.is_done(); fst.next()) {
 667           frame* f = fst.current();
 668           if (f->can_be_deoptimized() && !f->is_deoptimized_frame()) {
 669             RegisterMap* reg_map = fst.register_map();
 670             Deoptimization::deoptimize(t, *f, reg_map);
 671             if (_make_not_entrant) {
 672                 CompiledMethod* cm = CodeCache::find_compiled(f->pc());
 673                 assert(cm != NULL, "sanity check");
 674                 cm->make_not_entrant();
 675             }
 676             ++_result;
 677           }
 678         }
 679       }
 680     }
 681   }
 682 };
 683 
 684 WB_ENTRY(jint, WB_DeoptimizeFrames(JNIEnv* env, jobject o, jboolean make_not_entrant))


< prev index next >