Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp @ 6010:720b6a76dd9d
7157073: G1: type change size_t -> uint for region counts / indexes
Summary: Change the type of fields / variables / etc. that represent region counts and indeces from size_t to uint.
Reviewed-by: iveresov, brutisso, jmasa, jwilhelm
author | tonyp |
---|---|
date | Wed, 18 Apr 2012 07:21:15 -0400 |
parents | 5e5d4821bf07 |
children | 5c8bd7c16119 |
comparison
equal
deleted
inserted
replaced
6009:dde53abda3d6 | 6010:720b6a76dd9d |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2001, 2012, 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. |
575 } | 575 } |
576 } | 576 } |
577 #endif | 577 #endif |
578 | 578 |
579 void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, int tid) { | 579 void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, int tid) { |
580 size_t cur_hrs_ind = hr()->hrs_index(); | 580 size_t cur_hrs_ind = (size_t) hr()->hrs_index(); |
581 | 581 |
582 #if HRRS_VERBOSE | 582 #if HRRS_VERBOSE |
583 gclog_or_tty->print_cr("ORT::add_reference_work(" PTR_FORMAT "->" PTR_FORMAT ").", | 583 gclog_or_tty->print_cr("ORT::add_reference_work(" PTR_FORMAT "->" PTR_FORMAT ").", |
584 from, | 584 from, |
585 UseCompressedOops | 585 UseCompressedOops |
839 (float)occ_sum/(float)coarsenings); | 839 (float)occ_sum/(float)coarsenings); |
840 } | 840 } |
841 #endif | 841 #endif |
842 | 842 |
843 // Set the corresponding coarse bit. | 843 // Set the corresponding coarse bit. |
844 size_t max_hrs_index = max->hr()->hrs_index(); | 844 size_t max_hrs_index = (size_t) max->hr()->hrs_index(); |
845 if (!_coarse_map.at(max_hrs_index)) { | 845 if (!_coarse_map.at(max_hrs_index)) { |
846 _coarse_map.at_put(max_hrs_index, true); | 846 _coarse_map.at_put(max_hrs_index, true); |
847 _n_coarse_entries++; | 847 _n_coarse_entries++; |
848 #if 0 | 848 #if 0 |
849 gclog_or_tty->print("Coarsened entry in region [" PTR_FORMAT "...] " | 849 gclog_or_tty->print("Coarsened entry in region [" PTR_FORMAT "...] " |
864 | 864 |
865 // At present, this must be called stop-world single-threaded. | 865 // At present, this must be called stop-world single-threaded. |
866 void OtherRegionsTable::scrub(CardTableModRefBS* ctbs, | 866 void OtherRegionsTable::scrub(CardTableModRefBS* ctbs, |
867 BitMap* region_bm, BitMap* card_bm) { | 867 BitMap* region_bm, BitMap* card_bm) { |
868 // First eliminated garbage regions from the coarse map. | 868 // First eliminated garbage regions from the coarse map. |
869 if (G1RSScrubVerbose) | 869 if (G1RSScrubVerbose) { |
870 gclog_or_tty->print_cr("Scrubbing region "SIZE_FORMAT":", | 870 gclog_or_tty->print_cr("Scrubbing region %u:", hr()->hrs_index()); |
871 hr()->hrs_index()); | 871 } |
872 | 872 |
873 assert(_coarse_map.size() == region_bm->size(), "Precondition"); | 873 assert(_coarse_map.size() == region_bm->size(), "Precondition"); |
874 if (G1RSScrubVerbose) | 874 if (G1RSScrubVerbose) { |
875 gclog_or_tty->print(" Coarse map: before = %d...", _n_coarse_entries); | 875 gclog_or_tty->print(" Coarse map: before = "SIZE_FORMAT"...", |
876 _n_coarse_entries); | |
877 } | |
876 _coarse_map.set_intersection(*region_bm); | 878 _coarse_map.set_intersection(*region_bm); |
877 _n_coarse_entries = _coarse_map.count_one_bits(); | 879 _n_coarse_entries = _coarse_map.count_one_bits(); |
878 if (G1RSScrubVerbose) | 880 if (G1RSScrubVerbose) { |
879 gclog_or_tty->print_cr(" after = %d.", _n_coarse_entries); | 881 gclog_or_tty->print_cr(" after = "SIZE_FORMAT".", _n_coarse_entries); |
882 } | |
880 | 883 |
881 // Now do the fine-grained maps. | 884 // Now do the fine-grained maps. |
882 for (size_t i = 0; i < _max_fine_entries; i++) { | 885 for (size_t i = 0; i < _max_fine_entries; i++) { |
883 PosParPRT* cur = _fine_grain_regions[i]; | 886 PosParPRT* cur = _fine_grain_regions[i]; |
884 PosParPRT** prev = &_fine_grain_regions[i]; | 887 PosParPRT** prev = &_fine_grain_regions[i]; |
885 while (cur != NULL) { | 888 while (cur != NULL) { |
886 PosParPRT* nxt = cur->next(); | 889 PosParPRT* nxt = cur->next(); |
887 // If the entire region is dead, eliminate. | 890 // If the entire region is dead, eliminate. |
888 if (G1RSScrubVerbose) | 891 if (G1RSScrubVerbose) { |
889 gclog_or_tty->print_cr(" For other region "SIZE_FORMAT":", | 892 gclog_or_tty->print_cr(" For other region %u:", |
890 cur->hr()->hrs_index()); | 893 cur->hr()->hrs_index()); |
891 if (!region_bm->at(cur->hr()->hrs_index())) { | 894 } |
895 if (!region_bm->at((size_t) cur->hr()->hrs_index())) { | |
892 *prev = nxt; | 896 *prev = nxt; |
893 cur->set_next(NULL); | 897 cur->set_next(NULL); |
894 _n_fine_entries--; | 898 _n_fine_entries--; |
895 if (G1RSScrubVerbose) | 899 if (G1RSScrubVerbose) { |
896 gclog_or_tty->print_cr(" deleted via region map."); | 900 gclog_or_tty->print_cr(" deleted via region map."); |
901 } | |
897 PosParPRT::free(cur); | 902 PosParPRT::free(cur); |
898 } else { | 903 } else { |
899 // Do fine-grain elimination. | 904 // Do fine-grain elimination. |
900 if (G1RSScrubVerbose) | 905 if (G1RSScrubVerbose) { |
901 gclog_or_tty->print(" occ: before = %4d.", cur->occupied()); | 906 gclog_or_tty->print(" occ: before = %4d.", cur->occupied()); |
907 } | |
902 cur->scrub(ctbs, card_bm); | 908 cur->scrub(ctbs, card_bm); |
903 if (G1RSScrubVerbose) | 909 if (G1RSScrubVerbose) { |
904 gclog_or_tty->print_cr(" after = %4d.", cur->occupied()); | 910 gclog_or_tty->print_cr(" after = %4d.", cur->occupied()); |
911 } | |
905 // Did that empty the table completely? | 912 // Did that empty the table completely? |
906 if (cur->occupied() == 0) { | 913 if (cur->occupied() == 0) { |
907 *prev = nxt; | 914 *prev = nxt; |
908 cur->set_next(NULL); | 915 cur->set_next(NULL); |
909 _n_fine_entries--; | 916 _n_fine_entries--; |
1001 clear_fcc(); | 1008 clear_fcc(); |
1002 } | 1009 } |
1003 | 1010 |
1004 void OtherRegionsTable::clear_incoming_entry(HeapRegion* from_hr) { | 1011 void OtherRegionsTable::clear_incoming_entry(HeapRegion* from_hr) { |
1005 MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag); | 1012 MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag); |
1006 size_t hrs_ind = from_hr->hrs_index(); | 1013 size_t hrs_ind = (size_t) from_hr->hrs_index(); |
1007 size_t ind = hrs_ind & _mod_max_fine_entries_mask; | 1014 size_t ind = hrs_ind & _mod_max_fine_entries_mask; |
1008 if (del_single_region_table(ind, from_hr)) { | 1015 if (del_single_region_table(ind, from_hr)) { |
1009 assert(!_coarse_map.at(hrs_ind), "Inv"); | 1016 assert(!_coarse_map.at(hrs_ind), "Inv"); |
1010 } else { | 1017 } else { |
1011 _coarse_map.par_at_put(hrs_ind, 0); | 1018 _coarse_map.par_at_put(hrs_ind, 0); |
1012 } | 1019 } |
1013 // Check to see if any of the fcc entries come from here. | 1020 // Check to see if any of the fcc entries come from here. |
1014 size_t hr_ind = hr()->hrs_index(); | 1021 size_t hr_ind = (size_t) hr()->hrs_index(); |
1015 for (int tid = 0; tid < HeapRegionRemSet::num_par_rem_sets(); tid++) { | 1022 for (int tid = 0; tid < HeapRegionRemSet::num_par_rem_sets(); tid++) { |
1016 int fcc_ent = _from_card_cache[tid][hr_ind]; | 1023 int fcc_ent = _from_card_cache[tid][hr_ind]; |
1017 if (fcc_ent != -1) { | 1024 if (fcc_ent != -1) { |
1018 HeapWord* card_addr = (HeapWord*) | 1025 HeapWord* card_addr = (HeapWord*) |
1019 (uintptr_t(fcc_ent) << CardTableModRefBS::card_shift); | 1026 (uintptr_t(fcc_ent) << CardTableModRefBS::card_shift); |
1221 _coarse_cur_region_index = | 1228 _coarse_cur_region_index = |
1222 (int) _coarse_map->get_next_one_offset(_coarse_cur_region_index + 1); | 1229 (int) _coarse_map->get_next_one_offset(_coarse_cur_region_index + 1); |
1223 if ((size_t)_coarse_cur_region_index < _coarse_map->size()) { | 1230 if ((size_t)_coarse_cur_region_index < _coarse_map->size()) { |
1224 _coarse_cur_region_cur_card = 0; | 1231 _coarse_cur_region_cur_card = 0; |
1225 HeapWord* r_bot = | 1232 HeapWord* r_bot = |
1226 _g1h->region_at(_coarse_cur_region_index)->bottom(); | 1233 _g1h->region_at((uint) _coarse_cur_region_index)->bottom(); |
1227 _cur_region_card_offset = _bosa->index_for(r_bot); | 1234 _cur_region_card_offset = _bosa->index_for(r_bot); |
1228 } else { | 1235 } else { |
1229 return false; | 1236 return false; |
1230 } | 1237 } |
1231 } | 1238 } |