< prev index next >

src/hotspot/share/memory/metaspace.cpp

Print this page




 377 
 378 size_t MetaspaceUtils::free_in_vs_bytes() {
 379   return free_in_vs_bytes(Metaspace::ClassType) + free_in_vs_bytes(Metaspace::NonClassType);
 380 }
 381 
 382 static void inc_stat_nonatomically(size_t* pstat, size_t words) {
 383   assert_lock_strong(MetaspaceExpand_lock);
 384   (*pstat) += words;
 385 }
 386 
 387 static void dec_stat_nonatomically(size_t* pstat, size_t words) {
 388   assert_lock_strong(MetaspaceExpand_lock);
 389   const size_t size_now = *pstat;
 390   assert(size_now >= words, "About to decrement counter below zero "
 391          "(current value: " SIZE_FORMAT ", decrement value: " SIZE_FORMAT ".",
 392          size_now, words);
 393   *pstat = size_now - words;
 394 }
 395 
 396 static void inc_stat_atomically(volatile size_t* pstat, size_t words) {
 397   Atomic::add(words, pstat);
 398 }
 399 
 400 static void dec_stat_atomically(volatile size_t* pstat, size_t words) {
 401   const size_t size_now = *pstat;
 402   assert(size_now >= words, "About to decrement counter below zero "
 403          "(current value: " SIZE_FORMAT ", decrement value: " SIZE_FORMAT ".",
 404          size_now, words);
 405   Atomic::sub(words, pstat);
 406 }
 407 
 408 void MetaspaceUtils::dec_capacity(Metaspace::MetadataType mdtype, size_t words) {
 409   dec_stat_nonatomically(&_capacity_words[mdtype], words);
 410 }
 411 void MetaspaceUtils::inc_capacity(Metaspace::MetadataType mdtype, size_t words) {
 412   inc_stat_nonatomically(&_capacity_words[mdtype], words);
 413 }
 414 void MetaspaceUtils::dec_used(Metaspace::MetadataType mdtype, size_t words) {
 415   dec_stat_atomically(&_used_words[mdtype], words);
 416 }
 417 void MetaspaceUtils::inc_used(Metaspace::MetadataType mdtype, size_t words) {




 377 
 378 size_t MetaspaceUtils::free_in_vs_bytes() {
 379   return free_in_vs_bytes(Metaspace::ClassType) + free_in_vs_bytes(Metaspace::NonClassType);
 380 }
 381 
 382 static void inc_stat_nonatomically(size_t* pstat, size_t words) {
 383   assert_lock_strong(MetaspaceExpand_lock);
 384   (*pstat) += words;
 385 }
 386 
 387 static void dec_stat_nonatomically(size_t* pstat, size_t words) {
 388   assert_lock_strong(MetaspaceExpand_lock);
 389   const size_t size_now = *pstat;
 390   assert(size_now >= words, "About to decrement counter below zero "
 391          "(current value: " SIZE_FORMAT ", decrement value: " SIZE_FORMAT ".",
 392          size_now, words);
 393   *pstat = size_now - words;
 394 }
 395 
 396 static void inc_stat_atomically(volatile size_t* pstat, size_t words) {
 397   Atomic::add(pstat, words);
 398 }
 399 
 400 static void dec_stat_atomically(volatile size_t* pstat, size_t words) {
 401   const size_t size_now = *pstat;
 402   assert(size_now >= words, "About to decrement counter below zero "
 403          "(current value: " SIZE_FORMAT ", decrement value: " SIZE_FORMAT ".",
 404          size_now, words);
 405   Atomic::sub(words, pstat);
 406 }
 407 
 408 void MetaspaceUtils::dec_capacity(Metaspace::MetadataType mdtype, size_t words) {
 409   dec_stat_nonatomically(&_capacity_words[mdtype], words);
 410 }
 411 void MetaspaceUtils::inc_capacity(Metaspace::MetadataType mdtype, size_t words) {
 412   inc_stat_nonatomically(&_capacity_words[mdtype], words);
 413 }
 414 void MetaspaceUtils::dec_used(Metaspace::MetadataType mdtype, size_t words) {
 415   dec_stat_atomically(&_used_words[mdtype], words);
 416 }
 417 void MetaspaceUtils::inc_used(Metaspace::MetadataType mdtype, size_t words) {


< prev index next >