--- a/src/hotspot/share/memory/metaspace.cpp Mon Oct 16 20:22:41 2017 +0000
+++ b/src/hotspot/share/memory/metaspace.cpp Mon Oct 16 22:36:06 2017 -0400
@@ -1499,7 +1499,7 @@
}
size_t MetaspaceGC::capacity_until_GC() {
- size_t value = (size_t)OrderAccess::load_ptr_acquire(&_capacity_until_GC);
+ size_t value = OrderAccess::load_acquire(&_capacity_until_GC);
assert(value >= MetaspaceSize, "Not initialized properly?");
return value;
}
@@ -1507,16 +1507,16 @@
bool MetaspaceGC::inc_capacity_until_GC(size_t v, size_t* new_cap_until_GC, size_t* old_cap_until_GC) {
assert_is_aligned(v, Metaspace::commit_alignment());
- size_t capacity_until_GC = (size_t) _capacity_until_GC;
- size_t new_value = capacity_until_GC + v;
+ intptr_t capacity_until_GC = _capacity_until_GC;
+ intptr_t new_value = capacity_until_GC + v;
if (new_value < capacity_until_GC) {
// The addition wrapped around, set new_value to aligned max value.
new_value = align_down(max_uintx, Metaspace::commit_alignment());
}
- intptr_t expected = (intptr_t) capacity_until_GC;
- intptr_t actual = Atomic::cmpxchg_ptr((intptr_t) new_value, &_capacity_until_GC, expected);
+ intptr_t expected = _capacity_until_GC;
+ intptr_t actual = Atomic::cmpxchg(new_value, &_capacity_until_GC, expected);
if (expected != actual) {
return false;
@@ -1534,7 +1534,7 @@
size_t MetaspaceGC::dec_capacity_until_GC(size_t v) {
assert_is_aligned(v, Metaspace::commit_alignment());
- return (size_t)Atomic::add_ptr(-(intptr_t)v, &_capacity_until_GC);
+ return (size_t)Atomic::sub((intptr_t)v, &_capacity_until_GC);
}
void MetaspaceGC::initialize() {
@@ -2398,7 +2398,7 @@
void SpaceManager::inc_used_metrics(size_t words) {
// Add to the per SpaceManager total
- Atomic::add_ptr(words, &_allocated_blocks_words);
+ Atomic::add(words, &_allocated_blocks_words);
// Add to the global total
MetaspaceAux::inc_used(mdtype(), words);
}
@@ -2753,8 +2753,7 @@
// sweep which is a concurrent phase. Protection by the expand_lock()
// is not enough since allocation is on a per Metaspace basis
// and protected by the Metaspace lock.
- jlong minus_words = (jlong) - (jlong) words;
- Atomic::add_ptr(minus_words, &_used_words[mdtype]);
+ Atomic::sub(words, &_used_words[mdtype]);
}
void MetaspaceAux::inc_used(Metaspace::MetadataType mdtype, size_t words) {
@@ -2762,7 +2761,7 @@
// each piece of metadata. Those allocations are
// generally done concurrently by different application
// threads so must be done atomically.
- Atomic::add_ptr(words, &_used_words[mdtype]);
+ Atomic::add(words, &_used_words[mdtype]);
}
size_t MetaspaceAux::used_bytes_slow(Metaspace::MetadataType mdtype) {