Mercurial > hg > graal-compiler
comparison src/share/vm/utilities/taskqueue.cpp @ 1709:5f429ee79634
6966222: G1: simplify TaskQueue overflow handling
Reviewed-by: tonyp, ysr
author | jcoomes |
---|---|
date | Mon, 09 Aug 2010 05:41:05 -0700 |
parents | a93a9eda13f7 |
children | 8b10f48633dc |
comparison
equal
deleted
inserted
replaced
1708:a03ae377b2e8 | 1709:5f429ee79634 |
---|---|
33 | 33 |
34 #if TASKQUEUE_STATS | 34 #if TASKQUEUE_STATS |
35 const char * const TaskQueueStats::_names[last_stat_id] = { | 35 const char * const TaskQueueStats::_names[last_stat_id] = { |
36 "qpush", "qpop", "qpop-s", "qattempt", "qsteal", "opush", "omax" | 36 "qpush", "qpop", "qpop-s", "qattempt", "qsteal", "opush", "omax" |
37 }; | 37 }; |
38 | |
39 TaskQueueStats & TaskQueueStats::operator +=(const TaskQueueStats & addend) | |
40 { | |
41 for (unsigned int i = 0; i < last_stat_id; ++i) { | |
42 _stats[i] += addend._stats[i]; | |
43 } | |
44 return *this; | |
45 } | |
38 | 46 |
39 void TaskQueueStats::print_header(unsigned int line, outputStream* const stream, | 47 void TaskQueueStats::print_header(unsigned int line, outputStream* const stream, |
40 unsigned int width) | 48 unsigned int width) |
41 { | 49 { |
42 // Use a width w: 1 <= w <= max_width | 50 // Use a width w: 1 <= w <= max_width |
69 for (unsigned int i = 1; i < last_stat_id; ++i) { | 77 for (unsigned int i = 1; i < last_stat_id; ++i) { |
70 stream->print(" " FMT, width, _stats[i]); | 78 stream->print(" " FMT, width, _stats[i]); |
71 } | 79 } |
72 #undef FMT | 80 #undef FMT |
73 } | 81 } |
82 | |
83 #ifdef ASSERT | |
84 // Invariants which should hold after a TaskQueue has been emptied and is | |
85 // quiescent; they do not hold at arbitrary times. | |
86 void TaskQueueStats::verify() const | |
87 { | |
88 assert(get(push) == get(pop) + get(steal), | |
89 err_msg("push=" SIZE_FORMAT " pop=" SIZE_FORMAT " steal=" SIZE_FORMAT, | |
90 get(push), get(pop), get(steal))); | |
91 assert(get(pop_slow) <= get(pop), | |
92 err_msg("pop_slow=" SIZE_FORMAT " pop=" SIZE_FORMAT, | |
93 get(pop_slow), get(pop))); | |
94 assert(get(steal) <= get(steal_attempt), | |
95 err_msg("steal=" SIZE_FORMAT " steal_attempt=" SIZE_FORMAT, | |
96 get(steal), get(steal_attempt))); | |
97 assert(get(overflow) == 0 || get(push) != 0, | |
98 err_msg("overflow=" SIZE_FORMAT " push=" SIZE_FORMAT, | |
99 get(overflow), get(push))); | |
100 assert(get(overflow_max_len) == 0 || get(overflow) != 0, | |
101 err_msg("overflow_max_len=" SIZE_FORMAT " overflow=" SIZE_FORMAT, | |
102 get(overflow_max_len), get(overflow))); | |
103 } | |
104 #endif // ASSERT | |
74 #endif // TASKQUEUE_STATS | 105 #endif // TASKQUEUE_STATS |
75 | 106 |
76 int TaskQueueSetSuper::randomParkAndMiller(int *seed0) { | 107 int TaskQueueSetSuper::randomParkAndMiller(int *seed0) { |
77 const int a = 16807; | 108 const int a = 16807; |
78 const int m = 2147483647; | 109 const int m = 2147483647; |