equal
deleted
inserted
replaced
178 } |
178 } |
179 |
179 |
180 size_t MetaspaceGC::dec_capacity_until_GC(size_t v) { |
180 size_t MetaspaceGC::dec_capacity_until_GC(size_t v) { |
181 assert_is_aligned(v, Metaspace::commit_alignment()); |
181 assert_is_aligned(v, Metaspace::commit_alignment()); |
182 |
182 |
183 return Atomic::sub(v, &_capacity_until_GC); |
183 return Atomic::sub(&_capacity_until_GC, v); |
184 } |
184 } |
185 |
185 |
186 void MetaspaceGC::initialize() { |
186 void MetaspaceGC::initialize() { |
187 // Set the high-water mark to MaxMetapaceSize during VM initializaton since |
187 // Set the high-water mark to MaxMetapaceSize during VM initializaton since |
188 // we can't do a GC during initialization. |
188 // we can't do a GC during initialization. |
400 static void dec_stat_atomically(volatile size_t* pstat, size_t words) { |
400 static void dec_stat_atomically(volatile size_t* pstat, size_t words) { |
401 const size_t size_now = *pstat; |
401 const size_t size_now = *pstat; |
402 assert(size_now >= words, "About to decrement counter below zero " |
402 assert(size_now >= words, "About to decrement counter below zero " |
403 "(current value: " SIZE_FORMAT ", decrement value: " SIZE_FORMAT ".", |
403 "(current value: " SIZE_FORMAT ", decrement value: " SIZE_FORMAT ".", |
404 size_now, words); |
404 size_now, words); |
405 Atomic::sub(words, pstat); |
405 Atomic::sub(pstat, words); |
406 } |
406 } |
407 |
407 |
408 void MetaspaceUtils::dec_capacity(Metaspace::MetadataType mdtype, size_t words) { |
408 void MetaspaceUtils::dec_capacity(Metaspace::MetadataType mdtype, size_t words) { |
409 dec_stat_nonatomically(&_capacity_words[mdtype], words); |
409 dec_stat_nonatomically(&_capacity_words[mdtype], words); |
410 } |
410 } |