hotspot/src/share/vm/runtime/vmThread.cpp
changeset 46732 05423d4b10d2
parent 46589 f1c04490ded1
equal deleted inserted replaced
46731:71f1b50a1c6c 46732:05423d4b10d2
    23  */
    23  */
    24 
    24 
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
    26 #include "compiler/compileBroker.hpp"
    26 #include "compiler/compileBroker.hpp"
    27 #include "gc/shared/collectedHeap.hpp"
    27 #include "gc/shared/collectedHeap.hpp"
       
    28 #include "logging/log.hpp"
       
    29 #include "logging/logConfiguration.hpp"
    28 #include "memory/resourceArea.hpp"
    30 #include "memory/resourceArea.hpp"
    29 #include "oops/method.hpp"
    31 #include "oops/method.hpp"
    30 #include "oops/oop.inline.hpp"
    32 #include "oops/oop.inline.hpp"
    31 #include "oops/verifyOopClosure.hpp"
    33 #include "oops/verifyOopClosure.hpp"
    32 #include "runtime/interfaceSupport.hpp"
    34 #include "runtime/interfaceSupport.hpp"
   482         os::hint_no_preempt();
   484         os::hint_no_preempt();
   483 
   485 
   484       // If we are at a safepoint we will evaluate all the operations that
   486       // If we are at a safepoint we will evaluate all the operations that
   485       // follow that also require a safepoint
   487       // follow that also require a safepoint
   486       if (_cur_vm_operation->evaluate_at_safepoint()) {
   488       if (_cur_vm_operation->evaluate_at_safepoint()) {
       
   489         log_debug(vmthread)("Evaluating safepoint VM operation: %s", _cur_vm_operation->name());
   487 
   490 
   488         _vm_queue->set_drain_list(safepoint_ops); // ensure ops can be scanned
   491         _vm_queue->set_drain_list(safepoint_ops); // ensure ops can be scanned
   489 
   492 
   490         SafepointSynchronize::begin();
   493         SafepointSynchronize::begin();
   491         evaluate_operation(_cur_vm_operation);
   494         evaluate_operation(_cur_vm_operation);
   493         // the queue until there are none left
   496         // the queue until there are none left
   494         do {
   497         do {
   495           _cur_vm_operation = safepoint_ops;
   498           _cur_vm_operation = safepoint_ops;
   496           if (_cur_vm_operation != NULL) {
   499           if (_cur_vm_operation != NULL) {
   497             do {
   500             do {
       
   501               log_debug(vmthread)("Evaluating coalesced safepoint VM operation: %s", _cur_vm_operation->name());
   498               // evaluate_operation deletes the op object so we have
   502               // evaluate_operation deletes the op object so we have
   499               // to grab the next op now
   503               // to grab the next op now
   500               VM_Operation* next = _cur_vm_operation->next();
   504               VM_Operation* next = _cur_vm_operation->next();
   501               _vm_queue->set_drain_list(next);
   505               _vm_queue->set_drain_list(next);
   502               evaluate_operation(_cur_vm_operation);
   506               evaluate_operation(_cur_vm_operation);
   530 
   534 
   531         // Complete safepoint synchronization
   535         // Complete safepoint synchronization
   532         SafepointSynchronize::end();
   536         SafepointSynchronize::end();
   533 
   537 
   534       } else {  // not a safepoint operation
   538       } else {  // not a safepoint operation
       
   539         log_debug(vmthread)("Evaluating non-safepoint VM operation: %s", _cur_vm_operation->name());
   535         if (TraceLongCompiles) {
   540         if (TraceLongCompiles) {
   536           elapsedTimer t;
   541           elapsedTimer t;
   537           t.start();
   542           t.start();
   538           evaluate_operation(_cur_vm_operation);
   543           evaluate_operation(_cur_vm_operation);
   539           t.stop();
   544           t.stop();
   605     // Add VM operation to list of waiting threads. We are guaranteed not to block while holding the
   610     // Add VM operation to list of waiting threads. We are guaranteed not to block while holding the
   606     // VMOperationQueue_lock, so we can block without a safepoint check. This allows vm operation requests
   611     // VMOperationQueue_lock, so we can block without a safepoint check. This allows vm operation requests
   607     // to be queued up during a safepoint synchronization.
   612     // to be queued up during a safepoint synchronization.
   608     {
   613     {
   609       VMOperationQueue_lock->lock_without_safepoint_check();
   614       VMOperationQueue_lock->lock_without_safepoint_check();
       
   615       log_debug(vmthread)("Adding VM operation: %s", op->name());
   610       bool ok = _vm_queue->add(op);
   616       bool ok = _vm_queue->add(op);
   611     op->set_timestamp(os::javaTimeMillis());
   617       op->set_timestamp(os::javaTimeMillis());
   612       VMOperationQueue_lock->notify();
   618       VMOperationQueue_lock->notify();
   613       VMOperationQueue_lock->unlock();
   619       VMOperationQueue_lock->unlock();
   614       // VM_Operation got skipped
   620       // VM_Operation got skipped
   615       if (!ok) {
   621       if (!ok) {
   616         assert(concurrent, "can only skip concurrent tasks");
   622         assert(concurrent, "can only skip concurrent tasks");