< prev index next >

src/hotspot/share/runtime/vmThread.cpp

Print this page

        

@@ -147,19 +147,25 @@
   }
 }
 
 //-----------------------------------------------------------------
 // High-level interface
-void VMOperationQueue::add(VM_Operation *op) {
+bool VMOperationQueue::add(VM_Operation *op) {
 
   HOTSPOT_VMOPS_REQUEST(
                    (char *) op->name(), strlen(op->name()),
                    op->evaluation_mode());
 
   // Encapsulates VM queue policy. Currently, that
   // only involves putting them on the right list
-  queue_add_back(op->evaluate_at_safepoint() ? SafepointPriority : MediumPriority, op);
+  if (op->evaluate_at_safepoint()) {
+    queue_add_back(SafepointPriority, op);
+    return true;
+  }
+
+  queue_add_back(MediumPriority, op);
+  return true;
 }
 
 VM_Operation* VMOperationQueue::remove_next() {
   // Assuming VMOperation queue is two-level priority queue. If there are
   // more than two priorities, we need a different scheduling algorithm.

@@ -694,14 +700,20 @@
     // VMOperationQueue_lock, so we can block without a safepoint check. This allows vm operation requests
     // to be queued up during a safepoint synchronization.
     {
       VMOperationQueue_lock->lock_without_safepoint_check();
       log_debug(vmthread)("Adding VM operation: %s", op->name());
-      _vm_queue->add(op);
+      bool ok = _vm_queue->add(op);
       op->set_timestamp(os::javaTimeMillis());
       VMOperationQueue_lock->notify();
       VMOperationQueue_lock->unlock();
+      // VM_Operation got skipped
+      if (!ok) {
+        assert(concurrent, "can only skip concurrent tasks");
+        if (op->is_cheap_allocated()) delete op;
+        return;
+      }
     }
 
     if (!concurrent) {
       // Wait for completion of request (non-concurrent)
       // Note: only a JavaThread triggers the safepoint check when locking
< prev index next >