changeset 50668:bf9177eac58d

8189271: Metaspace::_capacity_until_GC should be size_t Summary: Change of member and some related local variables. Reviewed-by: tschatzl, stuefe
author aharlap
date Tue, 15 May 2018 19:26:00 -0400
parents 919c36db208c
children 9da00197ff72
files src/hotspot/share/memory/metaspace.cpp src/hotspot/share/memory/metaspace.hpp
diffstat 2 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/memory/metaspace.cpp	Tue May 15 14:41:06 2018 -0700
+++ b/src/hotspot/share/memory/metaspace.cpp	Tue May 15 19:26:00 2018 -0400
@@ -185,7 +185,7 @@
   return s;
 }
 
-volatile intptr_t MetaspaceGC::_capacity_until_GC = 0;
+volatile size_t MetaspaceGC::_capacity_until_GC = 0;
 uint MetaspaceGC::_shrink_factor = 0;
 bool MetaspaceGC::_should_concurrent_collect = false;
 
@@ -2417,16 +2417,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());
 
-  intptr_t capacity_until_GC = _capacity_until_GC;
-  intptr_t new_value = capacity_until_GC + v;
+  size_t capacity_until_GC = _capacity_until_GC;
+  size_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 = _capacity_until_GC;
-  intptr_t actual = Atomic::cmpxchg(new_value, &_capacity_until_GC, expected);
+  size_t expected = _capacity_until_GC;
+  size_t actual = Atomic::cmpxchg(new_value, &_capacity_until_GC, expected);
 
   if (expected != actual) {
     return false;
@@ -2444,7 +2444,7 @@
 size_t MetaspaceGC::dec_capacity_until_GC(size_t v) {
   assert_is_aligned(v, Metaspace::commit_alignment());
 
-  return (size_t)Atomic::sub((intptr_t)v, &_capacity_until_GC);
+  return Atomic::sub(v, &_capacity_until_GC);
 }
 
 void MetaspaceGC::initialize() {
--- a/src/hotspot/share/memory/metaspace.hpp	Tue May 15 14:41:06 2018 -0700
+++ b/src/hotspot/share/memory/metaspace.hpp	Tue May 15 19:26:00 2018 -0400
@@ -427,7 +427,7 @@
   // The current high-water-mark for inducing a GC.
   // When committed memory of all metaspaces reaches this value,
   // a GC is induced and the value is increased. Size is in bytes.
-  static volatile intptr_t _capacity_until_GC;
+  static volatile size_t _capacity_until_GC;
 
   // For a CMS collection, signal that a concurrent collection should
   // be started.