src/hotspot/share/runtime/vmThread.cpp
changeset 50966 f939a67fea30
parent 50113 caf115bb98ad
child 51376 181e6a03249b
equal deleted inserted replaced
50965:29eaf3feab30 50966:f939a67fea30
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    45 #include "utilities/events.hpp"
    45 #include "utilities/events.hpp"
    46 #include "utilities/vmError.hpp"
    46 #include "utilities/vmError.hpp"
    47 #include "utilities/xmlstream.hpp"
    47 #include "utilities/xmlstream.hpp"
    48 
    48 
    49 // Dummy VM operation to act as first element in our circular double-linked list
    49 // Dummy VM operation to act as first element in our circular double-linked list
    50 class VM_Dummy: public VM_Operation {
    50 class VM_None: public VM_Operation {
    51   VMOp_Type type() const { return VMOp_Dummy; }
    51   VMOp_Type type() const { return VMOp_None; }
    52   void  doit() {};
    52   void  doit() {};
    53 };
    53 };
    54 
    54 
    55 VMOperationQueue::VMOperationQueue() {
    55 VMOperationQueue::VMOperationQueue() {
    56   // The queue is a circular doubled-linked list, which always contains
    56   // The queue is a circular doubled-linked list, which always contains
    57   // one element (i.e., one element means empty).
    57   // one element (i.e., one element means empty).
    58   for(int i = 0; i < nof_priorities; i++) {
    58   for(int i = 0; i < nof_priorities; i++) {
    59     _queue_length[i] = 0;
    59     _queue_length[i] = 0;
    60     _queue_counter = 0;
    60     _queue_counter = 0;
    61     _queue[i] = new VM_Dummy();
    61     _queue[i] = new VM_None();
    62     _queue[i]->set_next(_queue[i]);
    62     _queue[i]->set_next(_queue[i]);
    63     _queue[i]->set_prev(_queue[i]);
    63     _queue[i]->set_prev(_queue[i]);
    64   }
    64   }
    65   _drain_list = NULL;
    65   _drain_list = NULL;
    66 }
    66 }
   509               // to grab the next op now
   509               // to grab the next op now
   510               VM_Operation* next = _cur_vm_operation->next();
   510               VM_Operation* next = _cur_vm_operation->next();
   511               _vm_queue->set_drain_list(next);
   511               _vm_queue->set_drain_list(next);
   512               evaluate_operation(_cur_vm_operation);
   512               evaluate_operation(_cur_vm_operation);
   513               _cur_vm_operation = next;
   513               _cur_vm_operation = next;
   514               if (PrintSafepointStatistics) {
   514               if (log_is_enabled(Debug, safepoint, stats)) {
   515                 SafepointSynchronize::inc_vmop_coalesced_count();
   515                 SafepointSynchronize::inc_vmop_coalesced_count();
   516               }
   516               }
   517             } while (_cur_vm_operation != NULL);
   517             } while (_cur_vm_operation != NULL);
   518           }
   518           }
   519           // There is a chance that a thread enqueued a safepoint op
   519           // There is a chance that a thread enqueued a safepoint op