1501 return res;
1502 }
1503
1504 size_t ClassLoaderMetaspace::allocated_blocks_bytes() const {
1505 return (vsm()->used_words() +
1506 (Metaspace::using_class_space() ? class_vsm()->used_words() : 0)) * BytesPerWord;
1507 }
1508
1509 size_t ClassLoaderMetaspace::allocated_chunks_bytes() const {
1510 return (vsm()->capacity_words() +
1511 (Metaspace::using_class_space() ? class_vsm()->capacity_words() : 0)) * BytesPerWord;
1512 }
1513
1514 void ClassLoaderMetaspace::deallocate(MetaWord* ptr, size_t word_size, bool is_class) {
1515 Metaspace::assert_not_frozen();
1516 assert(!SafepointSynchronize::is_at_safepoint()
1517 || Thread::current()->is_VM_thread(), "should be the VM thread");
1518
1519 DEBUG_ONLY(Atomic::inc(&g_internal_statistics.num_external_deallocs));
1520
1521 MutexLockerEx ml(vsm()->lock(), Mutex::_no_safepoint_check_flag);
1522
1523 if (is_class && Metaspace::using_class_space()) {
1524 class_vsm()->deallocate(ptr, word_size);
1525 } else {
1526 vsm()->deallocate(ptr, word_size);
1527 }
1528 }
1529
1530 size_t ClassLoaderMetaspace::class_chunk_size(size_t word_size) {
1531 assert(Metaspace::using_class_space(), "Has to use class space");
1532 return class_vsm()->calc_chunk_size(word_size);
1533 }
1534
1535 void ClassLoaderMetaspace::print_on(outputStream* out) const {
1536 // Print both class virtual space counts and metaspace.
1537 if (Verbose) {
1538 vsm()->print_on(out);
1539 if (Metaspace::using_class_space()) {
1540 class_vsm()->print_on(out);
1541 }
|
1501 return res;
1502 }
1503
1504 size_t ClassLoaderMetaspace::allocated_blocks_bytes() const {
1505 return (vsm()->used_words() +
1506 (Metaspace::using_class_space() ? class_vsm()->used_words() : 0)) * BytesPerWord;
1507 }
1508
1509 size_t ClassLoaderMetaspace::allocated_chunks_bytes() const {
1510 return (vsm()->capacity_words() +
1511 (Metaspace::using_class_space() ? class_vsm()->capacity_words() : 0)) * BytesPerWord;
1512 }
1513
1514 void ClassLoaderMetaspace::deallocate(MetaWord* ptr, size_t word_size, bool is_class) {
1515 Metaspace::assert_not_frozen();
1516 assert(!SafepointSynchronize::is_at_safepoint()
1517 || Thread::current()->is_VM_thread(), "should be the VM thread");
1518
1519 DEBUG_ONLY(Atomic::inc(&g_internal_statistics.num_external_deallocs));
1520
1521 MutexLockerEx ml(vsm()->lock()->owned_by_self() ? NULL : vsm()->lock(),
1522 Mutex::_no_safepoint_check_flag);
1523
1524 if (is_class && Metaspace::using_class_space()) {
1525 class_vsm()->deallocate(ptr, word_size);
1526 } else {
1527 vsm()->deallocate(ptr, word_size);
1528 }
1529 }
1530
1531 size_t ClassLoaderMetaspace::class_chunk_size(size_t word_size) {
1532 assert(Metaspace::using_class_space(), "Has to use class space");
1533 return class_vsm()->calc_chunk_size(word_size);
1534 }
1535
1536 void ClassLoaderMetaspace::print_on(outputStream* out) const {
1537 // Print both class virtual space counts and metaspace.
1538 if (Verbose) {
1539 vsm()->print_on(out);
1540 if (Metaspace::using_class_space()) {
1541 class_vsm()->print_on(out);
1542 }
|