hotspot/src/share/vm/prims/whitebox.cpp
changeset 27162 0a4a7276949b
parent 26938 e0b35f8104a7
child 27417 576e2b527e1c
equal deleted inserted replaced
27159:3d2543e475e4 27162:0a4a7276949b
   333     os::malloc(0, mtTest, stack);
   333     os::malloc(0, mtTest, stack);
   334     pc += MallocSiteTable::hash_buckets();
   334     pc += MallocSiteTable::hash_buckets();
   335   }
   335   }
   336 WB_END
   336 WB_END
   337 
   337 
   338 
   338 WB_ENTRY(jboolean, WB_NMTChangeTrackingLevel(JNIEnv* env))
       
   339   // Test that we can downgrade NMT levels but not upgrade them.
       
   340   if (MemTracker::tracking_level() == NMT_off) {
       
   341     MemTracker::transition_to(NMT_off);
       
   342     return MemTracker::tracking_level() == NMT_off;
       
   343   } else {
       
   344     assert(MemTracker::tracking_level() == NMT_detail, "Should start out as detail tracking");
       
   345     MemTracker::transition_to(NMT_summary);
       
   346     assert(MemTracker::tracking_level() == NMT_summary, "Should be summary now");
       
   347 
       
   348     // Can't go to detail once NMT is set to summary.
       
   349     MemTracker::transition_to(NMT_detail);
       
   350     assert(MemTracker::tracking_level() == NMT_summary, "Should still be summary now");
       
   351 
       
   352     // Shutdown sets tracking level to minimal.
       
   353     MemTracker::shutdown();
       
   354     assert(MemTracker::tracking_level() == NMT_minimal, "Should be minimal now");
       
   355 
       
   356     // Once the tracking level is minimal, we cannot increase to summary.
       
   357     // The code ignores this request instead of asserting because if the malloc site
       
   358     // table overflows in another thread, it tries to change the code to summary.
       
   359     MemTracker::transition_to(NMT_summary);
       
   360     assert(MemTracker::tracking_level() == NMT_minimal, "Should still be minimal now");
       
   361 
       
   362     // Really can never go up to detail, verify that the code would never do this.
       
   363     MemTracker::transition_to(NMT_detail);
       
   364     assert(MemTracker::tracking_level() == NMT_minimal, "Should still be minimal now");
       
   365     return MemTracker::tracking_level() == NMT_minimal;
       
   366   }
       
   367 WB_END
   339 #endif // INCLUDE_NMT
   368 #endif // INCLUDE_NMT
   340 
   369 
   341 static jmethodID reflected_method_to_jmid(JavaThread* thread, JNIEnv* env, jobject method) {
   370 static jmethodID reflected_method_to_jmid(JavaThread* thread, JNIEnv* env, jobject method) {
   342   assert(method != NULL, "method should not be null");
   371   assert(method != NULL, "method should not be null");
   343   ThreadToNativeFromVM ttn(thread);
   372   ThreadToNativeFromVM ttn(thread);
   960   {CC"NMTCommitMemory",     CC"(JJ)V",                (void*)&WB_NMTCommitMemory    },
   989   {CC"NMTCommitMemory",     CC"(JJ)V",                (void*)&WB_NMTCommitMemory    },
   961   {CC"NMTUncommitMemory",   CC"(JJ)V",                (void*)&WB_NMTUncommitMemory  },
   990   {CC"NMTUncommitMemory",   CC"(JJ)V",                (void*)&WB_NMTUncommitMemory  },
   962   {CC"NMTReleaseMemory",    CC"(JJ)V",                (void*)&WB_NMTReleaseMemory   },
   991   {CC"NMTReleaseMemory",    CC"(JJ)V",                (void*)&WB_NMTReleaseMemory   },
   963   {CC"NMTOverflowHashBucket", CC"(J)V",               (void*)&WB_NMTOverflowHashBucket},
   992   {CC"NMTOverflowHashBucket", CC"(J)V",               (void*)&WB_NMTOverflowHashBucket},
   964   {CC"NMTIsDetailSupported",CC"()Z",                  (void*)&WB_NMTIsDetailSupported},
   993   {CC"NMTIsDetailSupported",CC"()Z",                  (void*)&WB_NMTIsDetailSupported},
       
   994   {CC"NMTChangeTrackingLevel", CC"()Z",               (void*)&WB_NMTChangeTrackingLevel},
   965 #endif // INCLUDE_NMT
   995 #endif // INCLUDE_NMT
   966   {CC"deoptimizeAll",      CC"()V",                   (void*)&WB_DeoptimizeAll     },
   996   {CC"deoptimizeAll",      CC"()V",                   (void*)&WB_DeoptimizeAll     },
   967   {CC"deoptimizeMethod",   CC"(Ljava/lang/reflect/Executable;Z)I",
   997   {CC"deoptimizeMethod",   CC"(Ljava/lang/reflect/Executable;Z)I",
   968                                                       (void*)&WB_DeoptimizeMethod  },
   998                                                       (void*)&WB_DeoptimizeMethod  },
   969   {CC"isMethodCompiled",   CC"(Ljava/lang/reflect/Executable;Z)Z",
   999   {CC"isMethodCompiled",   CC"(Ljava/lang/reflect/Executable;Z)Z",