Description
There's no Atomic:add version that operates on size_t typed variables. Instead the code resort to use Atomic::add_ptr, which takes an intptr_t.
By adding size versions of Atomic::add, dec, and inc, we could clean up the code base to use more correct types for our variables used with Atomic operations.
One example:
volatile intptr_t MetaspaceGC::_capacity_until_GC = 0;
is used as a size_t, but declared intptr_t to work well with:
size_t MetaspaceGC::inc_capacity_until_GC(size_t v) {
assert_is_size_aligned(v, Metaspace::commit_alignment());
return (size_t)Atomic::add_ptr(v, &_capacity_until_GC);
}
By adding size versions of Atomic::add, dec, and inc, we could clean up the code base to use more correct types for our variables used with Atomic operations.
One example:
volatile intptr_t MetaspaceGC::_capacity_until_GC = 0;
is used as a size_t, but declared intptr_t to work well with:
size_t MetaspaceGC::inc_capacity_until_GC(size_t v) {
assert_is_size_aligned(v, Metaspace::commit_alignment());
return (size_t)Atomic::add_ptr(v, &_capacity_until_GC);
}
Attachments
Issue Links
- relates to
-
JDK-8058960 Add size_t versions of Atomic::cmpxchg
-
- Closed
-