comparison src/share/vm/utilities/taskqueue.cpp @ 375:81cd571500b0

6725697: par compact - rename class ChunkData to RegionData Reviewed-by: iveresov, tonyp
author jcoomes
date Tue, 30 Sep 2008 12:20:22 -0700
parents 37f87013dfd8
children ad8c8ca4ab0f
comparison
equal deleted inserted replaced
374:a4b729f5b611 375:81cd571500b0
107 "Terminator may still be in use"); 107 "Terminator may still be in use");
108 _offered_termination = 0; 108 _offered_termination = 0;
109 } 109 }
110 } 110 }
111 111
112 bool ChunkTaskQueueWithOverflow::is_empty() { 112 bool RegionTaskQueueWithOverflow::is_empty() {
113 return (_chunk_queue.size() == 0) && 113 return (_region_queue.size() == 0) &&
114 (_overflow_stack->length() == 0); 114 (_overflow_stack->length() == 0);
115 } 115 }
116 116
117 bool ChunkTaskQueueWithOverflow::stealable_is_empty() { 117 bool RegionTaskQueueWithOverflow::stealable_is_empty() {
118 return _chunk_queue.size() == 0; 118 return _region_queue.size() == 0;
119 } 119 }
120 120
121 bool ChunkTaskQueueWithOverflow::overflow_is_empty() { 121 bool RegionTaskQueueWithOverflow::overflow_is_empty() {
122 return _overflow_stack->length() == 0; 122 return _overflow_stack->length() == 0;
123 } 123 }
124 124
125 void ChunkTaskQueueWithOverflow::initialize() { 125 void RegionTaskQueueWithOverflow::initialize() {
126 _chunk_queue.initialize(); 126 _region_queue.initialize();
127 assert(_overflow_stack == 0, "Creating memory leak"); 127 assert(_overflow_stack == 0, "Creating memory leak");
128 _overflow_stack = 128 _overflow_stack =
129 new (ResourceObj::C_HEAP) GrowableArray<ChunkTask>(10, true); 129 new (ResourceObj::C_HEAP) GrowableArray<RegionTask>(10, true);
130 } 130 }
131 131
132 void ChunkTaskQueueWithOverflow::save(ChunkTask t) { 132 void RegionTaskQueueWithOverflow::save(RegionTask t) {
133 if (TraceChunkTasksQueuing && Verbose) { 133 if (TraceRegionTasksQueuing && Verbose) {
134 gclog_or_tty->print_cr("CTQ: save " PTR_FORMAT, t); 134 gclog_or_tty->print_cr("CTQ: save " PTR_FORMAT, t);
135 } 135 }
136 if(!_chunk_queue.push(t)) { 136 if(!_region_queue.push(t)) {
137 _overflow_stack->push(t); 137 _overflow_stack->push(t);
138 } 138 }
139 } 139 }
140 140
141 // Note that using this method will retrieve all chunks 141 // Note that using this method will retrieve all regions
142 // that have been saved but that it will always check 142 // that have been saved but that it will always check
143 // the overflow stack. It may be more efficient to 143 // the overflow stack. It may be more efficient to
144 // check the stealable queue and the overflow stack 144 // check the stealable queue and the overflow stack
145 // separately. 145 // separately.
146 bool ChunkTaskQueueWithOverflow::retrieve(ChunkTask& chunk_task) { 146 bool RegionTaskQueueWithOverflow::retrieve(RegionTask& region_task) {
147 bool result = retrieve_from_overflow(chunk_task); 147 bool result = retrieve_from_overflow(region_task);
148 if (!result) { 148 if (!result) {
149 result = retrieve_from_stealable_queue(chunk_task); 149 result = retrieve_from_stealable_queue(region_task);
150 } 150 }
151 if (TraceChunkTasksQueuing && Verbose && result) { 151 if (TraceRegionTasksQueuing && Verbose && result) {
152 gclog_or_tty->print_cr(" CTQ: retrieve " PTR_FORMAT, result); 152 gclog_or_tty->print_cr(" CTQ: retrieve " PTR_FORMAT, result);
153 } 153 }
154 return result; 154 return result;
155 } 155 }
156 156
157 bool ChunkTaskQueueWithOverflow::retrieve_from_stealable_queue( 157 bool RegionTaskQueueWithOverflow::retrieve_from_stealable_queue(
158 ChunkTask& chunk_task) { 158 RegionTask& region_task) {
159 bool result = _chunk_queue.pop_local(chunk_task); 159 bool result = _region_queue.pop_local(region_task);
160 if (TraceChunkTasksQueuing && Verbose) { 160 if (TraceRegionTasksQueuing && Verbose) {
161 gclog_or_tty->print_cr("CTQ: retrieve_stealable " PTR_FORMAT, chunk_task); 161 gclog_or_tty->print_cr("CTQ: retrieve_stealable " PTR_FORMAT, region_task);
162 } 162 }
163 return result; 163 return result;
164 } 164 }
165 165
166 bool ChunkTaskQueueWithOverflow::retrieve_from_overflow( 166 bool
167 ChunkTask& chunk_task) { 167 RegionTaskQueueWithOverflow::retrieve_from_overflow(RegionTask& region_task) {
168 bool result; 168 bool result;
169 if (!_overflow_stack->is_empty()) { 169 if (!_overflow_stack->is_empty()) {
170 chunk_task = _overflow_stack->pop(); 170 region_task = _overflow_stack->pop();
171 result = true; 171 result = true;
172 } else { 172 } else {
173 chunk_task = (ChunkTask) NULL; 173 region_task = (RegionTask) NULL;
174 result = false; 174 result = false;
175 } 175 }
176 if (TraceChunkTasksQueuing && Verbose) { 176 if (TraceRegionTasksQueuing && Verbose) {
177 gclog_or_tty->print_cr("CTQ: retrieve_stealable " PTR_FORMAT, chunk_task); 177 gclog_or_tty->print_cr("CTQ: retrieve_stealable " PTR_FORMAT, region_task);
178 } 178 }
179 return result; 179 return result;
180 } 180 }