65 #include "oops/objArrayOop.inline.hpp"
66 #include "oops/oop.inline.hpp"
67 #include "oops/typeArrayOop.inline.hpp"
68 #include "prims/jvmtiEnvBase.hpp"
69 #include "prims/resolvedMethodTable.hpp"
70 #include "prims/wbtestmethods/parserTests.hpp"
71 #include "prims/whitebox.inline.hpp"
72 #include "runtime/arguments.hpp"
73 #include "runtime/atomic.hpp"
74 #include "runtime/deoptimization.hpp"
75 #include "runtime/fieldDescriptor.inline.hpp"
76 #include "runtime/flags/jvmFlag.hpp"
77 #include "runtime/flags/jvmFlagAccess.hpp"
78 #include "runtime/frame.inline.hpp"
79 #include "runtime/handles.inline.hpp"
80 #include "runtime/handshake.hpp"
81 #include "runtime/interfaceSupport.inline.hpp"
82 #include "runtime/javaCalls.hpp"
83 #include "runtime/javaThread.inline.hpp"
84 #include "runtime/jniHandles.inline.hpp"
85 #include "runtime/os.hpp"
86 #include "runtime/stackFrameStream.inline.hpp"
87 #include "runtime/synchronizer.hpp"
88 #include "runtime/threadSMR.hpp"
89 #include "runtime/vframe.hpp"
90 #include "runtime/vm_version.hpp"
91 #include "services/mallocSiteTable.hpp"
92 #include "services/memoryService.hpp"
93 #include "services/memTracker.hpp"
94 #include "utilities/align.hpp"
95 #include "utilities/debug.hpp"
96 #include "utilities/elfFile.hpp"
97 #include "utilities/exceptions.hpp"
98 #include "utilities/macros.hpp"
99 #include "utilities/nativeCallStack.hpp"
100 #include "utilities/ostream.hpp"
101 #if INCLUDE_G1GC
102 #include "gc/g1/g1Arguments.hpp"
103 #include "gc/g1/g1CollectedHeap.inline.hpp"
104 #include "gc/g1/g1ConcurrentMark.hpp"
1814
1815 WB_ENTRY(jlong, WB_MetaspaceCapacityUntilGC(JNIEnv* env, jobject wb))
1816 return (jlong) MetaspaceGC::capacity_until_GC();
1817 WB_END
1818
1819 // The function is only valid when CDS is available.
1820 WB_ENTRY(jlong, WB_MetaspaceSharedRegionAlignment(JNIEnv* env, jobject wb))
1821 #if INCLUDE_CDS
1822 return (jlong)MetaspaceShared::core_region_alignment();
1823 #else
1824 ShouldNotReachHere();
1825 return 0L;
1826 #endif
1827 WB_END
1828
1829 WB_ENTRY(jboolean, WB_IsMonitorInflated(JNIEnv* env, jobject wb, jobject obj))
1830 oop obj_oop = JNIHandles::resolve(obj);
1831 return (jboolean) obj_oop->mark().has_monitor();
1832 WB_END
1833
1834 WB_ENTRY(jboolean, WB_DeflateIdleMonitors(JNIEnv* env, jobject wb))
1835 log_info(monitorinflation)("WhiteBox initiated DeflateIdleMonitors");
1836 return ObjectSynchronizer::request_deflate_idle_monitors_from_wb();
1837 WB_END
1838
1839 WB_ENTRY(void, WB_ForceSafepoint(JNIEnv* env, jobject wb))
1840 VM_ForceSafepoint force_safepoint_op;
1841 VMThread::execute(&force_safepoint_op);
1842 WB_END
1843
1844 WB_ENTRY(void, WB_ForceClassLoaderStatsSafepoint(JNIEnv* env, jobject wb))
1845 nullStream dev_null;
1846 ClassLoaderStatsVMOperation force_op(&dev_null);
1847 VMThread::execute(&force_op);
1848 WB_END
1849
1850 WB_ENTRY(jlong, WB_GetConstantPool(JNIEnv* env, jobject wb, jclass klass))
1851 InstanceKlass* ik = InstanceKlass::cast(java_lang_Class::as_Klass(JNIHandles::resolve(klass)));
1852 return (jlong) ik->constants();
1853 WB_END
2733 {CC"getCodeHeapEntries", CC"(I)[Ljava/lang/Object;",(void*)&WB_GetCodeHeapEntries },
2734 {CC"getCompilationActivityMode",
2735 CC"()I", (void*)&WB_GetCompilationActivityMode},
2736 {CC"getMethodData0", CC"(Ljava/lang/reflect/Executable;)J",
2737 (void*)&WB_GetMethodData },
2738 {CC"getCodeBlob", CC"(J)[Ljava/lang/Object;",(void*)&WB_GetCodeBlob },
2739 {CC"getThreadStackSize", CC"()J", (void*)&WB_GetThreadStackSize },
2740 {CC"getThreadRemainingStackSize", CC"()J", (void*)&WB_GetThreadRemainingStackSize },
2741 {CC"DefineModule", CC"(Ljava/lang/Object;ZLjava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V",
2742 (void*)&WB_DefineModule },
2743 {CC"AddModuleExports", CC"(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V",
2744 (void*)&WB_AddModuleExports },
2745 {CC"AddReadsModule", CC"(Ljava/lang/Object;Ljava/lang/Object;)V",
2746 (void*)&WB_AddReadsModule },
2747 {CC"AddModuleExportsToAllUnnamed", CC"(Ljava/lang/Object;Ljava/lang/String;)V",
2748 (void*)&WB_AddModuleExportsToAllUnnamed },
2749 {CC"AddModuleExportsToAll", CC"(Ljava/lang/Object;Ljava/lang/String;)V",
2750 (void*)&WB_AddModuleExportsToAll },
2751 {CC"deflateIdleMonitors", CC"()Z", (void*)&WB_DeflateIdleMonitors },
2752 {CC"isMonitorInflated0", CC"(Ljava/lang/Object;)Z", (void*)&WB_IsMonitorInflated },
2753 {CC"forceSafepoint", CC"()V", (void*)&WB_ForceSafepoint },
2754 {CC"forceClassLoaderStatsSafepoint", CC"()V", (void*)&WB_ForceClassLoaderStatsSafepoint },
2755 {CC"getConstantPool0", CC"(Ljava/lang/Class;)J", (void*)&WB_GetConstantPool },
2756 {CC"getConstantPoolCacheIndexTag0", CC"()I", (void*)&WB_GetConstantPoolCacheIndexTag},
2757 {CC"getConstantPoolCacheLength0", CC"(Ljava/lang/Class;)I", (void*)&WB_GetConstantPoolCacheLength},
2758 {CC"getResolvedReferences0", CC"(Ljava/lang/Class;)[Ljava/lang/Object;", (void*)&WB_GetResolvedReferences},
2759 {CC"remapInstructionOperandFromCPCache0",
2760 CC"(Ljava/lang/Class;I)I", (void*)&WB_ConstantPoolRemapInstructionOperandFromCache},
2761 {CC"encodeConstantPoolIndyIndex0",
2762 CC"(I)I", (void*)&WB_ConstantPoolEncodeIndyIndex},
2763 {CC"getIndyInfoLength0", CC"(Ljava/lang/Class;)I", (void*)&WB_getIndyInfoLength},
2764 {CC"getIndyCPIndex0", CC"(Ljava/lang/Class;I)I", (void*)&WB_getIndyCPIndex},
2765 {CC"getMethodBooleanOption",
2766 CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/Boolean;",
2767 (void*)&WB_GetMethodBooleaneOption},
2768 {CC"getMethodIntxOption",
2769 CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/Long;",
2770 (void*)&WB_GetMethodIntxOption},
2771 {CC"getMethodUintxOption",
2772 CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/Long;",
|
65 #include "oops/objArrayOop.inline.hpp"
66 #include "oops/oop.inline.hpp"
67 #include "oops/typeArrayOop.inline.hpp"
68 #include "prims/jvmtiEnvBase.hpp"
69 #include "prims/resolvedMethodTable.hpp"
70 #include "prims/wbtestmethods/parserTests.hpp"
71 #include "prims/whitebox.inline.hpp"
72 #include "runtime/arguments.hpp"
73 #include "runtime/atomic.hpp"
74 #include "runtime/deoptimization.hpp"
75 #include "runtime/fieldDescriptor.inline.hpp"
76 #include "runtime/flags/jvmFlag.hpp"
77 #include "runtime/flags/jvmFlagAccess.hpp"
78 #include "runtime/frame.inline.hpp"
79 #include "runtime/handles.inline.hpp"
80 #include "runtime/handshake.hpp"
81 #include "runtime/interfaceSupport.inline.hpp"
82 #include "runtime/javaCalls.hpp"
83 #include "runtime/javaThread.inline.hpp"
84 #include "runtime/jniHandles.inline.hpp"
85 #include "runtime/lockStack.hpp"
86 #include "runtime/os.hpp"
87 #include "runtime/stackFrameStream.inline.hpp"
88 #include "runtime/synchronizer.hpp"
89 #include "runtime/threadSMR.hpp"
90 #include "runtime/vframe.hpp"
91 #include "runtime/vm_version.hpp"
92 #include "services/mallocSiteTable.hpp"
93 #include "services/memoryService.hpp"
94 #include "services/memTracker.hpp"
95 #include "utilities/align.hpp"
96 #include "utilities/debug.hpp"
97 #include "utilities/elfFile.hpp"
98 #include "utilities/exceptions.hpp"
99 #include "utilities/macros.hpp"
100 #include "utilities/nativeCallStack.hpp"
101 #include "utilities/ostream.hpp"
102 #if INCLUDE_G1GC
103 #include "gc/g1/g1Arguments.hpp"
104 #include "gc/g1/g1CollectedHeap.inline.hpp"
105 #include "gc/g1/g1ConcurrentMark.hpp"
1815
1816 WB_ENTRY(jlong, WB_MetaspaceCapacityUntilGC(JNIEnv* env, jobject wb))
1817 return (jlong) MetaspaceGC::capacity_until_GC();
1818 WB_END
1819
1820 // The function is only valid when CDS is available.
1821 WB_ENTRY(jlong, WB_MetaspaceSharedRegionAlignment(JNIEnv* env, jobject wb))
1822 #if INCLUDE_CDS
1823 return (jlong)MetaspaceShared::core_region_alignment();
1824 #else
1825 ShouldNotReachHere();
1826 return 0L;
1827 #endif
1828 WB_END
1829
1830 WB_ENTRY(jboolean, WB_IsMonitorInflated(JNIEnv* env, jobject wb, jobject obj))
1831 oop obj_oop = JNIHandles::resolve(obj);
1832 return (jboolean) obj_oop->mark().has_monitor();
1833 WB_END
1834
1835 WB_ENTRY(jint, WB_getLockStackCapacity(JNIEnv* env))
1836 return (jint) LockStack::CAPACITY;
1837 WB_END
1838
1839 WB_ENTRY(jboolean, WB_supportsRecursiveLightweightLocking(JNIEnv* env))
1840 return (jboolean) VM_Version::supports_recursive_lightweight_locking();
1841 WB_END
1842
1843 WB_ENTRY(jboolean, WB_DeflateIdleMonitors(JNIEnv* env, jobject wb))
1844 log_info(monitorinflation)("WhiteBox initiated DeflateIdleMonitors");
1845 return ObjectSynchronizer::request_deflate_idle_monitors_from_wb();
1846 WB_END
1847
1848 WB_ENTRY(void, WB_ForceSafepoint(JNIEnv* env, jobject wb))
1849 VM_ForceSafepoint force_safepoint_op;
1850 VMThread::execute(&force_safepoint_op);
1851 WB_END
1852
1853 WB_ENTRY(void, WB_ForceClassLoaderStatsSafepoint(JNIEnv* env, jobject wb))
1854 nullStream dev_null;
1855 ClassLoaderStatsVMOperation force_op(&dev_null);
1856 VMThread::execute(&force_op);
1857 WB_END
1858
1859 WB_ENTRY(jlong, WB_GetConstantPool(JNIEnv* env, jobject wb, jclass klass))
1860 InstanceKlass* ik = InstanceKlass::cast(java_lang_Class::as_Klass(JNIHandles::resolve(klass)));
1861 return (jlong) ik->constants();
1862 WB_END
2742 {CC"getCodeHeapEntries", CC"(I)[Ljava/lang/Object;",(void*)&WB_GetCodeHeapEntries },
2743 {CC"getCompilationActivityMode",
2744 CC"()I", (void*)&WB_GetCompilationActivityMode},
2745 {CC"getMethodData0", CC"(Ljava/lang/reflect/Executable;)J",
2746 (void*)&WB_GetMethodData },
2747 {CC"getCodeBlob", CC"(J)[Ljava/lang/Object;",(void*)&WB_GetCodeBlob },
2748 {CC"getThreadStackSize", CC"()J", (void*)&WB_GetThreadStackSize },
2749 {CC"getThreadRemainingStackSize", CC"()J", (void*)&WB_GetThreadRemainingStackSize },
2750 {CC"DefineModule", CC"(Ljava/lang/Object;ZLjava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V",
2751 (void*)&WB_DefineModule },
2752 {CC"AddModuleExports", CC"(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V",
2753 (void*)&WB_AddModuleExports },
2754 {CC"AddReadsModule", CC"(Ljava/lang/Object;Ljava/lang/Object;)V",
2755 (void*)&WB_AddReadsModule },
2756 {CC"AddModuleExportsToAllUnnamed", CC"(Ljava/lang/Object;Ljava/lang/String;)V",
2757 (void*)&WB_AddModuleExportsToAllUnnamed },
2758 {CC"AddModuleExportsToAll", CC"(Ljava/lang/Object;Ljava/lang/String;)V",
2759 (void*)&WB_AddModuleExportsToAll },
2760 {CC"deflateIdleMonitors", CC"()Z", (void*)&WB_DeflateIdleMonitors },
2761 {CC"isMonitorInflated0", CC"(Ljava/lang/Object;)Z", (void*)&WB_IsMonitorInflated },
2762 {CC"getLockStackCapacity", CC"()I", (void*)&WB_getLockStackCapacity },
2763 {CC"supportsRecursiveLightweightLocking", CC"()Z", (void*)&WB_supportsRecursiveLightweightLocking },
2764 {CC"forceSafepoint", CC"()V", (void*)&WB_ForceSafepoint },
2765 {CC"forceClassLoaderStatsSafepoint", CC"()V", (void*)&WB_ForceClassLoaderStatsSafepoint },
2766 {CC"getConstantPool0", CC"(Ljava/lang/Class;)J", (void*)&WB_GetConstantPool },
2767 {CC"getConstantPoolCacheIndexTag0", CC"()I", (void*)&WB_GetConstantPoolCacheIndexTag},
2768 {CC"getConstantPoolCacheLength0", CC"(Ljava/lang/Class;)I", (void*)&WB_GetConstantPoolCacheLength},
2769 {CC"getResolvedReferences0", CC"(Ljava/lang/Class;)[Ljava/lang/Object;", (void*)&WB_GetResolvedReferences},
2770 {CC"remapInstructionOperandFromCPCache0",
2771 CC"(Ljava/lang/Class;I)I", (void*)&WB_ConstantPoolRemapInstructionOperandFromCache},
2772 {CC"encodeConstantPoolIndyIndex0",
2773 CC"(I)I", (void*)&WB_ConstantPoolEncodeIndyIndex},
2774 {CC"getIndyInfoLength0", CC"(Ljava/lang/Class;)I", (void*)&WB_getIndyInfoLength},
2775 {CC"getIndyCPIndex0", CC"(Ljava/lang/Class;I)I", (void*)&WB_getIndyCPIndex},
2776 {CC"getMethodBooleanOption",
2777 CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/Boolean;",
2778 (void*)&WB_GetMethodBooleaneOption},
2779 {CC"getMethodIntxOption",
2780 CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/Long;",
2781 (void*)&WB_GetMethodIntxOption},
2782 {CC"getMethodUintxOption",
2783 CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/Long;",
|