--- a/hotspot/src/share/vm/prims/jvmtiImpl.cpp Fri May 05 17:48:45 2017 +0200
+++ b/hotspot/src/share/vm/prims/jvmtiImpl.cpp Fri May 05 14:22:35 2017 -0700
@@ -974,19 +974,14 @@
JvmtiDeferredEventQueue::QueueNode* JvmtiDeferredEventQueue::_queue_tail = NULL;
JvmtiDeferredEventQueue::QueueNode* JvmtiDeferredEventQueue::_queue_head = NULL;
-volatile JvmtiDeferredEventQueue::QueueNode*
- JvmtiDeferredEventQueue::_pending_list = NULL;
-
bool JvmtiDeferredEventQueue::has_events() {
assert(Service_lock->owned_by_self(), "Must own Service_lock");
- return _queue_head != NULL || _pending_list != NULL;
+ return _queue_head != NULL;
}
void JvmtiDeferredEventQueue::enqueue(const JvmtiDeferredEvent& event) {
assert(Service_lock->owned_by_self(), "Must own Service_lock");
- process_pending_events();
-
// Events get added to the end of the queue (and are pulled off the front).
QueueNode* node = new QueueNode(event);
if (_queue_tail == NULL) {
@@ -1005,8 +1000,6 @@
JvmtiDeferredEvent JvmtiDeferredEventQueue::dequeue() {
assert(Service_lock->owned_by_self(), "Must own Service_lock");
- process_pending_events();
-
assert(_queue_head != NULL, "Nothing to dequeue");
if (_queue_head == NULL) {
@@ -1027,62 +1020,3 @@
delete node;
return event;
}
-
-void JvmtiDeferredEventQueue::add_pending_event(
- const JvmtiDeferredEvent& event) {
-
- QueueNode* node = new QueueNode(event);
-
- bool success = false;
- QueueNode* prev_value = (QueueNode*)_pending_list;
- do {
- node->set_next(prev_value);
- prev_value = (QueueNode*)Atomic::cmpxchg_ptr(
- (void*)node, (volatile void*)&_pending_list, (void*)node->next());
- } while (prev_value != node->next());
-}
-
-// This method transfers any events that were added by someone NOT holding
-// the lock into the mainline queue.
-void JvmtiDeferredEventQueue::process_pending_events() {
- assert(Service_lock->owned_by_self(), "Must own Service_lock");
-
- if (_pending_list != NULL) {
- QueueNode* head =
- (QueueNode*)Atomic::xchg_ptr(NULL, (volatile void*)&_pending_list);
-
- assert((_queue_head == NULL) == (_queue_tail == NULL),
- "Inconsistent queue markers");
-
- if (head != NULL) {
- // Since we've treated the pending list as a stack (with newer
- // events at the beginning), we need to join the bottom of the stack
- // with the 'tail' of the queue in order to get the events in the
- // right order. We do this by reversing the pending list and appending
- // it to the queue.
-
- QueueNode* new_tail = head;
- QueueNode* new_head = NULL;
-
- // This reverses the list
- QueueNode* prev = new_tail;
- QueueNode* node = new_tail->next();
- new_tail->set_next(NULL);
- while (node != NULL) {
- QueueNode* next = node->next();
- node->set_next(prev);
- prev = node;
- node = next;
- }
- new_head = prev;
-
- // Now append the new list to the queue
- if (_queue_tail != NULL) {
- _queue_tail->set_next(new_head);
- } else { // _queue_head == NULL
- _queue_head = new_head;
- }
- _queue_tail = new_tail;
- }
- }
-}