< prev index next >

src/share/vm/prims/whitebox.cpp

Print this page




  23  */
  24 
  25 #include "precompiled.hpp"
  26 
  27 #include "memory/metadataFactory.hpp"
  28 #include "memory/metaspaceShared.hpp"
  29 #include "memory/iterator.hpp"
  30 #include "memory/universe.hpp"
  31 #include "oops/oop.inline.hpp"
  32 
  33 #include "classfile/symbolTable.hpp"
  34 #include "classfile/classLoaderData.hpp"
  35 
  36 #include "prims/whitebox.hpp"
  37 #include "prims/wbtestmethods/parserTests.hpp"
  38 
  39 #include "runtime/arguments.hpp"
  40 #include "runtime/interfaceSupport.hpp"
  41 #include "runtime/os.hpp"
  42 #include "utilities/array.hpp"

  43 #include "utilities/debug.hpp"
  44 #include "utilities/macros.hpp"
  45 #include "utilities/exceptions.hpp"
  46 
  47 #if INCLUDE_ALL_GCS
  48 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp"
  49 #include "gc_implementation/g1/concurrentMark.hpp"
  50 #include "gc_implementation/g1/concurrentMarkThread.hpp"
  51 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
  52 #include "gc_implementation/g1/heapRegionRemSet.hpp"
  53 #endif // INCLUDE_ALL_GCS
  54 
  55 #if INCLUDE_NMT
  56 #include "services/mallocSiteTable.hpp"
  57 #include "services/memTracker.hpp"
  58 #include "utilities/nativeCallStack.hpp"
  59 #endif // INCLUDE_NMT
  60 
  61 #include "compiler/compileBroker.hpp"
  62 #include "jvmtifiles/jvmtiEnv.hpp"


 551 WB_END
 552 
 553 WB_ENTRY(jint, WB_GetCompileQueueSize(JNIEnv* env, jobject o, jint comp_level))
 554   if (comp_level == CompLevel_any) {
 555     return CompileBroker::queue_size(CompLevel_full_optimization) /* C2 */ +
 556         CompileBroker::queue_size(CompLevel_full_profile) /* C1 */;
 557   } else {
 558     return CompileBroker::queue_size(comp_level);
 559   }
 560 WB_END
 561 
 562 WB_ENTRY(jboolean, WB_TestSetForceInlineMethod(JNIEnv* env, jobject o, jobject method, jboolean value))
 563   jmethodID jmid = reflected_method_to_jmid(thread, env, method);
 564   CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
 565   methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
 566   bool result = mh->force_inline();
 567   mh->set_force_inline(value == JNI_TRUE);
 568   return result;
 569 WB_END
 570 


































 571 WB_ENTRY(jboolean, WB_EnqueueMethodForCompilation(JNIEnv* env, jobject o, jobject method, jint comp_level, jint bci))
 572   jmethodID jmid = reflected_method_to_jmid(thread, env, method);
 573   CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
 574   methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
 575   nmethod* nm = CompileBroker::compile_method(mh, bci, comp_level, mh, mh->invocation_count(), "WhiteBox", THREAD);
 576   MutexLockerEx mu(Compile_lock);
 577   return (mh->queued_for_compilation() || nm != NULL);






 578 WB_END
 579 
 580 class VM_WhiteBoxOperation : public VM_Operation {
 581  public:
 582   VM_WhiteBoxOperation()                         { }
 583   VMOp_Type type()                  const        { return VMOp_WhiteBoxOperation; }
 584   bool allow_nested_vm_operations() const        { return true; }
 585 };
 586 
 587 static AlwaysFalseClosure always_false;
 588 
 589 class VM_WhiteBoxCleanMethodData : public VM_WhiteBoxOperation {
 590  public:
 591   VM_WhiteBoxCleanMethodData(MethodData* mdo) : _mdo(mdo) { }
 592   void doit() {
 593     _mdo->clean_method_data(&always_false);
 594   }
 595  private:
 596   MethodData* _mdo;
 597 };


 636 WB_ENTRY(void, WB_MarkMethodProfiled(JNIEnv* env, jobject o, jobject method))
 637   jmethodID jmid = reflected_method_to_jmid(thread, env, method);
 638   CHECK_JNI_EXCEPTION(env);
 639   methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
 640 
 641   MethodData* mdo = mh->method_data();
 642   if (mdo == NULL) {
 643     Method::build_interpreter_method_data(mh, CHECK_AND_CLEAR);
 644     mdo = mh->method_data();
 645   }
 646   mdo->init();
 647   InvocationCounter* icnt = mdo->invocation_counter();
 648   InvocationCounter* bcnt = mdo->backedge_counter();
 649   // set i-counter according to AdvancedThresholdPolicy::is_method_profiled
 650   // because SimpleThresholdPolicy::call_predicate_helper uses > in jdk8u, that's why we need to plus one.
 651   icnt->set(InvocationCounter::wait_for_compile, Tier4MinInvocationThreshold + 1);
 652   bcnt->set(InvocationCounter::wait_for_compile, Tier4CompileThreshold + 1);
 653 WB_END
 654 
 655 template <typename T>
 656 static bool GetVMFlag(JavaThread* thread, JNIEnv* env, jstring name, T* value, bool (*TAt)(const char*, T*)) {
 657   if (name == NULL) {
 658     return false;
 659   }
 660   ThreadToNativeFromVM ttnfv(thread);   // can't be in VM when we call JNI
 661   const char* flag_name = env->GetStringUTFChars(name, NULL);
 662   bool result = (*TAt)(flag_name, value);
 663   env->ReleaseStringUTFChars(name, flag_name);
 664   return result;
 665 }
 666 
 667 template <typename T>
 668 static bool SetVMFlag(JavaThread* thread, JNIEnv* env, jstring name, T* value, bool (*TAtPut)(const char*, T*, Flag::Flags)) {
 669   if (name == NULL) {
 670     return false;
 671   }
 672   ThreadToNativeFromVM ttnfv(thread);   // can't be in VM when we call JNI
 673   const char* flag_name = env->GetStringUTFChars(name, NULL);
 674   bool result = (*TAtPut)(flag_name, value, Flag::INTERNAL);
 675   env->ReleaseStringUTFChars(name, flag_name);
 676   return result;
 677 }
 678 
 679 template <typename T>
 680 static jobject box(JavaThread* thread, JNIEnv* env, Symbol* name, Symbol* sig, T value) {
 681   ResourceMark rm(thread);
 682   jclass clazz = env->FindClass(name->as_C_string());


 787   SetVMFlag <double> (thread, env, name, &result, &CommandLineFlags::doubleAtPut);
 788 WB_END
 789 
 790 WB_ENTRY(void, WB_SetStringVMFlag(JNIEnv* env, jobject o, jstring name, jstring value))
 791   ThreadToNativeFromVM ttnfv(thread);   // can't be in VM when we call JNI
 792   const char* ccstrValue = (value == NULL) ? NULL : env->GetStringUTFChars(value, NULL);
 793   ccstr ccstrResult = ccstrValue;
 794   bool needFree;
 795   {
 796     ThreadInVMfromNative ttvfn(thread); // back to VM
 797     needFree = SetVMFlag <ccstr> (thread, env, name, &ccstrResult, &CommandLineFlags::ccstrAtPut);
 798   }
 799   if (value != NULL) {
 800     env->ReleaseStringUTFChars(value, ccstrValue);
 801   }
 802   if (needFree) {
 803     FREE_C_HEAP_ARRAY(char, ccstrResult, mtInternal);
 804   }
 805 WB_END
 806 
 807 
 808 WB_ENTRY(jboolean, WB_IsInStringTable(JNIEnv* env, jobject o, jstring javaString))
 809   ResourceMark rm(THREAD);
 810   int len;
 811   jchar* name = java_lang_String::as_unicode_string(JNIHandles::resolve(javaString), len, CHECK_false);
 812   return (StringTable::lookup(name, len) != NULL);
 813 WB_END
 814 
 815 WB_ENTRY(void, WB_FullGC(JNIEnv* env, jobject o))
 816   Universe::heap()->collector_policy()->set_should_clear_all_soft_refs(true);
 817   Universe::heap()->collect(GCCause::_last_ditch_collection);
 818 #if INCLUDE_ALL_GCS
 819   if (UseG1GC) {
 820     // Needs to be cleared explicitly for G1
 821     Universe::heap()->collector_policy()->set_should_clear_all_soft_refs(false);
 822   }
 823 #endif // INCLUDE_ALL_GCS
 824 WB_END
 825 
 826 WB_ENTRY(void, WB_YoungGC(JNIEnv* env, jobject o))
 827   Universe::heap()->collect(GCCause::_wb_young_gc);


 834   static volatile char* p;
 835 
 836   p = os::reserve_memory(os::vm_allocation_granularity(), NULL, 0);
 837   if (p == NULL) {
 838     THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), "Failed to reserve memory");
 839   }
 840 
 841   c = *p;
 842 WB_END
 843 
 844 WB_ENTRY(jstring, WB_GetCPUFeatures(JNIEnv* env, jobject o))
 845   const char* cpu_features = VM_Version::cpu_features();
 846   ThreadToNativeFromVM ttn(thread);
 847   jstring features_string = env->NewStringUTF(cpu_features);
 848 
 849   CHECK_JNI_EXCEPTION_(env, NULL);
 850 
 851   return features_string;
 852 WB_END
 853 









































 854 
 855 WB_ENTRY(jobjectArray, WB_GetNMethod(JNIEnv* env, jobject o, jobject method, jboolean is_osr))
 856   ResourceMark rm(THREAD);
 857   jmethodID jmid = reflected_method_to_jmid(thread, env, method);
 858   CHECK_JNI_EXCEPTION_(env, NULL);
 859   methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
 860   nmethod* code = is_osr ? mh->lookup_osr_nmethod_for(InvocationEntryBci, CompLevel_none, false) : mh->code();
 861   jobjectArray result = NULL;
 862   if (code == NULL) {
 863     return result;
 864   }
 865   int insts_size = code->insts_size();
 866 
 867   ThreadToNativeFromVM ttn(thread);
 868   jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string());
 869   CHECK_JNI_EXCEPTION_(env, NULL);
 870   result = env->NewObjectArray(3, clazz, NULL);
 871   if (result == NULL) {
 872     return result;
 873   }
 874 
 875   jobject level = integerBox(thread, env, code->comp_level());
 876   CHECK_JNI_EXCEPTION_(env, NULL);
 877   env->SetObjectArrayElement(result, 0, level);
 878 
 879   jobject id = integerBox(thread, env, code->compile_id());
 880   CHECK_JNI_EXCEPTION_(env, NULL);
 881   env->SetObjectArrayElement(result, 1, id);
 882 
 883   jbyteArray insts = env->NewByteArray(insts_size);
 884   CHECK_JNI_EXCEPTION_(env, NULL);
 885   env->SetByteArrayRegion(insts, 0, insts_size, (jbyte*) code->insts_begin());
 886   env->SetObjectArrayElement(result, 2, insts);
 887 
 888   return result;
 889 WB_END
 890 









































 891 
 892 int WhiteBox::array_bytes_to_length(size_t bytes) {
 893   return Array<u1>::bytes_to_length(bytes);
 894 }
 895 
 896 WB_ENTRY(jlong, WB_AllocateMetaspace(JNIEnv* env, jobject wb, jobject class_loader, jlong size))
 897   if (size < 0) {
 898     THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
 899         err_msg("WB_AllocateMetaspace: size is negative: " JLONG_FORMAT, size));
 900   }
 901 
 902   oop class_loader_oop = JNIHandles::resolve(class_loader);
 903   ClassLoaderData* cld = class_loader_oop != NULL
 904       ? java_lang_ClassLoader::loader_data(class_loader_oop)
 905       : ClassLoaderData::the_null_class_loader_data();
 906 
 907   void* metadata = MetadataFactory::new_writeable_array<u1>(cld, WhiteBox::array_bytes_to_length((size_t)size), thread);
 908 
 909   return (jlong)(uintptr_t)metadata;
 910 WB_END


 942 WB_END
 943 
 944 WB_ENTRY(jlong, WB_MetaspaceCapacityUntilGC(JNIEnv* env, jobject wb))
 945   return (jlong) MetaspaceGC::capacity_until_GC();
 946 WB_END
 947 
 948 WB_ENTRY(jboolean, WB_IsSharedClass(JNIEnv* env, jobject wb, jclass clazz))
 949   return (jboolean)MetaspaceShared::is_in_shared_space(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
 950 WB_END
 951 
 952 WB_ENTRY(jboolean, WB_IsMonitorInflated(JNIEnv* env, jobject wb, jobject obj))
 953   oop obj_oop = JNIHandles::resolve(obj);
 954   return (jboolean) obj_oop->mark()->has_monitor();
 955 WB_END
 956 
 957 WB_ENTRY(void, WB_ForceSafepoint(JNIEnv* env, jobject wb))
 958   VM_ForceSafepoint force_safepoint_op;
 959   VMThread::execute(&force_safepoint_op);
 960 WB_END
 961 





 962 //Some convenience methods to deal with objects from java
 963 int WhiteBox::offset_for_field(const char* field_name, oop object,
 964     Symbol* signature_symbol) {
 965   assert(field_name != NULL && strlen(field_name) > 0, "Field name not valid");
 966   Thread* THREAD = Thread::current();
 967 
 968   //Get the class of our object
 969   Klass* arg_klass = object->klass();
 970   //Turn it into an instance-klass
 971   InstanceKlass* ik = InstanceKlass::cast(arg_klass);
 972 
 973   //Create symbols to look for in the class
 974   TempNewSymbol name_symbol = SymbolTable::lookup(field_name, (int) strlen(field_name),
 975       THREAD);
 976 
 977   //To be filled in with an offset of the field we're looking for
 978   fieldDescriptor fd;
 979 
 980   Klass* res = ik->find_field(name_symbol, signature_symbol, &fd);
 981   if (res == NULL) {


1056 WB_END
1057 
1058 WB_ENTRY(jboolean, WB_IsContainerized(JNIEnv* env, jobject o))
1059   LINUX_ONLY(return OSContainer::is_containerized();)
1060   return false;
1061 WB_END
1062 
1063 WB_ENTRY(void, WB_PrintOsInfo(JNIEnv* env, jobject o))
1064   os::print_os_info(tty);
1065 WB_END
1066 
1067 #define CC (char*)
1068 
1069 static JNINativeMethod methods[] = {
1070   {CC"getObjectAddress",   CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectAddress  },
1071   {CC"getObjectSize",      CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectSize     },
1072   {CC"isObjectInOldGen",   CC"(Ljava/lang/Object;)Z", (void*)&WB_isObjectInOldGen  },
1073   {CC"getHeapOopSize",     CC"()I",                   (void*)&WB_GetHeapOopSize    },
1074   {CC"getVMPageSize",      CC"()I",                   (void*)&WB_GetVMPageSize     },
1075   {CC"getVMLargePageSize", CC"()J",                   (void*)&WB_GetVMLargePageSize},

1076   {CC"isClassAlive0",      CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive      },
1077   {CC"classKnownToNotExist",
1078                            CC"(Ljava/lang/ClassLoader;Ljava/lang/String;)Z",(void*)&WB_ClassKnownToNotExist},
1079   {CC"getLookupCacheURLs", CC"(Ljava/lang/ClassLoader;)[Ljava/net/URL;",    (void*)&WB_GetLookupCacheURLs},
1080   {CC"getLookupCacheMatches", CC"(Ljava/lang/ClassLoader;Ljava/lang/String;)[I",
1081                                                       (void*)&WB_GetLookupCacheMatches},
1082   {CC"parseCommandLine",
1083       CC"(Ljava/lang/String;[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
1084       (void*) &WB_ParseCommandLine
1085   },
1086   {CC"addToBootstrapClassLoaderSearch", CC"(Ljava/lang/String;)V",
1087                                                       (void*)&WB_AddToBootstrapClassLoaderSearch},
1088   {CC"addToSystemClassLoaderSearch",    CC"(Ljava/lang/String;)V",
1089                                                       (void*)&WB_AddToSystemClassLoaderSearch},
1090   {CC"getCompressedOopsMaxHeapSize", CC"()J",
1091       (void*)&WB_GetCompressedOopsMaxHeapSize},
1092   {CC"printHeapSizes",     CC"()V",                   (void*)&WB_PrintHeapSizes    },
1093   {CC"runMemoryUnitTests", CC"()V",                   (void*)&WB_RunMemoryUnitTests},
1094   {CC"readFromNoaccessArea",CC"()V",                  (void*)&WB_ReadFromNoaccessArea},
1095   {CC"stressVirtualSpaceResize",CC"(JJJ)I",           (void*)&WB_StressVirtualSpaceResize},


1121   {CC"deoptimizeMethod",   CC"(Ljava/lang/reflect/Executable;Z)I",
1122                                                       (void*)&WB_DeoptimizeMethod  },
1123   {CC"isMethodCompiled",   CC"(Ljava/lang/reflect/Executable;Z)Z",
1124                                                       (void*)&WB_IsMethodCompiled  },
1125   {CC"isMethodCompilable", CC"(Ljava/lang/reflect/Executable;IZ)Z",
1126                                                       (void*)&WB_IsMethodCompilable},
1127   {CC"isMethodQueuedForCompilation",
1128       CC"(Ljava/lang/reflect/Executable;)Z",          (void*)&WB_IsMethodQueuedForCompilation},
1129   {CC"makeMethodNotCompilable",
1130       CC"(Ljava/lang/reflect/Executable;IZ)V",        (void*)&WB_MakeMethodNotCompilable},
1131   {CC"testSetDontInlineMethod",
1132       CC"(Ljava/lang/reflect/Executable;Z)Z",         (void*)&WB_TestSetDontInlineMethod},
1133   {CC"getMethodCompilationLevel",
1134       CC"(Ljava/lang/reflect/Executable;Z)I",         (void*)&WB_GetMethodCompilationLevel},
1135   {CC"getMethodEntryBci",
1136       CC"(Ljava/lang/reflect/Executable;)I",          (void*)&WB_GetMethodEntryBci},
1137   {CC"getCompileQueueSize",
1138       CC"(I)I",                                       (void*)&WB_GetCompileQueueSize},
1139   {CC"testSetForceInlineMethod",
1140       CC"(Ljava/lang/reflect/Executable;Z)Z",         (void*)&WB_TestSetForceInlineMethod},
1141   {CC"enqueueMethodForCompilation",
1142       CC"(Ljava/lang/reflect/Executable;II)Z",        (void*)&WB_EnqueueMethodForCompilation},


1143   {CC"clearMethodState",
1144       CC"(Ljava/lang/reflect/Executable;)V",          (void*)&WB_ClearMethodState},
1145   {CC"markMethodProfiled",
1146       CC"(Ljava/lang/reflect/Executable;)V",          (void*)&WB_MarkMethodProfiled},
1147   {CC"setBooleanVMFlag",   CC"(Ljava/lang/String;Z)V",(void*)&WB_SetBooleanVMFlag},
1148   {CC"setIntxVMFlag",      CC"(Ljava/lang/String;J)V",(void*)&WB_SetIntxVMFlag},
1149   {CC"setUintxVMFlag",     CC"(Ljava/lang/String;J)V",(void*)&WB_SetUintxVMFlag},
1150   {CC"setUint64VMFlag",    CC"(Ljava/lang/String;J)V",(void*)&WB_SetUint64VMFlag},
1151   {CC"setDoubleVMFlag",    CC"(Ljava/lang/String;D)V",(void*)&WB_SetDoubleVMFlag},
1152   {CC"setStringVMFlag",    CC"(Ljava/lang/String;Ljava/lang/String;)V",
1153                                                       (void*)&WB_SetStringVMFlag},
1154   {CC"getBooleanVMFlag",   CC"(Ljava/lang/String;)Ljava/lang/Boolean;",
1155                                                       (void*)&WB_GetBooleanVMFlag},
1156   {CC"getIntxVMFlag",      CC"(Ljava/lang/String;)Ljava/lang/Long;",
1157                                                       (void*)&WB_GetIntxVMFlag},
1158   {CC"getUintxVMFlag",     CC"(Ljava/lang/String;)Ljava/lang/Long;",
1159                                                       (void*)&WB_GetUintxVMFlag},
1160   {CC"getUint64VMFlag",    CC"(Ljava/lang/String;)Ljava/lang/Long;",
1161                                                       (void*)&WB_GetUint64VMFlag},
1162   {CC"getDoubleVMFlag",    CC"(Ljava/lang/String;)Ljava/lang/Double;",
1163                                                       (void*)&WB_GetDoubleVMFlag},
1164   {CC"getStringVMFlag",    CC"(Ljava/lang/String;)Ljava/lang/String;",
1165                                                       (void*)&WB_GetStringVMFlag},
1166   {CC"isInStringTable",    CC"(Ljava/lang/String;)Z", (void*)&WB_IsInStringTable  },
1167   {CC"fullGC",   CC"()V",                             (void*)&WB_FullGC },
1168   {CC"youngGC",  CC"()V",                             (void*)&WB_YoungGC },
1169   {CC"readReservedMemory", CC"()V",                   (void*)&WB_ReadReservedMemory },



1170   {CC"allocateMetaspace",
1171      CC"(Ljava/lang/ClassLoader;J)J",                 (void*)&WB_AllocateMetaspace },
1172   {CC"freeMetaspace",
1173      CC"(Ljava/lang/ClassLoader;JJ)V",                (void*)&WB_FreeMetaspace },
1174   {CC"incMetaspaceCapacityUntilGC", CC"(J)J",         (void*)&WB_IncMetaspaceCapacityUntilGC },
1175   {CC"metaspaceCapacityUntilGC", CC"()J",             (void*)&WB_MetaspaceCapacityUntilGC },
1176   {CC"getCPUFeatures",     CC"()Ljava/lang/String;",  (void*)&WB_GetCPUFeatures     },
1177   {CC"getNMethod",         CC"(Ljava/lang/reflect/Executable;Z)[Ljava/lang/Object;",
1178                                                       (void*)&WB_GetNMethod         },
1179   {CC"isMonitorInflated",  CC"(Ljava/lang/Object;)Z", (void*)&WB_IsMonitorInflated  },
1180   {CC"forceSafepoint",     CC"()V",                   (void*)&WB_ForceSafepoint     },
1181   {CC"checkLibSpecifiesNoexecstack", CC"(Ljava/lang/String;)Z",
1182                                                       (void*)&WB_CheckLibSpecifiesNoexecstack},
1183   {CC"isContainerized",           CC"()Z",            (void*)&WB_IsContainerized },
1184   {CC"printOsInfo",               CC"()V",            (void*)&WB_PrintOsInfo },
1185 };
1186 
1187 #undef CC
1188 
1189 JVM_ENTRY(void, JVM_RegisterWhiteBoxMethods(JNIEnv* env, jclass wbclass))


  23  */
  24 
  25 #include "precompiled.hpp"
  26 
  27 #include "memory/metadataFactory.hpp"
  28 #include "memory/metaspaceShared.hpp"
  29 #include "memory/iterator.hpp"
  30 #include "memory/universe.hpp"
  31 #include "oops/oop.inline.hpp"
  32 
  33 #include "classfile/symbolTable.hpp"
  34 #include "classfile/classLoaderData.hpp"
  35 
  36 #include "prims/whitebox.hpp"
  37 #include "prims/wbtestmethods/parserTests.hpp"
  38 
  39 #include "runtime/arguments.hpp"
  40 #include "runtime/interfaceSupport.hpp"
  41 #include "runtime/os.hpp"
  42 #include "utilities/array.hpp"
  43 #include "utilities/align.hpp"
  44 #include "utilities/debug.hpp"
  45 #include "utilities/macros.hpp"
  46 #include "utilities/exceptions.hpp"
  47 
  48 #if INCLUDE_ALL_GCS
  49 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp"
  50 #include "gc_implementation/g1/concurrentMark.hpp"
  51 #include "gc_implementation/g1/concurrentMarkThread.hpp"
  52 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
  53 #include "gc_implementation/g1/heapRegionRemSet.hpp"
  54 #endif // INCLUDE_ALL_GCS
  55 
  56 #if INCLUDE_NMT
  57 #include "services/mallocSiteTable.hpp"
  58 #include "services/memTracker.hpp"
  59 #include "utilities/nativeCallStack.hpp"
  60 #endif // INCLUDE_NMT
  61 
  62 #include "compiler/compileBroker.hpp"
  63 #include "jvmtifiles/jvmtiEnv.hpp"


 552 WB_END
 553 
 554 WB_ENTRY(jint, WB_GetCompileQueueSize(JNIEnv* env, jobject o, jint comp_level))
 555   if (comp_level == CompLevel_any) {
 556     return CompileBroker::queue_size(CompLevel_full_optimization) /* C2 */ +
 557         CompileBroker::queue_size(CompLevel_full_profile) /* C1 */;
 558   } else {
 559     return CompileBroker::queue_size(comp_level);
 560   }
 561 WB_END
 562 
 563 WB_ENTRY(jboolean, WB_TestSetForceInlineMethod(JNIEnv* env, jobject o, jobject method, jboolean value))
 564   jmethodID jmid = reflected_method_to_jmid(thread, env, method);
 565   CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
 566   methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
 567   bool result = mh->force_inline();
 568   mh->set_force_inline(value == JNI_TRUE);
 569   return result;
 570 WB_END
 571 
 572 bool WhiteBox::compile_method(Method* method, int comp_level, int bci, Thread* THREAD) {
 573   // Screen for unavailable/bad comp level or null method
 574   AbstractCompiler* comp = CompileBroker::compiler(comp_level);
 575   if (method == NULL) {
 576     tty->print_cr("WB error: request to compile NULL method");
 577     return false;
 578   }
 579   if (comp_level > MIN2((CompLevel) TieredStopAtLevel, CompLevel_highest_tier)) {
 580     tty->print_cr("WB error: invalid compilation level %d", comp_level);
 581     return false;
 582   }
 583   if (comp == NULL) {
 584     tty->print_cr("WB error: no compiler for requested compilation level %d", comp_level);
 585     return false;
 586   }
 587 
 588   methodHandle mh(THREAD, method);
 589 
 590   // Compile method and check result
 591   nmethod* nm = CompileBroker::compile_method(mh, bci, comp_level, mh, mh->invocation_count(), "Whitebox", THREAD);
 592   MutexLocker mu(Compile_lock);
 593   bool is_queued = mh->queued_for_compilation();
 594   if (is_queued || nm != NULL) {
 595     return true;
 596   }
 597   tty->print("WB error: failed to compile at level %d method ", comp_level);
 598   mh->print_short_name(tty);
 599   tty->cr();
 600   if (is_queued) {
 601     tty->print_cr("WB error: blocking compilation is still in queue!");
 602   }
 603   return false;
 604 }
 605 
 606 WB_ENTRY(jboolean, WB_EnqueueMethodForCompilation(JNIEnv* env, jobject o, jobject method, jint comp_level, jint bci))
 607   jmethodID jmid = reflected_method_to_jmid(thread, env, method);
 608   CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
 609   return WhiteBox::compile_method(Method::checked_resolve_jmethod_id(jmid), comp_level, bci, THREAD);
 610 WB_END
 611 
 612 WB_ENTRY(jboolean, WB_EnqueueInitializerForCompilation(JNIEnv* env, jobject o, jclass klass, jint comp_level))
 613   InstanceKlass* ik = InstanceKlass::cast(java_lang_Class::as_Klass(JNIHandles::resolve(klass)));
 614   Method* clinit = ik->class_initializer();
 615   if (clinit == NULL) {
 616     return false;
 617   }
 618   return WhiteBox::compile_method(clinit, comp_level, InvocationEntryBci, THREAD);
 619 WB_END
 620 
 621 class VM_WhiteBoxOperation : public VM_Operation {
 622  public:
 623   VM_WhiteBoxOperation()                         { }
 624   VMOp_Type type()                  const        { return VMOp_WhiteBoxOperation; }
 625   bool allow_nested_vm_operations() const        { return true; }
 626 };
 627 
 628 static AlwaysFalseClosure always_false;
 629 
 630 class VM_WhiteBoxCleanMethodData : public VM_WhiteBoxOperation {
 631  public:
 632   VM_WhiteBoxCleanMethodData(MethodData* mdo) : _mdo(mdo) { }
 633   void doit() {
 634     _mdo->clean_method_data(&always_false);
 635   }
 636  private:
 637   MethodData* _mdo;
 638 };


 677 WB_ENTRY(void, WB_MarkMethodProfiled(JNIEnv* env, jobject o, jobject method))
 678   jmethodID jmid = reflected_method_to_jmid(thread, env, method);
 679   CHECK_JNI_EXCEPTION(env);
 680   methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
 681 
 682   MethodData* mdo = mh->method_data();
 683   if (mdo == NULL) {
 684     Method::build_interpreter_method_data(mh, CHECK_AND_CLEAR);
 685     mdo = mh->method_data();
 686   }
 687   mdo->init();
 688   InvocationCounter* icnt = mdo->invocation_counter();
 689   InvocationCounter* bcnt = mdo->backedge_counter();
 690   // set i-counter according to AdvancedThresholdPolicy::is_method_profiled
 691   // because SimpleThresholdPolicy::call_predicate_helper uses > in jdk8u, that's why we need to plus one.
 692   icnt->set(InvocationCounter::wait_for_compile, Tier4MinInvocationThreshold + 1);
 693   bcnt->set(InvocationCounter::wait_for_compile, Tier4CompileThreshold + 1);
 694 WB_END
 695 
 696 template <typename T>
 697 static bool GetVMFlag(JavaThread* thread, JNIEnv* env, jstring name, T* value, bool (*TAt)(const char*, T*, bool, bool)) {
 698   if (name == NULL) {
 699     return false;
 700   }
 701   ThreadToNativeFromVM ttnfv(thread);   // can't be in VM when we call JNI
 702   const char* flag_name = env->GetStringUTFChars(name, NULL);
 703   bool result = (*TAt)(flag_name, value, true, true);
 704   env->ReleaseStringUTFChars(name, flag_name);
 705   return result;
 706 }
 707 
 708 template <typename T>
 709 static bool SetVMFlag(JavaThread* thread, JNIEnv* env, jstring name, T* value, bool (*TAtPut)(const char*, T*, Flag::Flags)) {
 710   if (name == NULL) {
 711     return false;
 712   }
 713   ThreadToNativeFromVM ttnfv(thread);   // can't be in VM when we call JNI
 714   const char* flag_name = env->GetStringUTFChars(name, NULL);
 715   bool result = (*TAtPut)(flag_name, value, Flag::INTERNAL);
 716   env->ReleaseStringUTFChars(name, flag_name);
 717   return result;
 718 }
 719 
 720 template <typename T>
 721 static jobject box(JavaThread* thread, JNIEnv* env, Symbol* name, Symbol* sig, T value) {
 722   ResourceMark rm(thread);
 723   jclass clazz = env->FindClass(name->as_C_string());


 828   SetVMFlag <double> (thread, env, name, &result, &CommandLineFlags::doubleAtPut);
 829 WB_END
 830 
 831 WB_ENTRY(void, WB_SetStringVMFlag(JNIEnv* env, jobject o, jstring name, jstring value))
 832   ThreadToNativeFromVM ttnfv(thread);   // can't be in VM when we call JNI
 833   const char* ccstrValue = (value == NULL) ? NULL : env->GetStringUTFChars(value, NULL);
 834   ccstr ccstrResult = ccstrValue;
 835   bool needFree;
 836   {
 837     ThreadInVMfromNative ttvfn(thread); // back to VM
 838     needFree = SetVMFlag <ccstr> (thread, env, name, &ccstrResult, &CommandLineFlags::ccstrAtPut);
 839   }
 840   if (value != NULL) {
 841     env->ReleaseStringUTFChars(value, ccstrValue);
 842   }
 843   if (needFree) {
 844     FREE_C_HEAP_ARRAY(char, ccstrResult, mtInternal);
 845   }
 846 WB_END
 847 

 848 WB_ENTRY(jboolean, WB_IsInStringTable(JNIEnv* env, jobject o, jstring javaString))
 849   ResourceMark rm(THREAD);
 850   int len;
 851   jchar* name = java_lang_String::as_unicode_string(JNIHandles::resolve(javaString), len, CHECK_false);
 852   return (StringTable::lookup(name, len) != NULL);
 853 WB_END
 854 
 855 WB_ENTRY(void, WB_FullGC(JNIEnv* env, jobject o))
 856   Universe::heap()->collector_policy()->set_should_clear_all_soft_refs(true);
 857   Universe::heap()->collect(GCCause::_last_ditch_collection);
 858 #if INCLUDE_ALL_GCS
 859   if (UseG1GC) {
 860     // Needs to be cleared explicitly for G1
 861     Universe::heap()->collector_policy()->set_should_clear_all_soft_refs(false);
 862   }
 863 #endif // INCLUDE_ALL_GCS
 864 WB_END
 865 
 866 WB_ENTRY(void, WB_YoungGC(JNIEnv* env, jobject o))
 867   Universe::heap()->collect(GCCause::_wb_young_gc);


 874   static volatile char* p;
 875 
 876   p = os::reserve_memory(os::vm_allocation_granularity(), NULL, 0);
 877   if (p == NULL) {
 878     THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), "Failed to reserve memory");
 879   }
 880 
 881   c = *p;
 882 WB_END
 883 
 884 WB_ENTRY(jstring, WB_GetCPUFeatures(JNIEnv* env, jobject o))
 885   const char* cpu_features = VM_Version::cpu_features();
 886   ThreadToNativeFromVM ttn(thread);
 887   jstring features_string = env->NewStringUTF(cpu_features);
 888 
 889   CHECK_JNI_EXCEPTION_(env, NULL);
 890 
 891   return features_string;
 892 WB_END
 893 
 894 int WhiteBox::get_blob_type(const CodeBlob* code) {
 895   guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to be enabled");
 896   return CodeBlobType::All;;
 897 }
 898 
 899 struct CodeBlobStub {
 900   CodeBlobStub(const CodeBlob* blob) :
 901       name(os::strdup(blob->name())),
 902       size(blob->size()),
 903       blob_type(WhiteBox::get_blob_type(blob)),
 904       address((jlong) blob) { }
 905   ~CodeBlobStub() { os::free((void*) name); }
 906   const char* const name;
 907   const jint        size;
 908   const jint        blob_type;
 909   const jlong       address;
 910 };
 911 
 912 static jobjectArray codeBlob2objectArray(JavaThread* thread, JNIEnv* env, CodeBlobStub* cb) {
 913   jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string());
 914   CHECK_JNI_EXCEPTION_(env, NULL);
 915   jobjectArray result = env->NewObjectArray(4, clazz, NULL);
 916 
 917   jstring name = env->NewStringUTF(cb->name);
 918   CHECK_JNI_EXCEPTION_(env, NULL);
 919   env->SetObjectArrayElement(result, 0, name);
 920 
 921   jobject obj = integerBox(thread, env, cb->size);
 922   CHECK_JNI_EXCEPTION_(env, NULL);
 923   env->SetObjectArrayElement(result, 1, obj);
 924 
 925   obj = integerBox(thread, env, cb->blob_type);
 926   CHECK_JNI_EXCEPTION_(env, NULL);
 927   env->SetObjectArrayElement(result, 2, obj);
 928 
 929   obj = longBox(thread, env, cb->address);
 930   CHECK_JNI_EXCEPTION_(env, NULL);
 931   env->SetObjectArrayElement(result, 3, obj);
 932 
 933   return result;
 934 }
 935 
 936 WB_ENTRY(jobjectArray, WB_GetNMethod(JNIEnv* env, jobject o, jobject method, jboolean is_osr))
 937   ResourceMark rm(THREAD);
 938   jmethodID jmid = reflected_method_to_jmid(thread, env, method);
 939   CHECK_JNI_EXCEPTION_(env, NULL);
 940   methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
 941   nmethod* code = is_osr ? mh->lookup_osr_nmethod_for(InvocationEntryBci, CompLevel_none, false) : mh->code();
 942   jobjectArray result = NULL;
 943   if (code == NULL) {
 944     return result;
 945   }
 946   int insts_size = code->insts_size();
 947 
 948   ThreadToNativeFromVM ttn(thread);
 949   jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string());
 950   CHECK_JNI_EXCEPTION_(env, NULL);
 951   result = env->NewObjectArray(3, clazz, NULL);
 952   if (result == NULL) {
 953     return result;
 954   }
 955 
 956   jobject level = integerBox(thread, env, code->comp_level());
 957   CHECK_JNI_EXCEPTION_(env, NULL);
 958   env->SetObjectArrayElement(result, 0, level);
 959 
 960   jobject id = integerBox(thread, env, code->compile_id());
 961   CHECK_JNI_EXCEPTION_(env, NULL);
 962   env->SetObjectArrayElement(result, 1, id);
 963 
 964   jbyteArray insts = env->NewByteArray(insts_size);
 965   CHECK_JNI_EXCEPTION_(env, NULL);
 966   env->SetByteArrayRegion(insts, 0, insts_size, (jbyte*) code->insts_begin());
 967   env->SetObjectArrayElement(result, 2, insts);
 968 
 969   return result;
 970 WB_END
 971 
 972 CodeBlob* WhiteBox::allocate_code_blob(int size, int blob_type) {
 973   guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to be enabled");
 974   BufferBlob* blob;
 975   int full_size = CodeBlob::align_code_offset(sizeof(BufferBlob));
 976   if (full_size < size) {
 977     full_size += align_up(size - full_size, oopSize);
 978   }
 979   {
 980     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 981     blob = (BufferBlob*) CodeCache::allocate(full_size);
 982     ::new (blob) BufferBlob("WB::DummyBlob", full_size);
 983   }
 984   // Track memory usage statistic after releasing CodeCache_lock
 985   MemoryService::track_code_cache_memory_usage();
 986   return blob;
 987 }
 988 
 989 WB_ENTRY(jlong, WB_AllocateCodeBlob(JNIEnv* env, jobject o, jint size, jint blob_type))
 990   if (size < 0) {
 991     THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
 992       err_msg("WB_AllocateCodeBlob: size is negative: " INT32_FORMAT, size));
 993   }
 994   return (jlong) WhiteBox::allocate_code_blob(size, blob_type);
 995 WB_END
 996 
 997 WB_ENTRY(void, WB_FreeCodeBlob(JNIEnv* env, jobject o, jlong addr))
 998   if (addr == 0) {
 999     return;
1000   }
1001   BufferBlob::free((BufferBlob*) addr);
1002 WB_END
1003 
1004 WB_ENTRY(jobjectArray, WB_GetCodeBlob(JNIEnv* env, jobject o, jlong addr))
1005   if (addr == 0) {
1006     THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(),
1007       "WB_GetCodeBlob: addr is null");
1008   }
1009   ThreadToNativeFromVM ttn(thread);
1010   CodeBlobStub stub((CodeBlob*) addr);
1011   return codeBlob2objectArray(thread, env, &stub);
1012 WB_END
1013 
1014 int WhiteBox::array_bytes_to_length(size_t bytes) {
1015   return Array<u1>::bytes_to_length(bytes);
1016 }
1017 
1018 WB_ENTRY(jlong, WB_AllocateMetaspace(JNIEnv* env, jobject wb, jobject class_loader, jlong size))
1019   if (size < 0) {
1020     THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
1021         err_msg("WB_AllocateMetaspace: size is negative: " JLONG_FORMAT, size));
1022   }
1023 
1024   oop class_loader_oop = JNIHandles::resolve(class_loader);
1025   ClassLoaderData* cld = class_loader_oop != NULL
1026       ? java_lang_ClassLoader::loader_data(class_loader_oop)
1027       : ClassLoaderData::the_null_class_loader_data();
1028 
1029   void* metadata = MetadataFactory::new_writeable_array<u1>(cld, WhiteBox::array_bytes_to_length((size_t)size), thread);
1030 
1031   return (jlong)(uintptr_t)metadata;
1032 WB_END


