2478 |
2478 |
2479 |
2479 |
2480 size_t MetaspaceAux::_allocated_capacity_words[] = {0, 0}; |
2480 size_t MetaspaceAux::_allocated_capacity_words[] = {0, 0}; |
2481 size_t MetaspaceAux::_allocated_used_words[] = {0, 0}; |
2481 size_t MetaspaceAux::_allocated_used_words[] = {0, 0}; |
2482 |
2482 |
|
2483 size_t MetaspaceAux::free_bytes(Metaspace::MetadataType mdtype) { |
|
2484 VirtualSpaceList* list = Metaspace::get_space_list(mdtype); |
|
2485 return list == NULL ? 0 : list->free_bytes(); |
|
2486 } |
|
2487 |
2483 size_t MetaspaceAux::free_bytes() { |
2488 size_t MetaspaceAux::free_bytes() { |
2484 size_t result = 0; |
2489 return free_bytes(Metaspace::ClassType) + free_bytes(Metaspace::NonClassType); |
2485 if (Metaspace::using_class_space() && |
|
2486 (Metaspace::class_space_list() != NULL)) { |
|
2487 result = result + Metaspace::class_space_list()->free_bytes(); |
|
2488 } |
|
2489 if (Metaspace::space_list() != NULL) { |
|
2490 result = result + Metaspace::space_list()->free_bytes(); |
|
2491 } |
|
2492 return result; |
|
2493 } |
2490 } |
2494 |
2491 |
2495 void MetaspaceAux::dec_capacity(Metaspace::MetadataType mdtype, size_t words) { |
2492 void MetaspaceAux::dec_capacity(Metaspace::MetadataType mdtype, size_t words) { |
2496 assert_lock_strong(SpaceManager::expand_lock()); |
2493 assert_lock_strong(SpaceManager::expand_lock()); |
2497 assert(words <= allocated_capacity_words(mdtype), |
2494 assert(words <= allocated_capacity_words(mdtype), |
2569 } |
2566 } |
2570 return capacity * BytesPerWord; |
2567 return capacity * BytesPerWord; |
2571 } |
2568 } |
2572 |
2569 |
2573 size_t MetaspaceAux::reserved_in_bytes(Metaspace::MetadataType mdtype) { |
2570 size_t MetaspaceAux::reserved_in_bytes(Metaspace::MetadataType mdtype) { |
2574 if (mdtype == Metaspace::ClassType) { |
2571 VirtualSpaceList* list = Metaspace::get_space_list(mdtype); |
2575 return Metaspace::using_class_space() ? |
2572 return list == NULL ? 0 : list->virtual_space_total(); |
2576 Metaspace::class_space_list()->virtual_space_total() * BytesPerWord : 0; |
|
2577 } else { |
|
2578 return Metaspace::space_list()->virtual_space_total() * BytesPerWord; |
|
2579 } |
|
2580 } |
2573 } |
2581 |
2574 |
2582 size_t MetaspaceAux::min_chunk_size() { return Metaspace::first_chunk_word_size(); } |
2575 size_t MetaspaceAux::min_chunk_size() { return Metaspace::first_chunk_word_size(); } |
2583 |
2576 |
2584 size_t MetaspaceAux::free_chunks_total(Metaspace::MetadataType mdtype) { |
2577 size_t MetaspaceAux::free_chunks_total(Metaspace::MetadataType mdtype) { |
2585 if ((mdtype == Metaspace::ClassType) && !Metaspace::using_class_space()) { |
2578 VirtualSpaceList* list = Metaspace::get_space_list(mdtype); |
|
2579 if (list == NULL) { |
2586 return 0; |
2580 return 0; |
2587 } |
2581 } |
2588 ChunkManager* chunk = (mdtype == Metaspace::ClassType) ? |
2582 ChunkManager* chunk = list->chunk_manager(); |
2589 Metaspace::class_space_list()->chunk_manager() : |
|
2590 Metaspace::space_list()->chunk_manager(); |
|
2591 chunk->slow_verify(); |
2583 chunk->slow_verify(); |
2592 return chunk->free_chunks_total(); |
2584 return chunk->free_chunks_total(); |
2593 } |
2585 } |
2594 |
2586 |
2595 size_t MetaspaceAux::free_chunks_total_in_bytes(Metaspace::MetadataType mdtype) { |
2587 size_t MetaspaceAux::free_chunks_total_in_bytes(Metaspace::MetadataType mdtype) { |