1202 1203 WB_ENTRY(void, WB_UnlockCompilation(JNIEnv* env, jobject o)) 1204 MonitorLockerEx mo(Compilation_lock, Mutex::_no_safepoint_check_flag); 1205 WhiteBox::compilation_locked = false; 1206 mo.notify_all(); 1207 WB_END 1208 1209 WB_ENTRY(void, WB_ForceNMethodSweep(JNIEnv* env, jobject o)) 1210 // Force a code cache sweep and block until it finished 1211 NMethodSweeper::force_sweep(); 1212 WB_END 1213 1214 WB_ENTRY(jboolean, WB_IsInStringTable(JNIEnv* env, jobject o, jstring javaString)) 1215 ResourceMark rm(THREAD); 1216 int len; 1217 jchar* name = java_lang_String::as_unicode_string(JNIHandles::resolve(javaString), len, CHECK_false); 1218 return (StringTable::lookup(name, len) != NULL); 1219 WB_END 1220 1221 WB_ENTRY(void, WB_FullGC(JNIEnv* env, jobject o)) 1222 Universe::heap()->collector_policy()->set_should_clear_all_soft_refs(true); 1223 Universe::heap()->collect(GCCause::_wb_full_gc); 1224 #if INCLUDE_ALL_GCS 1225 if (UseG1GC) { 1226 // Needs to be cleared explicitly for G1 1227 Universe::heap()->collector_policy()->set_should_clear_all_soft_refs(false); 1228 } 1229 #endif // INCLUDE_ALL_GCS 1230 WB_END 1231 1232 WB_ENTRY(void, WB_YoungGC(JNIEnv* env, jobject o)) 1233 Universe::heap()->collect(GCCause::_wb_young_gc); 1234 WB_END 1235 1236 WB_ENTRY(void, WB_ReadReservedMemory(JNIEnv* env, jobject o)) 1237 // static+volatile in order to force the read to happen 1238 // (not be eliminated by the compiler) 1239 static char c; 1240 static volatile char* p; 1241 1242 p = os::reserve_memory(os::vm_allocation_granularity(), NULL, 0); 1243 if (p == NULL) { 1244 THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), "Failed to reserve memory"); 1245 } 1246 1247 c = *p; | 1202 1203 WB_ENTRY(void, WB_UnlockCompilation(JNIEnv* env, jobject o)) 1204 MonitorLockerEx mo(Compilation_lock, Mutex::_no_safepoint_check_flag); 1205 WhiteBox::compilation_locked = false; 1206 mo.notify_all(); 1207 WB_END 1208 1209 WB_ENTRY(void, WB_ForceNMethodSweep(JNIEnv* env, jobject o)) 1210 // Force a code cache sweep and block until it finished 1211 NMethodSweeper::force_sweep(); 1212 WB_END 1213 1214 WB_ENTRY(jboolean, WB_IsInStringTable(JNIEnv* env, jobject o, jstring javaString)) 1215 ResourceMark rm(THREAD); 1216 int len; 1217 jchar* name = java_lang_String::as_unicode_string(JNIHandles::resolve(javaString), len, CHECK_false); 1218 return (StringTable::lookup(name, len) != NULL); 1219 WB_END 1220 1221 WB_ENTRY(void, WB_FullGC(JNIEnv* env, jobject o)) 1222 Universe::heap()->soft_ref_policy()->set_should_clear_all_soft_refs(true); 1223 Universe::heap()->collect(GCCause::_wb_full_gc); 1224 #if INCLUDE_ALL_GCS 1225 if (UseG1GC) { 1226 // Needs to be cleared explicitly for G1 1227 Universe::heap()->soft_ref_policy()->set_should_clear_all_soft_refs(false); 1228 } 1229 #endif // INCLUDE_ALL_GCS 1230 WB_END 1231 1232 WB_ENTRY(void, WB_YoungGC(JNIEnv* env, jobject o)) 1233 Universe::heap()->collect(GCCause::_wb_young_gc); 1234 WB_END 1235 1236 WB_ENTRY(void, WB_ReadReservedMemory(JNIEnv* env, jobject o)) 1237 // static+volatile in order to force the read to happen 1238 // (not be eliminated by the compiler) 1239 static char c; 1240 static volatile char* p; 1241 1242 p = os::reserve_memory(os::vm_allocation_granularity(), NULL, 0); 1243 if (p == NULL) { 1244 THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), "Failed to reserve memory"); 1245 } 1246 1247 c = *p; |