1064 WB_END
1065 
1066 WB_ENTRY(jlong, WB_MetaspaceCapacityUntilGC(JNIEnv* env, jobject wb))
1067   return (jlong) MetaspaceGC::capacity_until_GC();
1068 WB_END
1069 
1070 WB_ENTRY(jboolean, WB_IsSharedClass(JNIEnv* env, jobject wb, jclass clazz))
1071   return (jboolean)MetaspaceShared::is_in_shared_space(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
1072 WB_END
1073 
1074 WB_ENTRY(jboolean, WB_IsMonitorInflated(JNIEnv* env, jobject wb, jobject obj))
1075   oop obj_oop = JNIHandles::resolve(obj);
1076   return (jboolean) obj_oop->mark()->has_monitor();
1077 WB_END
1078 
1079 WB_ENTRY(void, WB_ForceSafepoint(JNIEnv* env, jobject wb))
1080   VM_ForceSafepoint force_safepoint_op;
1081   VMThread::execute(&force_safepoint_op);
1082 WB_END
1083 
1084 WB_ENTRY(jlong, WB_GetHeapAlignment(JNIEnv* env, jobject o))
1085     size_t alignment = Universe::heap()->collector_policy()->heap_alignment();
1086     return (jlong)alignment;
1087 WB_END
1088 
1089 //Some convenience methods to deal with objects from java
1090 int WhiteBox::offset_for_field(const char* field_name, oop object,
1091     Symbol* signature_symbol) {
1092   assert(field_name != NULL && strlen(field_name) > 0, "Field name not valid");
1093   Thread* THREAD = Thread::current();
1094 
1095   //Get the class of our object
1096   Klass* arg_klass = object->klass();
1097   //Turn it into an instance-klass
1098   InstanceKlass* ik = InstanceKlass::cast(arg_klass);
1099 
1100   //Create symbols to look for in the class
1101   TempNewSymbol name_symbol = SymbolTable::lookup(field_name, (int) strlen(field_name),
1102       THREAD);
1103 
1104   //To be filled in with an offset of the field we're looking for
1105   fieldDescriptor fd;
1106 
1107   Klass* res = ik->find_field(name_symbol, signature_symbol, &fd);
1108   if (res == NULL) {


1183 WB_END
1184 
1185 WB_ENTRY(jboolean, WB_IsContainerized(JNIEnv* env, jobject o))
1186   LINUX_ONLY(return OSContainer::is_containerized();)
1187   return false;
1188 WB_END
1189 
1190 WB_ENTRY(void, WB_PrintOsInfo(JNIEnv* env, jobject o))
1191   os::print_os_info(tty);
1192 WB_END
1193 
1194 #define CC (char*)
1195 
1196 static JNINativeMethod methods[] = {
1197   {CC"getObjectAddress",   CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectAddress  },
1198   {CC"getObjectSize",      CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectSize     },
1199   {CC"isObjectInOldGen",   CC"(Ljava/lang/Object;)Z", (void*)&WB_isObjectInOldGen  },
1200   {CC"getHeapOopSize",     CC"()I",                   (void*)&WB_GetHeapOopSize    },
1201   {CC"getVMPageSize",      CC"()I",                   (void*)&WB_GetVMPageSize     },
1202   {CC"getVMLargePageSize", CC"()J",                   (void*)&WB_GetVMLargePageSize},
1203   {CC"getHeapAlignment",   CC"()J",                   (void*)&WB_GetHeapAlignment  },
1204   {CC"isClassAlive0",      CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive      },
1205   {CC"classKnownToNotExist",
1206                            CC"(Ljava/lang/ClassLoader;Ljava/lang/String;)Z",(void*)&WB_ClassKnownToNotExist},
1207   {CC"getLookupCacheURLs", CC"(Ljava/lang/ClassLoader;)[Ljava/net/URL;",    (void*)&WB_GetLookupCacheURLs},
1208   {CC"getLookupCacheMatches", CC"(Ljava/lang/ClassLoader;Ljava/lang/String;)[I",
1209                                                       (void*)&WB_GetLookupCacheMatches},
1210   {CC"parseCommandLine",
1211       CC"(Ljava/lang/String;[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
1212       (void*) &WB_ParseCommandLine
1213   },
1214   {CC"addToBootstrapClassLoaderSearch", CC"(Ljava/lang/String;)V",
1215                                                       (void*)&WB_AddToBootstrapClassLoaderSearch},
1216   {CC"addToSystemClassLoaderSearch",    CC"(Ljava/lang/String;)V",
1217                                                       (void*)&WB_AddToSystemClassLoaderSearch},
1218   {CC"getCompressedOopsMaxHeapSize", CC"()J",
1219       (void*)&WB_GetCompressedOopsMaxHeapSize},
1220   {CC"printHeapSizes",     CC"()V",                   (void*)&WB_PrintHeapSizes    },
1221   {CC"runMemoryUnitTests", CC"()V",                   (void*)&WB_RunMemoryUnitTests},
1222   {CC"readFromNoaccessArea",CC"()V",                  (void*)&WB_ReadFromNoaccessArea},
1223   {CC"stressVirtualSpaceResize",CC"(JJJ)I",           (void*)&WB_StressVirtualSpaceResize},


1249   {CC"deoptimizeMethod",   CC"(Ljava/lang/reflect/Executable;Z)I",
1250                                                       (void*)&WB_DeoptimizeMethod  },
1251   {CC"isMethodCompiled",   CC"(Ljava/lang/reflect/Executable;Z)Z",
1252                                                       (void*)&WB_IsMethodCompiled  },
1253   {CC"isMethodCompilable", CC"(Ljava/lang/reflect/Executable;IZ)Z",
1254                                                       (void*)&WB_IsMethodCompilable},
1255   {CC"isMethodQueuedForCompilation",
1256       CC"(Ljava/lang/reflect/Executable;)Z",          (void*)&WB_IsMethodQueuedForCompilation},
1257   {CC"makeMethodNotCompilable",
1258       CC"(Ljava/lang/reflect/Executable;IZ)V",        (void*)&WB_MakeMethodNotCompilable},
1259   {CC"testSetDontInlineMethod",
1260       CC"(Ljava/lang/reflect/Executable;Z)Z",         (void*)&WB_TestSetDontInlineMethod},
1261   {CC"getMethodCompilationLevel",
1262       CC"(Ljava/lang/reflect/Executable;Z)I",         (void*)&WB_GetMethodCompilationLevel},
1263   {CC"getMethodEntryBci",
1264       CC"(Ljava/lang/reflect/Executable;)I",          (void*)&WB_GetMethodEntryBci},
1265   {CC"getCompileQueueSize",
1266       CC"(I)I",                                       (void*)&WB_GetCompileQueueSize},
1267   {CC"testSetForceInlineMethod",
1268       CC"(Ljava/lang/reflect/Executable;Z)Z",         (void*)&WB_TestSetForceInlineMethod},
1269   {CC"enqueueMethodForCompilation0",
1270       CC"(Ljava/lang/reflect/Executable;II)Z",        (void*)&WB_EnqueueMethodForCompilation},
1271   {CC"enqueueInitializerForCompilation0",
1272       CC"(Ljava/lang/Class;I)Z",                      (void*)&WB_EnqueueInitializerForCompilation},
1273   {CC"clearMethodState",
1274       CC"(Ljava/lang/reflect/Executable;)V",          (void*)&WB_ClearMethodState},
1275   {CC"markMethodProfiled",
1276       CC"(Ljava/lang/reflect/Executable;)V",          (void*)&WB_MarkMethodProfiled},
1277   {CC"setBooleanVMFlag",   CC"(Ljava/lang/String;Z)V",(void*)&WB_SetBooleanVMFlag},
1278   {CC"setIntxVMFlag",      CC"(Ljava/lang/String;J)V",(void*)&WB_SetIntxVMFlag},
1279   {CC"setUintxVMFlag",     CC"(Ljava/lang/String;J)V",(void*)&WB_SetUintxVMFlag},
1280   {CC"setUint64VMFlag",    CC"(Ljava/lang/String;J)V",(void*)&WB_SetUint64VMFlag},
1281   {CC"setDoubleVMFlag",    CC"(Ljava/lang/String;D)V",(void*)&WB_SetDoubleVMFlag},
1282   {CC"setStringVMFlag",    CC"(Ljava/lang/String;Ljava/lang/String;)V",
1283                                                       (void*)&WB_SetStringVMFlag},
1284   {CC"getBooleanVMFlag",   CC"(Ljava/lang/String;)Ljava/lang/Boolean;",
1285                                                       (void*)&WB_GetBooleanVMFlag},
1286   {CC"getIntxVMFlag",      CC"(Ljava/lang/String;)Ljava/lang/Long;",
1287                                                       (void*)&WB_GetIntxVMFlag},
1288   {CC"getUintxVMFlag",     CC"(Ljava/lang/String;)Ljava/lang/Long;",
1289                                                       (void*)&WB_GetUintxVMFlag},
1290   {CC"getUint64VMFlag",    CC"(Ljava/lang/String;)Ljava/lang/Long;",
1291                                                       (void*)&WB_GetUint64VMFlag},
1292   {CC"getDoubleVMFlag",    CC"(Ljava/lang/String;)Ljava/lang/Double;",
1293                                                       (void*)&WB_GetDoubleVMFlag},
1294   {CC"getStringVMFlag",    CC"(Ljava/lang/String;)Ljava/lang/String;",
1295                                                       (void*)&WB_GetStringVMFlag},
1296   {CC"isInStringTable",    CC"(Ljava/lang/String;)Z", (void*)&WB_IsInStringTable  },
1297   {CC"fullGC",   CC"()V",                             (void*)&WB_FullGC },
1298   {CC"youngGC",  CC"()V",                             (void*)&WB_YoungGC },
1299   {CC"readReservedMemory", CC"()V",                   (void*)&WB_ReadReservedMemory },
1300   {CC"allocateCodeBlob",   CC"(II)J",                 (void*)&WB_AllocateCodeBlob   },
1301   {CC"freeCodeBlob",       CC"(J)V",                  (void*)&WB_FreeCodeBlob       },
1302   {CC"getCodeBlob",        CC"(J)[Ljava/lang/Object;",(void*)&WB_GetCodeBlob        },
1303   {CC"allocateMetaspace",
1304      CC"(Ljava/lang/ClassLoader;J)J",                 (void*)&WB_AllocateMetaspace },
1305   {CC"freeMetaspace",
1306      CC"(Ljava/lang/ClassLoader;JJ)V",                (void*)&WB_FreeMetaspace },
1307   {CC"incMetaspaceCapacityUntilGC", CC"(J)J",         (void*)&WB_IncMetaspaceCapacityUntilGC },
1308   {CC"metaspaceCapacityUntilGC", CC"()J",             (void*)&WB_MetaspaceCapacityUntilGC },
1309   {CC"getCPUFeatures",     CC"()Ljava/lang/String;",  (void*)&WB_GetCPUFeatures     },
1310   {CC"getNMethod",         CC"(Ljava/lang/reflect/Executable;Z)[Ljava/lang/Object;",
1311                                                       (void*)&WB_GetNMethod         },
1312   {CC"isMonitorInflated",  CC"(Ljava/lang/Object;)Z", (void*)&WB_IsMonitorInflated  },
1313   {CC"forceSafepoint",     CC"()V",                   (void*)&WB_ForceSafepoint     },
1314   {CC"checkLibSpecifiesNoexecstack", CC"(Ljava/lang/String;)Z",
1315                                                       (void*)&WB_CheckLibSpecifiesNoexecstack},
1316   {CC"isContainerized",           CC"()Z",            (void*)&WB_IsContainerized },
1317   {CC"printOsInfo",               CC"()V",            (void*)&WB_PrintOsInfo },
1318 };
1319 
1320 #undef CC
1321 
1322 JVM_ENTRY(void, JVM_RegisterWhiteBoxMethods(JNIEnv* env, jclass wbclass))
< prev index next >