--- a/hotspot/src/share/vm/memory/referenceProcessor.cpp Wed Dec 21 07:53:53 2011 -0500
+++ b/hotspot/src/share/vm/memory/referenceProcessor.cpp Wed Dec 14 13:34:57 2011 -0800
@@ -88,9 +88,9 @@
ReferenceProcessor::ReferenceProcessor(MemRegion span,
bool mt_processing,
- int mt_processing_degree,
+ uint mt_processing_degree,
bool mt_discovery,
- int mt_discovery_degree,
+ uint mt_discovery_degree,
bool atomic_discovery,
BoolObjectClosure* is_alive_non_header,
bool discovered_list_needs_barrier) :
@@ -105,7 +105,7 @@
_span = span;
_discovery_is_atomic = atomic_discovery;
_discovery_is_mt = mt_discovery;
- _num_q = MAX2(1, mt_processing_degree);
+ _num_q = MAX2(1U, mt_processing_degree);
_max_num_q = MAX2(_num_q, mt_discovery_degree);
_discovered_refs = NEW_C_HEAP_ARRAY(DiscoveredList,
_max_num_q * number_of_subclasses_of_ref());
@@ -118,7 +118,7 @@
_discoveredPhantomRefs = &_discoveredFinalRefs[_max_num_q];
// Initialize all entries to NULL
- for (int i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
+ for (uint i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
_discovered_refs[i].set_head(NULL);
_discovered_refs[i].set_length(0);
}
@@ -133,7 +133,7 @@
#ifndef PRODUCT
void ReferenceProcessor::verify_no_references_recorded() {
guarantee(!_discovering_refs, "Discovering refs?");
- for (int i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
+ for (uint i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
guarantee(_discovered_refs[i].is_empty(),
"Found non-empty discovered list");
}
@@ -141,7 +141,7 @@
#endif
void ReferenceProcessor::weak_oops_do(OopClosure* f) {
- for (int i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
+ for (uint i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
if (UseCompressedOops) {
f->do_oop((narrowOop*)_discovered_refs[i].adr_head());
} else {
@@ -437,7 +437,7 @@
task_executor->execute(tsk);
} else {
// Serial code: call the parent class's implementation
- for (int i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
+ for (uint i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
enqueue_discovered_reflist(_discovered_refs[i], pending_list_addr);
_discovered_refs[i].set_head(NULL);
_discovered_refs[i].set_length(0);
@@ -696,7 +696,7 @@
void ReferenceProcessor::abandon_partial_discovery() {
// loop over the lists
- for (int i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
+ for (uint i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
if (TraceReferenceGC && PrintGCDetails && ((i % _max_num_q) == 0)) {
gclog_or_tty->print_cr("\nAbandoning %s discovered list", list_name(i));
}
@@ -787,7 +787,7 @@
gclog_or_tty->print_cr("\nBalance ref_lists ");
}
- for (int i = 0; i < _max_num_q; ++i) {
+ for (uint i = 0; i < _max_num_q; ++i) {
total_refs += ref_lists[i].length();
if (TraceReferenceGC && PrintGCDetails) {
gclog_or_tty->print("%d ", ref_lists[i].length());
@@ -797,8 +797,8 @@
gclog_or_tty->print_cr(" = %d", total_refs);
}
size_t avg_refs = total_refs / _num_q + 1;
- int to_idx = 0;
- for (int from_idx = 0; from_idx < _max_num_q; from_idx++) {
+ uint to_idx = 0;
+ for (uint from_idx = 0; from_idx < _max_num_q; from_idx++) {
bool move_all = false;
if (from_idx >= _num_q) {
move_all = ref_lists[from_idx].length() > 0;
@@ -857,7 +857,7 @@
}
#ifdef ASSERT
size_t balanced_total_refs = 0;
- for (int i = 0; i < _max_num_q; ++i) {
+ for (uint i = 0; i < _max_num_q; ++i) {
balanced_total_refs += ref_lists[i].length();
if (TraceReferenceGC && PrintGCDetails) {
gclog_or_tty->print("%d ", ref_lists[i].length());
@@ -903,7 +903,7 @@
}
if (PrintReferenceGC && PrintGCDetails) {
size_t total = 0;
- for (int i = 0; i < _max_num_q; ++i) {
+ for (uint i = 0; i < _max_num_q; ++i) {
total += refs_lists[i].length();
}
gclog_or_tty->print(", %u refs", total);
@@ -919,7 +919,7 @@
RefProcPhase1Task phase1(*this, refs_lists, policy, true /*marks_oops_alive*/);
task_executor->execute(phase1);
} else {
- for (int i = 0; i < _max_num_q; i++) {
+ for (uint i = 0; i < _max_num_q; i++) {
process_phase1(refs_lists[i], policy,
is_alive, keep_alive, complete_gc);
}
@@ -935,7 +935,7 @@
RefProcPhase2Task phase2(*this, refs_lists, !discovery_is_atomic() /*marks_oops_alive*/);
task_executor->execute(phase2);
} else {
- for (int i = 0; i < _max_num_q; i++) {
+ for (uint i = 0; i < _max_num_q; i++) {
process_phase2(refs_lists[i], is_alive, keep_alive, complete_gc);
}
}
@@ -946,7 +946,7 @@
RefProcPhase3Task phase3(*this, refs_lists, clear_referent, true /*marks_oops_alive*/);
task_executor->execute(phase3);
} else {
- for (int i = 0; i < _max_num_q; i++) {
+ for (uint i = 0; i < _max_num_q; i++) {
process_phase3(refs_lists[i], clear_referent,
is_alive, keep_alive, complete_gc);
}
@@ -955,7 +955,7 @@
void ReferenceProcessor::clean_up_discovered_references() {
// loop over the lists
- for (int i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
+ for (uint i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
if (TraceReferenceGC && PrintGCDetails && ((i % _max_num_q) == 0)) {
gclog_or_tty->print_cr(
"\nScrubbing %s discovered list of Null referents",
@@ -1000,7 +1000,7 @@
}
inline DiscoveredList* ReferenceProcessor::get_discovered_list(ReferenceType rt) {
- int id = 0;
+ uint id = 0;
// Determine the queue index to use for this object.
if (_discovery_is_mt) {
// During a multi-threaded discovery phase,
@@ -1282,7 +1282,7 @@
{
TraceTime tt("Preclean SoftReferences", PrintGCDetails && PrintReferenceGC,
false, gclog_or_tty);
- for (int i = 0; i < _max_num_q; i++) {
+ for (uint i = 0; i < _max_num_q; i++) {
if (yield->should_return()) {
return;
}
@@ -1295,7 +1295,7 @@
{
TraceTime tt("Preclean WeakReferences", PrintGCDetails && PrintReferenceGC,
false, gclog_or_tty);
- for (int i = 0; i < _max_num_q; i++) {
+ for (uint i = 0; i < _max_num_q; i++) {
if (yield->should_return()) {
return;
}
@@ -1308,7 +1308,7 @@
{
TraceTime tt("Preclean FinalReferences", PrintGCDetails && PrintReferenceGC,
false, gclog_or_tty);
- for (int i = 0; i < _max_num_q; i++) {
+ for (uint i = 0; i < _max_num_q; i++) {
if (yield->should_return()) {
return;
}
@@ -1321,7 +1321,7 @@
{
TraceTime tt("Preclean PhantomReferences", PrintGCDetails && PrintReferenceGC,
false, gclog_or_tty);
- for (int i = 0; i < _max_num_q; i++) {
+ for (uint i = 0; i < _max_num_q; i++) {
if (yield->should_return()) {
return;
}
@@ -1386,7 +1386,7 @@
)
}
-const char* ReferenceProcessor::list_name(int i) {
+const char* ReferenceProcessor::list_name(uint i) {
assert(i >= 0 && i <= _max_num_q * number_of_subclasses_of_ref(),
"Out of bounds index");
@@ -1410,7 +1410,7 @@
#ifndef PRODUCT
void ReferenceProcessor::clear_discovered_references() {
guarantee(!_discovering_refs, "Discovering refs?");
- for (int i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
+ for (uint i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
clear_discovered_references(_discovered_refs[i]);
}
}