src/hotspot/share/prims/whitebox.cpp
changeset 49630 2f1b308b4469
parent 49594 898ef81cbc0e
child 49659 0ed1370f52bb
equal deleted inserted replaced
49629:b786280276dc 49630:2f1b308b4469
    30 #include "classfile/modules.hpp"
    30 #include "classfile/modules.hpp"
    31 #include "classfile/stringTable.hpp"
    31 #include "classfile/stringTable.hpp"
    32 #include "code/codeCache.hpp"
    32 #include "code/codeCache.hpp"
    33 #include "compiler/methodMatcher.hpp"
    33 #include "compiler/methodMatcher.hpp"
    34 #include "compiler/directivesParser.hpp"
    34 #include "compiler/directivesParser.hpp"
       
    35 #include "gc/shared/gcConfig.hpp"
    35 #include "gc/shared/genCollectedHeap.hpp"
    36 #include "gc/shared/genCollectedHeap.hpp"
    36 #include "jvmtifiles/jvmtiEnv.hpp"
    37 #include "jvmtifiles/jvmtiEnv.hpp"
    37 #include "memory/metadataFactory.hpp"
    38 #include "memory/metadataFactory.hpp"
    38 #include "memory/metaspaceShared.hpp"
    39 #include "memory/metaspaceShared.hpp"
    39 #include "memory/iterator.hpp"
    40 #include "memory/iterator.hpp"
   310 
   311 
   311   return wb_stress_virtual_space_resize((size_t) reserved_space_size,
   312   return wb_stress_virtual_space_resize((size_t) reserved_space_size,
   312                                         (size_t) magnitude, (size_t) iterations);
   313                                         (size_t) magnitude, (size_t) iterations);
   313 WB_END
   314 WB_END
   314 
   315 
   315 static const jint serial_code   = 1;
   316 WB_ENTRY(jboolean, WB_IsGCSupported(JNIEnv* env, jobject o, jint name))
   316 static const jint parallel_code = 2;
   317   return GCConfig::is_gc_supported((CollectedHeap::Name)name);
   317 static const jint cms_code      = 4;
   318 WB_END
   318 static const jint g1_code       = 8;
   319 
   319 
   320 WB_ENTRY(jboolean, WB_IsGCSelected(JNIEnv* env, jobject o, jint name))
   320 WB_ENTRY(jint, WB_CurrentGC(JNIEnv* env, jobject o, jobject obj))
   321   return GCConfig::is_gc_selected((CollectedHeap::Name)name);
   321   if (UseSerialGC) {
   322 WB_END
   322     return serial_code;
   323 
   323   } else if (UseParallelGC || UseParallelOldGC) {
   324 WB_ENTRY(jboolean, WB_IsGCSelectedErgonomically(JNIEnv* env, jobject o))
   324     return parallel_code;
   325   return GCConfig::is_gc_selected_ergonomically();
   325   } if (UseConcMarkSweepGC) {
       
   326     return cms_code;
       
   327   } else if (UseG1GC) {
       
   328     return g1_code;
       
   329   }
       
   330   ShouldNotReachHere();
       
   331   return 0;
       
   332 WB_END
       
   333 
       
   334 WB_ENTRY(jint, WB_AllSupportedGC(JNIEnv* env, jobject o, jobject obj))
       
   335 #if INCLUDE_ALL_GCS
       
   336   return serial_code | parallel_code | cms_code | g1_code;
       
   337 #else
       
   338   return serial_code;
       
   339 #endif // INCLUDE_ALL_GCS
       
   340 WB_END
       
   341 
       
   342 WB_ENTRY(jboolean, WB_GCSelectedByErgo(JNIEnv* env, jobject o, jobject obj))
       
   343   if (UseSerialGC) {
       
   344     return FLAG_IS_ERGO(UseSerialGC);
       
   345   } else if (UseParallelGC) {
       
   346     return FLAG_IS_ERGO(UseParallelGC);
       
   347   } else if (UseParallelOldGC) {
       
   348     return FLAG_IS_ERGO(UseParallelOldGC);
       
   349   } else if (UseConcMarkSweepGC) {
       
   350     return FLAG_IS_ERGO(UseConcMarkSweepGC);
       
   351   } else if (UseG1GC) {
       
   352     return FLAG_IS_ERGO(UseG1GC);
       
   353   }
       
   354   ShouldNotReachHere();
       
   355   return false;
       
   356 WB_END
   326 WB_END
   357 
   327 
   358 WB_ENTRY(jboolean, WB_isObjectInOldGen(JNIEnv* env, jobject o, jobject obj))
   328 WB_ENTRY(jboolean, WB_isObjectInOldGen(JNIEnv* env, jobject o, jobject obj))
   359   oop p = JNIHandles::resolve(obj);
   329   oop p = JNIHandles::resolve(obj);
   360 #if INCLUDE_ALL_GCS
   330 #if INCLUDE_ALL_GCS
  2160 
  2130 
  2161   {CC"clearInlineCaches0",  CC"(Z)V",                 (void*)&WB_ClearInlineCaches },
  2131   {CC"clearInlineCaches0",  CC"(Z)V",                 (void*)&WB_ClearInlineCaches },
  2162   {CC"handshakeWalkStack", CC"(Ljava/lang/Thread;Z)I", (void*)&WB_HandshakeWalkStack },
  2132   {CC"handshakeWalkStack", CC"(Ljava/lang/Thread;Z)I", (void*)&WB_HandshakeWalkStack },
  2163   {CC"addCompilerDirective",    CC"(Ljava/lang/String;)I",
  2133   {CC"addCompilerDirective",    CC"(Ljava/lang/String;)I",
  2164                                                       (void*)&WB_AddCompilerDirective },
  2134                                                       (void*)&WB_AddCompilerDirective },
  2165   {CC"removeCompilerDirective",   CC"(I)V",             (void*)&WB_RemoveCompilerDirective },
  2135   {CC"removeCompilerDirective",   CC"(I)V",           (void*)&WB_RemoveCompilerDirective },
  2166   {CC"currentGC",                 CC"()I",            (void*)&WB_CurrentGC},
  2136   {CC"isGCSupported",             CC"(I)Z",           (void*)&WB_IsGCSupported},
  2167   {CC"allSupportedGC",            CC"()I",            (void*)&WB_AllSupportedGC},
  2137   {CC"isGCSelected",              CC"(I)Z",           (void*)&WB_IsGCSelected},
  2168   {CC"gcSelectedByErgo",          CC"()Z",            (void*)&WB_GCSelectedByErgo},
  2138   {CC"isGCSelectedErgonomically", CC"()Z",            (void*)&WB_IsGCSelectedErgonomically},
  2169   {CC"supportsConcurrentGCPhaseControl", CC"()Z",     (void*)&WB_SupportsConcurrentGCPhaseControl},
  2139   {CC"supportsConcurrentGCPhaseControl", CC"()Z",     (void*)&WB_SupportsConcurrentGCPhaseControl},
  2170   {CC"getConcurrentGCPhases",     CC"()[Ljava/lang/String;",
  2140   {CC"getConcurrentGCPhases",     CC"()[Ljava/lang/String;",
  2171                                                       (void*)&WB_GetConcurrentGCPhases},
  2141                                                       (void*)&WB_GetConcurrentGCPhases},
  2172   {CC"requestConcurrentGCPhase0", CC"(Ljava/lang/String;)Z",
  2142   {CC"requestConcurrentGCPhase0", CC"(Ljava/lang/String;)Z",
  2173                                                       (void*)&WB_RequestConcurrentGCPhase},
  2143                                                       (void*)&WB_RequestConcurrentGCPhase},