206
207
208 // Free CompiledICHolder*s that are no longer in use
209 void InlineCacheBuffer::release_pending_icholders() {
210 assert(SafepointSynchronize::is_at_safepoint(), "should only be called during a safepoint");
211 CompiledICHolder* holder = _pending_released;
212 _pending_released = NULL;
213 while (holder != NULL) {
214 CompiledICHolder* next = holder->next();
215 delete holder;
216 holder = next;
217 _pending_count--;
218 }
219 assert(_pending_count == 0, "wrong count");
220 }
221
222 // Enqueue this icholder for release during the next safepoint. It's
223 // not safe to free them until them since they might be visible to
224 // another thread.
225 void InlineCacheBuffer::queue_for_release(CompiledICHolder* icholder) {
226 MutexLockerEx mex(InlineCacheBuffer_lock);
227 icholder->set_next(_pending_released);
228 _pending_released = icholder;
229 _pending_count++;
230 if (TraceICBuffer) {
231 tty->print_cr("enqueueing icholder " INTPTR_FORMAT " to be freed", p2i(icholder));
232 }
233 }
|
206
207
208 // Free CompiledICHolder*s that are no longer in use
209 void InlineCacheBuffer::release_pending_icholders() {
210 assert(SafepointSynchronize::is_at_safepoint(), "should only be called during a safepoint");
211 CompiledICHolder* holder = _pending_released;
212 _pending_released = NULL;
213 while (holder != NULL) {
214 CompiledICHolder* next = holder->next();
215 delete holder;
216 holder = next;
217 _pending_count--;
218 }
219 assert(_pending_count == 0, "wrong count");
220 }
221
222 // Enqueue this icholder for release during the next safepoint. It's
223 // not safe to free them until them since they might be visible to
224 // another thread.
225 void InlineCacheBuffer::queue_for_release(CompiledICHolder* icholder) {
226 MutexLockerEx mex(InlineCacheBuffer_lock, Mutex::_no_safepoint_check_flag);
227 if (icholder->is_enqueued()) {
228 return;
229 }
230 icholder->set_next(_pending_released);
231 icholder->set_enqueued();
232 _pending_released = icholder;
233 _pending_count++;
234 if (TraceICBuffer) {
235 tty->print_cr("enqueueing icholder " INTPTR_FORMAT " to be freed", p2i(icholder));
236 }
237 }
|