src/share/vm/memory/referenceProcessor.cpp

changeset 3357
441e946dc1af
parent 3339
e7dead7e90af
child 3900
d2a62e0f25eb
     1.1 --- a/src/share/vm/memory/referenceProcessor.cpp	Wed Dec 21 07:53:53 2011 -0500
     1.2 +++ b/src/share/vm/memory/referenceProcessor.cpp	Wed Dec 14 13:34:57 2011 -0800
     1.3 @@ -88,9 +88,9 @@
     1.4  
     1.5  ReferenceProcessor::ReferenceProcessor(MemRegion span,
     1.6                                         bool      mt_processing,
     1.7 -                                       int       mt_processing_degree,
     1.8 +                                       uint      mt_processing_degree,
     1.9                                         bool      mt_discovery,
    1.10 -                                       int       mt_discovery_degree,
    1.11 +                                       uint      mt_discovery_degree,
    1.12                                         bool      atomic_discovery,
    1.13                                         BoolObjectClosure* is_alive_non_header,
    1.14                                         bool      discovered_list_needs_barrier)  :
    1.15 @@ -105,7 +105,7 @@
    1.16    _span = span;
    1.17    _discovery_is_atomic = atomic_discovery;
    1.18    _discovery_is_mt     = mt_discovery;
    1.19 -  _num_q               = MAX2(1, mt_processing_degree);
    1.20 +  _num_q               = MAX2(1U, mt_processing_degree);
    1.21    _max_num_q           = MAX2(_num_q, mt_discovery_degree);
    1.22    _discovered_refs     = NEW_C_HEAP_ARRAY(DiscoveredList,
    1.23                                            _max_num_q * number_of_subclasses_of_ref());
    1.24 @@ -118,7 +118,7 @@
    1.25    _discoveredPhantomRefs = &_discoveredFinalRefs[_max_num_q];
    1.26  
    1.27    // Initialize all entries to NULL
    1.28 -  for (int i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
    1.29 +  for (uint i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
    1.30      _discovered_refs[i].set_head(NULL);
    1.31      _discovered_refs[i].set_length(0);
    1.32    }
    1.33 @@ -133,7 +133,7 @@
    1.34  #ifndef PRODUCT
    1.35  void ReferenceProcessor::verify_no_references_recorded() {
    1.36    guarantee(!_discovering_refs, "Discovering refs?");
    1.37 -  for (int i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
    1.38 +  for (uint i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
    1.39      guarantee(_discovered_refs[i].is_empty(),
    1.40                "Found non-empty discovered list");
    1.41    }
    1.42 @@ -141,7 +141,7 @@
    1.43  #endif
    1.44  
    1.45  void ReferenceProcessor::weak_oops_do(OopClosure* f) {
    1.46 -  for (int i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
    1.47 +  for (uint i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
    1.48      if (UseCompressedOops) {
    1.49        f->do_oop((narrowOop*)_discovered_refs[i].adr_head());
    1.50      } else {
    1.51 @@ -437,7 +437,7 @@
    1.52      task_executor->execute(tsk);
    1.53    } else {
    1.54      // Serial code: call the parent class's implementation
    1.55 -    for (int i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
    1.56 +    for (uint i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
    1.57        enqueue_discovered_reflist(_discovered_refs[i], pending_list_addr);
    1.58        _discovered_refs[i].set_head(NULL);
    1.59        _discovered_refs[i].set_length(0);
    1.60 @@ -696,7 +696,7 @@
    1.61  
    1.62  void ReferenceProcessor::abandon_partial_discovery() {
    1.63    // loop over the lists
    1.64 -  for (int i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
    1.65 +  for (uint i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
    1.66      if (TraceReferenceGC && PrintGCDetails && ((i % _max_num_q) == 0)) {
    1.67        gclog_or_tty->print_cr("\nAbandoning %s discovered list", list_name(i));
    1.68      }
    1.69 @@ -787,7 +787,7 @@
    1.70      gclog_or_tty->print_cr("\nBalance ref_lists ");
    1.71    }
    1.72  
    1.73 -  for (int i = 0; i < _max_num_q; ++i) {
    1.74 +  for (uint i = 0; i < _max_num_q; ++i) {
    1.75      total_refs += ref_lists[i].length();
    1.76      if (TraceReferenceGC && PrintGCDetails) {
    1.77        gclog_or_tty->print("%d ", ref_lists[i].length());
    1.78 @@ -797,8 +797,8 @@
    1.79      gclog_or_tty->print_cr(" = %d", total_refs);
    1.80    }
    1.81    size_t avg_refs = total_refs / _num_q + 1;
    1.82 -  int to_idx = 0;
    1.83 -  for (int from_idx = 0; from_idx < _max_num_q; from_idx++) {
    1.84 +  uint to_idx = 0;
    1.85 +  for (uint from_idx = 0; from_idx < _max_num_q; from_idx++) {
    1.86      bool move_all = false;
    1.87      if (from_idx >= _num_q) {
    1.88        move_all = ref_lists[from_idx].length() > 0;
    1.89 @@ -857,7 +857,7 @@
    1.90    }
    1.91  #ifdef ASSERT
    1.92    size_t balanced_total_refs = 0;
    1.93 -  for (int i = 0; i < _max_num_q; ++i) {
    1.94 +  for (uint i = 0; i < _max_num_q; ++i) {
    1.95      balanced_total_refs += ref_lists[i].length();
    1.96      if (TraceReferenceGC && PrintGCDetails) {
    1.97        gclog_or_tty->print("%d ", ref_lists[i].length());
    1.98 @@ -903,7 +903,7 @@
    1.99    }
   1.100    if (PrintReferenceGC && PrintGCDetails) {
   1.101      size_t total = 0;
   1.102 -    for (int i = 0; i < _max_num_q; ++i) {
   1.103 +    for (uint i = 0; i < _max_num_q; ++i) {
   1.104        total += refs_lists[i].length();
   1.105      }
   1.106      gclog_or_tty->print(", %u refs", total);
   1.107 @@ -919,7 +919,7 @@
   1.108        RefProcPhase1Task phase1(*this, refs_lists, policy, true /*marks_oops_alive*/);
   1.109        task_executor->execute(phase1);
   1.110      } else {
   1.111 -      for (int i = 0; i < _max_num_q; i++) {
   1.112 +      for (uint i = 0; i < _max_num_q; i++) {
   1.113          process_phase1(refs_lists[i], policy,
   1.114                         is_alive, keep_alive, complete_gc);
   1.115        }
   1.116 @@ -935,7 +935,7 @@
   1.117      RefProcPhase2Task phase2(*this, refs_lists, !discovery_is_atomic() /*marks_oops_alive*/);
   1.118      task_executor->execute(phase2);
   1.119    } else {
   1.120 -    for (int i = 0; i < _max_num_q; i++) {
   1.121 +    for (uint i = 0; i < _max_num_q; i++) {
   1.122        process_phase2(refs_lists[i], is_alive, keep_alive, complete_gc);
   1.123      }
   1.124    }
   1.125 @@ -946,7 +946,7 @@
   1.126      RefProcPhase3Task phase3(*this, refs_lists, clear_referent, true /*marks_oops_alive*/);
   1.127      task_executor->execute(phase3);
   1.128    } else {
   1.129 -    for (int i = 0; i < _max_num_q; i++) {
   1.130 +    for (uint i = 0; i < _max_num_q; i++) {
   1.131        process_phase3(refs_lists[i], clear_referent,
   1.132                       is_alive, keep_alive, complete_gc);
   1.133      }
   1.134 @@ -955,7 +955,7 @@
   1.135  
   1.136  void ReferenceProcessor::clean_up_discovered_references() {
   1.137    // loop over the lists
   1.138 -  for (int i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
   1.139 +  for (uint i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
   1.140      if (TraceReferenceGC && PrintGCDetails && ((i % _max_num_q) == 0)) {
   1.141        gclog_or_tty->print_cr(
   1.142          "\nScrubbing %s discovered list of Null referents",
   1.143 @@ -1000,7 +1000,7 @@
   1.144  }
   1.145  
   1.146  inline DiscoveredList* ReferenceProcessor::get_discovered_list(ReferenceType rt) {
   1.147 -  int id = 0;
   1.148 +  uint id = 0;
   1.149    // Determine the queue index to use for this object.
   1.150    if (_discovery_is_mt) {
   1.151      // During a multi-threaded discovery phase,
   1.152 @@ -1282,7 +1282,7 @@
   1.153    {
   1.154      TraceTime tt("Preclean SoftReferences", PrintGCDetails && PrintReferenceGC,
   1.155                false, gclog_or_tty);
   1.156 -    for (int i = 0; i < _max_num_q; i++) {
   1.157 +    for (uint i = 0; i < _max_num_q; i++) {
   1.158        if (yield->should_return()) {
   1.159          return;
   1.160        }
   1.161 @@ -1295,7 +1295,7 @@
   1.162    {
   1.163      TraceTime tt("Preclean WeakReferences", PrintGCDetails && PrintReferenceGC,
   1.164                false, gclog_or_tty);
   1.165 -    for (int i = 0; i < _max_num_q; i++) {
   1.166 +    for (uint i = 0; i < _max_num_q; i++) {
   1.167        if (yield->should_return()) {
   1.168          return;
   1.169        }
   1.170 @@ -1308,7 +1308,7 @@
   1.171    {
   1.172      TraceTime tt("Preclean FinalReferences", PrintGCDetails && PrintReferenceGC,
   1.173                false, gclog_or_tty);
   1.174 -    for (int i = 0; i < _max_num_q; i++) {
   1.175 +    for (uint i = 0; i < _max_num_q; i++) {
   1.176        if (yield->should_return()) {
   1.177          return;
   1.178        }
   1.179 @@ -1321,7 +1321,7 @@
   1.180    {
   1.181      TraceTime tt("Preclean PhantomReferences", PrintGCDetails && PrintReferenceGC,
   1.182                false, gclog_or_tty);
   1.183 -    for (int i = 0; i < _max_num_q; i++) {
   1.184 +    for (uint i = 0; i < _max_num_q; i++) {
   1.185        if (yield->should_return()) {
   1.186          return;
   1.187        }
   1.188 @@ -1386,7 +1386,7 @@
   1.189    )
   1.190  }
   1.191  
   1.192 -const char* ReferenceProcessor::list_name(int i) {
   1.193 +const char* ReferenceProcessor::list_name(uint i) {
   1.194     assert(i >= 0 && i <= _max_num_q * number_of_subclasses_of_ref(),
   1.195            "Out of bounds index");
   1.196  
   1.197 @@ -1410,7 +1410,7 @@
   1.198  #ifndef PRODUCT
   1.199  void ReferenceProcessor::clear_discovered_references() {
   1.200    guarantee(!_discovering_refs, "Discovering refs?");
   1.201 -  for (int i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
   1.202 +  for (uint i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
   1.203      clear_discovered_references(_discovered_refs[i]);
   1.204    }
   1.205  }

mercurial