< prev index next >

src/share/vm/gc/shared/taskqueue.cpp

Print this page
rev 8961 : [mq]: diff-shenandoah.patch


  90 // Invariants which should hold after a TaskQueue has been emptied and is
  91 // quiescent; they do not hold at arbitrary times.
  92 void TaskQueueStats::verify() const
  93 {
  94   assert(get(push) == get(pop) + get(steal),
  95          err_msg("push=" SIZE_FORMAT " pop=" SIZE_FORMAT " steal=" SIZE_FORMAT,
  96                  get(push), get(pop), get(steal)));
  97   assert(get(pop_slow) <= get(pop),
  98          err_msg("pop_slow=" SIZE_FORMAT " pop=" SIZE_FORMAT,
  99                  get(pop_slow), get(pop)));
 100   assert(get(steal) <= get(steal_attempt),
 101          err_msg("steal=" SIZE_FORMAT " steal_attempt=" SIZE_FORMAT,
 102                  get(steal), get(steal_attempt)));
 103   assert(get(overflow) == 0 || get(push) != 0,
 104          err_msg("overflow=" SIZE_FORMAT " push=" SIZE_FORMAT,
 105                  get(overflow), get(push)));
 106   assert(get(overflow_max_len) == 0 || get(overflow) != 0,
 107          err_msg("overflow_max_len=" SIZE_FORMAT " overflow=" SIZE_FORMAT,
 108                  get(overflow_max_len), get(overflow)));
 109 }











 110 #endif // ASSERT
 111 #endif // TASKQUEUE_STATS
 112 
 113 int TaskQueueSetSuper::randomParkAndMiller(int *seed0) {
 114   const int a =      16807;
 115   const int m = 2147483647;
 116   const int q =     127773;  /* m div a */
 117   const int r =       2836;  /* m mod a */
 118   assert(sizeof(int) == 4, "I think this relies on that");
 119   int seed = *seed0;
 120   int hi   = seed / q;
 121   int lo   = seed % q;
 122   int test = a * lo - r * hi;
 123   if (test > 0)
 124     seed = test;
 125   else
 126     seed = test + m;
 127   *seed0 = seed;
 128   return seed;
 129 }




  90 // Invariants which should hold after a TaskQueue has been emptied and is
  91 // quiescent; they do not hold at arbitrary times.
  92 void TaskQueueStats::verify() const
  93 {
  94   assert(get(push) == get(pop) + get(steal),
  95          err_msg("push=" SIZE_FORMAT " pop=" SIZE_FORMAT " steal=" SIZE_FORMAT,
  96                  get(push), get(pop), get(steal)));
  97   assert(get(pop_slow) <= get(pop),
  98          err_msg("pop_slow=" SIZE_FORMAT " pop=" SIZE_FORMAT,
  99                  get(pop_slow), get(pop)));
 100   assert(get(steal) <= get(steal_attempt),
 101          err_msg("steal=" SIZE_FORMAT " steal_attempt=" SIZE_FORMAT,
 102                  get(steal), get(steal_attempt)));
 103   assert(get(overflow) == 0 || get(push) != 0,
 104          err_msg("overflow=" SIZE_FORMAT " push=" SIZE_FORMAT,
 105                  get(overflow), get(push)));
 106   assert(get(overflow_max_len) == 0 || get(overflow) != 0,
 107          err_msg("overflow_max_len=" SIZE_FORMAT " overflow=" SIZE_FORMAT,
 108                  get(overflow_max_len), get(overflow)));
 109 }
 110 
 111 void TaskQueueStats::verify_only_pushes() const
 112 {
 113   assert((get(pop) == 0),
 114          err_msg("pops=" SIZE_FORMAT ,
 115                  get(pop)));
 116   assert((get(steal) == 0),
 117          err_msg("steals=" SIZE_FORMAT ,
 118                  get(steal)));
 119 }
 120 
 121 #endif // ASSERT
 122 #endif // TASKQUEUE_STATS
 123 
 124 int TaskQueueSetSuper::randomParkAndMiller(int *seed0) {
 125   const int a =      16807;
 126   const int m = 2147483647;
 127   const int q =     127773;  /* m div a */
 128   const int r =       2836;  /* m mod a */
 129   assert(sizeof(int) == 4, "I think this relies on that");
 130   int seed = *seed0;
 131   int hi   = seed / q;
 132   int lo   = seed % q;
 133   int test = a * lo - r * hi;
 134   if (test > 0)
 135     seed = test;
 136   else
 137     seed = test + m;
 138   *seed0 = seed;
 139   return seed;
 140 }


< prev index next >