1.1 --- a/src/share/vm/gc_implementation/g1/heapRegionSet.cpp Wed Apr 11 16:18:45 2012 +0200 1.2 +++ b/src/share/vm/gc_implementation/g1/heapRegionSet.cpp Wed Apr 18 07:21:15 2012 -0400 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -25,28 +25,26 @@ 1.11 #include "precompiled.hpp" 1.12 #include "gc_implementation/g1/heapRegionSet.inline.hpp" 1.13 1.14 -size_t HeapRegionSetBase::_unrealistically_long_length = 0; 1.15 +uint HeapRegionSetBase::_unrealistically_long_length = 0; 1.16 HRSPhase HeapRegionSetBase::_phase = HRSPhaseNone; 1.17 1.18 //////////////////// HeapRegionSetBase //////////////////// 1.19 1.20 -void HeapRegionSetBase::set_unrealistically_long_length(size_t len) { 1.21 +void HeapRegionSetBase::set_unrealistically_long_length(uint len) { 1.22 guarantee(_unrealistically_long_length == 0, "should only be set once"); 1.23 _unrealistically_long_length = len; 1.24 } 1.25 1.26 -size_t HeapRegionSetBase::calculate_region_num(HeapRegion* hr) { 1.27 +uint HeapRegionSetBase::calculate_region_num(HeapRegion* hr) { 1.28 assert(hr->startsHumongous(), "pre-condition"); 1.29 assert(hr->capacity() % HeapRegion::GrainBytes == 0, "invariant"); 1.30 - size_t region_num = hr->capacity() >> HeapRegion::LogOfHRGrainBytes; 1.31 + uint region_num = (uint) (hr->capacity() >> HeapRegion::LogOfHRGrainBytes); 1.32 assert(region_num > 0, "sanity"); 1.33 return region_num; 1.34 } 1.35 1.36 void HeapRegionSetBase::fill_in_ext_msg(hrs_ext_msg* msg, const char* message) { 1.37 - msg->append("[%s] %s " 1.38 - "ln: "SIZE_FORMAT" rn: "SIZE_FORMAT" " 1.39 - "cy: "SIZE_FORMAT" ud: "SIZE_FORMAT, 1.40 + msg->append("[%s] %s ln: %u rn: %u cy: "SIZE_FORMAT" ud: "SIZE_FORMAT, 1.41 name(), message, length(), region_num(), 1.42 total_capacity_bytes(), total_used_bytes()); 1.43 fill_in_ext_msg_extra(msg); 1.44 @@ -170,13 +168,11 @@ 1.45 hrs_ext_msg(this, "verification should be in progress")); 1.46 1.47 guarantee(length() == _calc_length, 1.48 - hrs_err_msg("[%s] length: "SIZE_FORMAT" should be == " 1.49 - "calc length: "SIZE_FORMAT, 1.50 + hrs_err_msg("[%s] length: %u should be == calc length: %u", 1.51 name(), length(), _calc_length)); 1.52 1.53 guarantee(region_num() == _calc_region_num, 1.54 - hrs_err_msg("[%s] region num: "SIZE_FORMAT" should be == " 1.55 - "calc region num: "SIZE_FORMAT, 1.56 + hrs_err_msg("[%s] region num: %u should be == calc region num: %u", 1.57 name(), region_num(), _calc_region_num)); 1.58 1.59 guarantee(total_capacity_bytes() == _calc_total_capacity_bytes, 1.60 @@ -211,8 +207,8 @@ 1.61 out->print_cr(" humongous : %s", BOOL_TO_STR(regions_humongous())); 1.62 out->print_cr(" empty : %s", BOOL_TO_STR(regions_empty())); 1.63 out->print_cr(" Attributes"); 1.64 - out->print_cr(" length : "SIZE_FORMAT_W(14), length()); 1.65 - out->print_cr(" region num : "SIZE_FORMAT_W(14), region_num()); 1.66 + out->print_cr(" length : %14u", length()); 1.67 + out->print_cr(" region num : %14u", region_num()); 1.68 out->print_cr(" total capacity : "SIZE_FORMAT_W(14)" bytes", 1.69 total_capacity_bytes()); 1.70 out->print_cr(" total used : "SIZE_FORMAT_W(14)" bytes", 1.71 @@ -243,14 +239,12 @@ 1.72 if (proxy_set->is_empty()) return; 1.73 1.74 assert(proxy_set->length() <= _length, 1.75 - hrs_err_msg("[%s] proxy set length: "SIZE_FORMAT" " 1.76 - "should be <= length: "SIZE_FORMAT, 1.77 + hrs_err_msg("[%s] proxy set length: %u should be <= length: %u", 1.78 name(), proxy_set->length(), _length)); 1.79 _length -= proxy_set->length(); 1.80 1.81 assert(proxy_set->region_num() <= _region_num, 1.82 - hrs_err_msg("[%s] proxy set region num: "SIZE_FORMAT" " 1.83 - "should be <= region num: "SIZE_FORMAT, 1.84 + hrs_err_msg("[%s] proxy set region num: %u should be <= region num: %u", 1.85 name(), proxy_set->region_num(), _region_num)); 1.86 _region_num -= proxy_set->region_num(); 1.87 1.88 @@ -369,17 +363,17 @@ 1.89 verify_optional(); 1.90 } 1.91 1.92 -void HeapRegionLinkedList::remove_all_pending(size_t target_count) { 1.93 +void HeapRegionLinkedList::remove_all_pending(uint target_count) { 1.94 hrs_assert_mt_safety_ok(this); 1.95 assert(target_count > 1, hrs_ext_msg(this, "pre-condition")); 1.96 assert(!is_empty(), hrs_ext_msg(this, "pre-condition")); 1.97 1.98 verify_optional(); 1.99 - DEBUG_ONLY(size_t old_length = length();) 1.100 + DEBUG_ONLY(uint old_length = length();) 1.101 1.102 HeapRegion* curr = _head; 1.103 HeapRegion* prev = NULL; 1.104 - size_t count = 0; 1.105 + uint count = 0; 1.106 while (curr != NULL) { 1.107 hrs_assert_region_ok(this, curr, this); 1.108 HeapRegion* next = curr->next(); 1.109 @@ -387,7 +381,7 @@ 1.110 if (curr->pending_removal()) { 1.111 assert(count < target_count, 1.112 hrs_err_msg("[%s] should not come across more regions " 1.113 - "pending for removal than target_count: "SIZE_FORMAT, 1.114 + "pending for removal than target_count: %u", 1.115 name(), target_count)); 1.116 1.117 if (prev == NULL) { 1.118 @@ -422,12 +416,11 @@ 1.119 } 1.120 1.121 assert(count == target_count, 1.122 - hrs_err_msg("[%s] count: "SIZE_FORMAT" should be == " 1.123 - "target_count: "SIZE_FORMAT, name(), count, target_count)); 1.124 + hrs_err_msg("[%s] count: %u should be == target_count: %u", 1.125 + name(), count, target_count)); 1.126 assert(length() + target_count == old_length, 1.127 hrs_err_msg("[%s] new length should be consistent " 1.128 - "new length: "SIZE_FORMAT" old length: "SIZE_FORMAT" " 1.129 - "target_count: "SIZE_FORMAT, 1.130 + "new length: %u old length: %u target_count: %u", 1.131 name(), length(), old_length, target_count)); 1.132 1.133 verify_optional(); 1.134 @@ -444,16 +437,16 @@ 1.135 HeapRegion* curr = _head; 1.136 HeapRegion* prev1 = NULL; 1.137 HeapRegion* prev0 = NULL; 1.138 - size_t count = 0; 1.139 + uint count = 0; 1.140 while (curr != NULL) { 1.141 verify_next_region(curr); 1.142 1.143 count += 1; 1.144 guarantee(count < _unrealistically_long_length, 1.145 - hrs_err_msg("[%s] the calculated length: "SIZE_FORMAT" " 1.146 + hrs_err_msg("[%s] the calculated length: %u " 1.147 "seems very long, is there maybe a cycle? " 1.148 "curr: "PTR_FORMAT" prev0: "PTR_FORMAT" " 1.149 - "prev1: "PTR_FORMAT" length: "SIZE_FORMAT, 1.150 + "prev1: "PTR_FORMAT" length: %u", 1.151 name(), count, curr, prev0, prev1, length())); 1.152 1.153 prev1 = prev0;