< prev index next >

src/share/vm/memory/referenceProcessor.cpp

Print this page
rev 7793 : 8073315: Enable gcc -Wtype-limits and fix upcoming issues.
Summary: Relevant fixes in blockOffsetTable.cpp, os_linux.cpp, parCardTableModRefBS.cpp.
   1 /*
   2  * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 970   }
 971 
 972   return total_list_count;
 973 }
 974 
 975 inline DiscoveredList* ReferenceProcessor::get_discovered_list(ReferenceType rt) {
 976   uint id = 0;
 977   // Determine the queue index to use for this object.
 978   if (_discovery_is_mt) {
 979     // During a multi-threaded discovery phase,
 980     // each thread saves to its "own" list.
 981     Thread* thr = Thread::current();
 982     id = thr->as_Worker_thread()->id();
 983   } else {
 984     // single-threaded discovery, we save in round-robin
 985     // fashion to each of the lists.
 986     if (_processing_is_mt) {
 987       id = next_id();
 988     }
 989   }
 990   assert(0 <= id && id < _max_num_q, "Id is out-of-bounds (call Freud?)");
 991 
 992   // Get the discovered queue to which we will add
 993   DiscoveredList* list = NULL;
 994   switch (rt) {
 995     case REF_OTHER:
 996       // Unknown reference type, no special treatment
 997       break;
 998     case REF_SOFT:
 999       list = &_discoveredSoftRefs[id];
1000       break;
1001     case REF_WEAK:
1002       list = &_discoveredWeakRefs[id];
1003       break;
1004     case REF_FINAL:
1005       list = &_discoveredFinalRefs[id];
1006       break;
1007     case REF_PHANTOM:
1008       list = &_discoveredPhantomRefs[id];
1009       break;
1010     case REF_CLEANER:


1328         keep_alive->do_oop(next_addr);
1329       }
1330       iter.move_to_next();
1331     } else {
1332       iter.next();
1333     }
1334   }
1335   // Close the reachable set
1336   complete_gc->do_void();
1337 
1338   NOT_PRODUCT(
1339     if (PrintGCDetails && PrintReferenceGC && (iter.processed() > 0)) {
1340       gclog_or_tty->print_cr(" Dropped %d Refs out of %d "
1341         "Refs in discovered list " INTPTR_FORMAT,
1342         iter.removed(), iter.processed(), (address)refs_list.head());
1343     }
1344   )
1345 }
1346 
1347 const char* ReferenceProcessor::list_name(uint i) {
1348    assert(i >= 0 && i <= _max_num_q * number_of_subclasses_of_ref(),
1349           "Out of bounds index");
1350 
1351    int j = i / _max_num_q;
1352    switch (j) {
1353      case 0: return "SoftRef";
1354      case 1: return "WeakRef";
1355      case 2: return "FinalRef";
1356      case 3: return "PhantomRef";
1357      case 4: return "CleanerRef";
1358    }
1359    ShouldNotReachHere();
1360    return NULL;
1361 }
1362 
1363 #ifndef PRODUCT
1364 void ReferenceProcessor::verify_ok_to_handle_reflists() {
1365   // empty for now
1366 }
1367 #endif
1368 
   1 /*
   2  * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 970   }
 971 
 972   return total_list_count;
 973 }
 974 
 975 inline DiscoveredList* ReferenceProcessor::get_discovered_list(ReferenceType rt) {
 976   uint id = 0;
 977   // Determine the queue index to use for this object.
 978   if (_discovery_is_mt) {
 979     // During a multi-threaded discovery phase,
 980     // each thread saves to its "own" list.
 981     Thread* thr = Thread::current();
 982     id = thr->as_Worker_thread()->id();
 983   } else {
 984     // single-threaded discovery, we save in round-robin
 985     // fashion to each of the lists.
 986     if (_processing_is_mt) {
 987       id = next_id();
 988     }
 989   }
 990   assert(id < _max_num_q, "Id is out-of-bounds (call Freud?)");
 991 
 992   // Get the discovered queue to which we will add
 993   DiscoveredList* list = NULL;
 994   switch (rt) {
 995     case REF_OTHER:
 996       // Unknown reference type, no special treatment
 997       break;
 998     case REF_SOFT:
 999       list = &_discoveredSoftRefs[id];
1000       break;
1001     case REF_WEAK:
1002       list = &_discoveredWeakRefs[id];
1003       break;
1004     case REF_FINAL:
1005       list = &_discoveredFinalRefs[id];
1006       break;
1007     case REF_PHANTOM:
1008       list = &_discoveredPhantomRefs[id];
1009       break;
1010     case REF_CLEANER:


1328         keep_alive->do_oop(next_addr);
1329       }
1330       iter.move_to_next();
1331     } else {
1332       iter.next();
1333     }
1334   }
1335   // Close the reachable set
1336   complete_gc->do_void();
1337 
1338   NOT_PRODUCT(
1339     if (PrintGCDetails && PrintReferenceGC && (iter.processed() > 0)) {
1340       gclog_or_tty->print_cr(" Dropped %d Refs out of %d "
1341         "Refs in discovered list " INTPTR_FORMAT,
1342         iter.removed(), iter.processed(), (address)refs_list.head());
1343     }
1344   )
1345 }
1346 
1347 const char* ReferenceProcessor::list_name(uint i) {
1348    assert(i <= _max_num_q * number_of_subclasses_of_ref(),
1349           "Out of bounds index");
1350 
1351    int j = i / _max_num_q;
1352    switch (j) {
1353      case 0: return "SoftRef";
1354      case 1: return "WeakRef";
1355      case 2: return "FinalRef";
1356      case 3: return "PhantomRef";
1357      case 4: return "CleanerRef";
1358    }
1359    ShouldNotReachHere();
1360    return NULL;
1361 }
1362 
1363 #ifndef PRODUCT
1364 void ReferenceProcessor::verify_ok_to_handle_reflists() {
1365   // empty for now
1366 }
1367 #endif
1368 
< prev index next >