< prev index next >

src/hotspot/share/runtime/heapMonitoring.hpp

Print this page
rev 47590 : [mq]: heap8
rev 47591 : [mq]: heap10a
rev 47592 : [mq]: heap14_rebased

@@ -38,23 +38,21 @@
 
   // Statics for the fast log
   static const int FastLogNumBits = 10;
   static const int FastLogMask = (1 << FastLogNumBits) - 1;
   static double _log_table[1<<FastLogNumBits];  // Constant
-  static AlwaysTrueClosure _always_true;
 
   static void pick_next_sample(JavaThread *t);
 
   // Returns the next prng value.
   // pRNG is: aX+b mod c with a = 0x5DEECE66D, b =  0xB, c = 1<<48
   // This is the lrand64 generator.
   static inline uint64_t next_random(uint64_t rnd) {
     const uint64_t PrngMult = 0x5DEECE66DLL;
     const uint64_t prng_add = 0xB;
     const uint64_t prng_mod_power = 48;
-    const uint64_t prng_mod_mask =
-        ~((~static_cast<uint64_t>(0)) << prng_mod_power);
+    const uint64_t prng_mod_mask = right_n_bits(prng_mod_power);
     return (PrngMult * rnd + prng_add) & prng_mod_mask;
   }
 
   static inline double fast_log2(const double & d) {
     assert(d>0, "bad value passed to assert");

@@ -94,10 +92,11 @@
 
   // Called to clean up oops that have been saved by our sampling function,
   // but which no longer have other references in the heap.
   static void weak_oops_do(BoolObjectClosure* is_alive, OopClosure *f);
   static void weak_oops_do(OopClosure* oop_closure) {
+    AlwaysTrueClosure _always_true;
     weak_oops_do(&_always_true, oop_closure);
   }
 
   static bool enabled() {
     return _enabled;
< prev index next >