71 #include "utilities/exceptions.hpp" |
71 #include "utilities/exceptions.hpp" |
72 #include "utilities/macros.hpp" |
72 #include "utilities/macros.hpp" |
73 #if INCLUDE_CDS |
73 #if INCLUDE_CDS |
74 #include "prims/cdsoffsets.hpp" |
74 #include "prims/cdsoffsets.hpp" |
75 #endif // INCLUDE_CDS |
75 #endif // INCLUDE_CDS |
76 #if INCLUDE_ALL_GCS |
76 #if INCLUDE_G1GC |
77 #include "gc/g1/g1CollectedHeap.inline.hpp" |
77 #include "gc/g1/g1CollectedHeap.inline.hpp" |
78 #include "gc/g1/g1ConcurrentMark.hpp" |
78 #include "gc/g1/g1ConcurrentMark.hpp" |
79 #include "gc/g1/g1ConcurrentMarkThread.hpp" |
79 #include "gc/g1/g1ConcurrentMarkThread.hpp" |
80 #include "gc/g1/heapRegionRemSet.hpp" |
80 #include "gc/g1/heapRegionRemSet.hpp" |
|
81 #endif // INCLUDE_G1GC |
|
82 #if INCLUDE_PARALLELGC |
81 #include "gc/parallel/parallelScavengeHeap.inline.hpp" |
83 #include "gc/parallel/parallelScavengeHeap.inline.hpp" |
82 #include "gc/parallel/adjoiningGenerations.hpp" |
84 #include "gc/parallel/adjoiningGenerations.hpp" |
83 #endif // INCLUDE_ALL_GCS |
85 #endif // INCLUDE_PARALLELGC |
84 #if INCLUDE_NMT |
86 #if INCLUDE_NMT |
85 #include "services/mallocSiteTable.hpp" |
87 #include "services/mallocSiteTable.hpp" |
86 #include "services/memTracker.hpp" |
88 #include "services/memTracker.hpp" |
87 #include "utilities/nativeCallStack.hpp" |
89 #include "utilities/nativeCallStack.hpp" |
88 #endif // INCLUDE_NMT |
90 #endif // INCLUDE_NMT |
326 return GCConfig::is_gc_selected_ergonomically(); |
328 return GCConfig::is_gc_selected_ergonomically(); |
327 WB_END |
329 WB_END |
328 |
330 |
329 WB_ENTRY(jboolean, WB_isObjectInOldGen(JNIEnv* env, jobject o, jobject obj)) |
331 WB_ENTRY(jboolean, WB_isObjectInOldGen(JNIEnv* env, jobject o, jobject obj)) |
330 oop p = JNIHandles::resolve(obj); |
332 oop p = JNIHandles::resolve(obj); |
331 #if INCLUDE_ALL_GCS |
333 #if INCLUDE_G1GC |
332 if (UseG1GC) { |
334 if (UseG1GC) { |
333 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
335 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
334 const HeapRegion* hr = g1h->heap_region_containing(p); |
336 const HeapRegion* hr = g1h->heap_region_containing(p); |
335 if (hr == NULL) { |
337 if (hr == NULL) { |
336 return false; |
338 return false; |
337 } |
339 } |
338 return !(hr->is_young()); |
340 return !(hr->is_young()); |
339 } else if (UseParallelGC) { |
341 } |
|
342 #endif |
|
343 #if INCLUDE_PARALLELGC |
|
344 if (UseParallelGC) { |
340 ParallelScavengeHeap* psh = ParallelScavengeHeap::heap(); |
345 ParallelScavengeHeap* psh = ParallelScavengeHeap::heap(); |
341 return !psh->is_in_young(p); |
346 return !psh->is_in_young(p); |
342 } |
347 } |
343 #endif // INCLUDE_ALL_GCS |
348 #endif // INCLUDE_PARALLELGC |
344 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
349 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
345 return !gch->is_in_young(p); |
350 return !gch->is_in_young(p); |
346 WB_END |
351 WB_END |
347 |
352 |
348 WB_ENTRY(jlong, WB_GetObjectSize(JNIEnv* env, jobject o, jobject obj)) |
353 WB_ENTRY(jlong, WB_GetObjectSize(JNIEnv* env, jobject o, jobject obj)) |
469 return (jint)HeapRegion::GrainBytes; |
475 return (jint)HeapRegion::GrainBytes; |
470 } |
476 } |
471 THROW_MSG_0(vmSymbols::java_lang_UnsupportedOperationException(), "WB_G1RegionSize: G1 GC is not enabled"); |
477 THROW_MSG_0(vmSymbols::java_lang_UnsupportedOperationException(), "WB_G1RegionSize: G1 GC is not enabled"); |
472 WB_END |
478 WB_END |
473 |
479 |
|
480 #endif // INCLUDE_G1GC |
|
481 |
|
482 #if INCLUDE_PARALLELGC |
|
483 |
474 WB_ENTRY(jlong, WB_PSVirtualSpaceAlignment(JNIEnv* env, jobject o)) |
484 WB_ENTRY(jlong, WB_PSVirtualSpaceAlignment(JNIEnv* env, jobject o)) |
475 #if INCLUDE_ALL_GCS |
|
476 if (UseParallelGC) { |
485 if (UseParallelGC) { |
477 return ParallelScavengeHeap::heap()->gens()->virtual_spaces()->alignment(); |
486 return ParallelScavengeHeap::heap()->gens()->virtual_spaces()->alignment(); |
478 } |
487 } |
479 #endif // INCLUDE_ALL_GCS |
|
480 THROW_MSG_0(vmSymbols::java_lang_UnsupportedOperationException(), "WB_PSVirtualSpaceAlignment: Parallel GC is not enabled"); |
488 THROW_MSG_0(vmSymbols::java_lang_UnsupportedOperationException(), "WB_PSVirtualSpaceAlignment: Parallel GC is not enabled"); |
481 WB_END |
489 WB_END |
482 |
490 |
483 WB_ENTRY(jlong, WB_PSHeapGenerationAlignment(JNIEnv* env, jobject o)) |
491 WB_ENTRY(jlong, WB_PSHeapGenerationAlignment(JNIEnv* env, jobject o)) |
484 #if INCLUDE_ALL_GCS |
|
485 if (UseParallelGC) { |
492 if (UseParallelGC) { |
486 return ParallelScavengeHeap::heap()->generation_alignment(); |
493 return ParallelScavengeHeap::heap()->generation_alignment(); |
487 } |
494 } |
488 #endif // INCLUDE_ALL_GCS |
|
489 THROW_MSG_0(vmSymbols::java_lang_UnsupportedOperationException(), "WB_PSHeapGenerationAlignment: Parallel GC is not enabled"); |
495 THROW_MSG_0(vmSymbols::java_lang_UnsupportedOperationException(), "WB_PSHeapGenerationAlignment: Parallel GC is not enabled"); |
490 WB_END |
496 WB_END |
491 |
497 |
|
498 #endif // INCLUDE_PARALLELGC |
|
499 |
|
500 #if INCLUDE_G1GC |
|
501 |
492 WB_ENTRY(jobject, WB_G1AuxiliaryMemoryUsage(JNIEnv* env)) |
502 WB_ENTRY(jobject, WB_G1AuxiliaryMemoryUsage(JNIEnv* env)) |
493 #if INCLUDE_ALL_GCS |
|
494 if (UseG1GC) { |
503 if (UseG1GC) { |
495 ResourceMark rm(THREAD); |
504 ResourceMark rm(THREAD); |
496 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
505 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
497 MemoryUsage usage = g1h->get_auxiliary_data_memory_usage(); |
506 MemoryUsage usage = g1h->get_auxiliary_data_memory_usage(); |
498 Handle h = MemoryService::create_MemoryUsage_obj(usage, CHECK_NULL); |
507 Handle h = MemoryService::create_MemoryUsage_obj(usage, CHECK_NULL); |
499 return JNIHandles::make_local(env, h()); |
508 return JNIHandles::make_local(env, h()); |
500 } |
509 } |
501 #endif // INCLUDE_ALL_GCS |
|
502 THROW_MSG_0(vmSymbols::java_lang_UnsupportedOperationException(), "WB_G1AuxiliaryMemoryUsage: G1 GC is not enabled"); |
510 THROW_MSG_0(vmSymbols::java_lang_UnsupportedOperationException(), "WB_G1AuxiliaryMemoryUsage: G1 GC is not enabled"); |
503 WB_END |
511 WB_END |
504 |
512 |
505 class OldRegionsLivenessClosure: public HeapRegionClosure { |
513 class OldRegionsLivenessClosure: public HeapRegionClosure { |
506 |
514 |
559 result->long_at_put(1, rli.total_memory()); |
567 result->long_at_put(1, rli.total_memory()); |
560 result->long_at_put(2, rli.total_memory_to_free()); |
568 result->long_at_put(2, rli.total_memory_to_free()); |
561 return (jlongArray) JNIHandles::make_local(env, result); |
569 return (jlongArray) JNIHandles::make_local(env, result); |
562 WB_END |
570 WB_END |
563 |
571 |
564 #endif // INCLUDE_ALL_GCS |
572 #endif // INCLUDE_G1GC |
565 |
573 |
566 #if INCLUDE_NMT |
574 #if INCLUDE_NMT |
567 // Alloc memory using the test memory type so that we can use that to see if |
575 // Alloc memory using the test memory type so that we can use that to see if |
568 // NMT picks it up correctly |
576 // NMT picks it up correctly |
569 WB_ENTRY(jlong, WB_NMTMalloc(JNIEnv* env, jobject o, jlong size)) |
577 WB_ENTRY(jlong, WB_NMTMalloc(JNIEnv* env, jobject o, jlong size)) |
1216 WB_END |
1224 WB_END |
1217 |
1225 |
1218 WB_ENTRY(void, WB_FullGC(JNIEnv* env, jobject o)) |
1226 WB_ENTRY(void, WB_FullGC(JNIEnv* env, jobject o)) |
1219 Universe::heap()->soft_ref_policy()->set_should_clear_all_soft_refs(true); |
1227 Universe::heap()->soft_ref_policy()->set_should_clear_all_soft_refs(true); |
1220 Universe::heap()->collect(GCCause::_wb_full_gc); |
1228 Universe::heap()->collect(GCCause::_wb_full_gc); |
1221 #if INCLUDE_ALL_GCS |
1229 #if INCLUDE_G1GC |
1222 if (UseG1GC) { |
1230 if (UseG1GC) { |
1223 // Needs to be cleared explicitly for G1 |
1231 // Needs to be cleared explicitly for G1 |
1224 Universe::heap()->soft_ref_policy()->set_should_clear_all_soft_refs(false); |
1232 Universe::heap()->soft_ref_policy()->set_should_clear_all_soft_refs(false); |
1225 } |
1233 } |
1226 #endif // INCLUDE_ALL_GCS |
1234 #endif // INCLUDE_G1GC |
1227 WB_END |
1235 WB_END |
1228 |
1236 |
1229 WB_ENTRY(void, WB_YoungGC(JNIEnv* env, jobject o)) |
1237 WB_ENTRY(void, WB_YoungGC(JNIEnv* env, jobject o)) |
1230 Universe::heap()->collect(GCCause::_wb_young_gc); |
1238 Universe::heap()->collect(GCCause::_wb_young_gc); |
1231 WB_END |
1239 WB_END |
1958 {CC"readFromNoaccessArea",CC"()V", (void*)&WB_ReadFromNoaccessArea}, |
1966 {CC"readFromNoaccessArea",CC"()V", (void*)&WB_ReadFromNoaccessArea}, |
1959 {CC"stressVirtualSpaceResize",CC"(JJJ)I", (void*)&WB_StressVirtualSpaceResize}, |
1967 {CC"stressVirtualSpaceResize",CC"(JJJ)I", (void*)&WB_StressVirtualSpaceResize}, |
1960 #if INCLUDE_CDS |
1968 #if INCLUDE_CDS |
1961 {CC"getOffsetForName0", CC"(Ljava/lang/String;)I", (void*)&WB_GetOffsetForName}, |
1969 {CC"getOffsetForName0", CC"(Ljava/lang/String;)I", (void*)&WB_GetOffsetForName}, |
1962 #endif |
1970 #endif |
1963 #if INCLUDE_ALL_GCS |
1971 #if INCLUDE_G1GC |
1964 {CC"g1InConcurrentMark", CC"()Z", (void*)&WB_G1InConcurrentMark}, |
1972 {CC"g1InConcurrentMark", CC"()Z", (void*)&WB_G1InConcurrentMark}, |
1965 {CC"g1IsHumongous0", CC"(Ljava/lang/Object;)Z", (void*)&WB_G1IsHumongous }, |
1973 {CC"g1IsHumongous0", CC"(Ljava/lang/Object;)Z", (void*)&WB_G1IsHumongous }, |
1966 {CC"g1BelongsToHumongousRegion0", CC"(J)Z", (void*)&WB_G1BelongsToHumongousRegion}, |
1974 {CC"g1BelongsToHumongousRegion0", CC"(J)Z", (void*)&WB_G1BelongsToHumongousRegion}, |
1967 {CC"g1BelongsToFreeRegion0", CC"(J)Z", (void*)&WB_G1BelongsToFreeRegion}, |
1975 {CC"g1BelongsToFreeRegion0", CC"(J)Z", (void*)&WB_G1BelongsToFreeRegion}, |
1968 {CC"g1NumMaxRegions", CC"()J", (void*)&WB_G1NumMaxRegions }, |
1976 {CC"g1NumMaxRegions", CC"()J", (void*)&WB_G1NumMaxRegions }, |
1969 {CC"g1NumFreeRegions", CC"()J", (void*)&WB_G1NumFreeRegions }, |
1977 {CC"g1NumFreeRegions", CC"()J", (void*)&WB_G1NumFreeRegions }, |
1970 {CC"g1RegionSize", CC"()I", (void*)&WB_G1RegionSize }, |
1978 {CC"g1RegionSize", CC"()I", (void*)&WB_G1RegionSize }, |
1971 {CC"g1StartConcMarkCycle", CC"()Z", (void*)&WB_G1StartMarkCycle }, |
1979 {CC"g1StartConcMarkCycle", CC"()Z", (void*)&WB_G1StartMarkCycle }, |
1972 {CC"g1AuxiliaryMemoryUsage", CC"()Ljava/lang/management/MemoryUsage;", |
1980 {CC"g1AuxiliaryMemoryUsage", CC"()Ljava/lang/management/MemoryUsage;", |
1973 (void*)&WB_G1AuxiliaryMemoryUsage }, |
1981 (void*)&WB_G1AuxiliaryMemoryUsage }, |
|
1982 {CC"g1GetMixedGCInfo", CC"(I)[J", (void*)&WB_G1GetMixedGCInfo }, |
|
1983 #endif // INCLUDE_G1GC |
|
1984 #if INCLUDE_PARALLELGC |
1974 {CC"psVirtualSpaceAlignment",CC"()J", (void*)&WB_PSVirtualSpaceAlignment}, |
1985 {CC"psVirtualSpaceAlignment",CC"()J", (void*)&WB_PSVirtualSpaceAlignment}, |
1975 {CC"psHeapGenerationAlignment",CC"()J", (void*)&WB_PSHeapGenerationAlignment}, |
1986 {CC"psHeapGenerationAlignment",CC"()J", (void*)&WB_PSHeapGenerationAlignment}, |
1976 {CC"g1GetMixedGCInfo", CC"(I)[J", (void*)&WB_G1GetMixedGCInfo }, |
1987 #endif |
1977 #endif // INCLUDE_ALL_GCS |
|
1978 #if INCLUDE_NMT |
1988 #if INCLUDE_NMT |
1979 {CC"NMTMalloc", CC"(J)J", (void*)&WB_NMTMalloc }, |
1989 {CC"NMTMalloc", CC"(J)J", (void*)&WB_NMTMalloc }, |
1980 {CC"NMTMallocWithPseudoStack", CC"(JI)J", (void*)&WB_NMTMallocWithPseudoStack}, |
1990 {CC"NMTMallocWithPseudoStack", CC"(JI)J", (void*)&WB_NMTMallocWithPseudoStack}, |
1981 {CC"NMTFree", CC"(J)V", (void*)&WB_NMTFree }, |
1991 {CC"NMTFree", CC"(J)V", (void*)&WB_NMTFree }, |
1982 {CC"NMTReserveMemory", CC"(J)J", (void*)&WB_NMTReserveMemory }, |
1992 {CC"NMTReserveMemory", CC"(J)J", (void*)&WB_NMTReserveMemory }, |