comparison src/share/vm/gc_implementation/g1/heapRegion.cpp @ 18041:52b4284cb496

Merge with jdk8u20-b26
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 16:02:50 +0200
parents 4ca6dc0799b6 78bbf4d43a14
children 7848fc12602b
comparison
equal deleted inserted replaced
17606:45d7b2c7029d 18041:52b4284cb496
1 /* 1 /*
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 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. 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.
32 #include "gc_implementation/g1/heapRegionSeq.inline.hpp" 32 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
33 #include "memory/genOopClosures.inline.hpp" 33 #include "memory/genOopClosures.inline.hpp"
34 #include "memory/iterator.hpp" 34 #include "memory/iterator.hpp"
35 #include "oops/oop.inline.hpp" 35 #include "oops/oop.inline.hpp"
36 36
37 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
38
37 int HeapRegion::LogOfHRGrainBytes = 0; 39 int HeapRegion::LogOfHRGrainBytes = 0;
38 int HeapRegion::LogOfHRGrainWords = 0; 40 int HeapRegion::LogOfHRGrainWords = 0;
39 size_t HeapRegion::GrainBytes = 0; 41 size_t HeapRegion::GrainBytes = 0;
40 size_t HeapRegion::GrainWords = 0; 42 size_t HeapRegion::GrainWords = 0;
41 size_t HeapRegion::CardsPerRegion = 0; 43 size_t HeapRegion::CardsPerRegion = 0;
203 // treat all objects as being inside the unmarked area. 205 // treat all objects as being inside the unmarked area.
204 zero_marked_bytes(); 206 zero_marked_bytes();
205 init_top_at_mark_start(); 207 init_top_at_mark_start();
206 } 208 }
207 209
208 void HeapRegion::hr_clear(bool par, bool clear_space) { 210 void HeapRegion::hr_clear(bool par, bool clear_space, bool locked) {
209 assert(_humongous_type == NotHumongous, 211 assert(_humongous_type == NotHumongous,
210 "we should have already filtered out humongous regions"); 212 "we should have already filtered out humongous regions");
211 assert(_humongous_start_region == NULL, 213 assert(_humongous_start_region == NULL,
212 "we should have already filtered out humongous regions"); 214 "we should have already filtered out humongous regions");
213 assert(_end == _orig_end, 215 assert(_end == _orig_end,
221 reset_pre_dummy_top(); 223 reset_pre_dummy_top();
222 224
223 if (!par) { 225 if (!par) {
224 // If this is parallel, this will be done later. 226 // If this is parallel, this will be done later.
225 HeapRegionRemSet* hrrs = rem_set(); 227 HeapRegionRemSet* hrrs = rem_set();
226 hrrs->clear(); 228 if (locked) {
229 hrrs->clear_locked();
230 } else {
231 hrrs->clear();
232 }
227 _claimed = InitialClaimValue; 233 _claimed = InitialClaimValue;
228 } 234 }
229 zero_marked_bytes(); 235 zero_marked_bytes();
230 236
231 _offsets.resize(HeapRegion::GrainWords); 237 _offsets.resize(HeapRegion::GrainWords);
350 _in_collection_set(false), 356 _in_collection_set(false),
351 _next_in_special_set(NULL), _orig_end(NULL), 357 _next_in_special_set(NULL), _orig_end(NULL),
352 _claimed(InitialClaimValue), _evacuation_failed(false), 358 _claimed(InitialClaimValue), _evacuation_failed(false),
353 _prev_marked_bytes(0), _next_marked_bytes(0), _gc_efficiency(0.0), 359 _prev_marked_bytes(0), _next_marked_bytes(0), _gc_efficiency(0.0),
354 _young_type(NotYoung), _next_young_region(NULL), 360 _young_type(NotYoung), _next_young_region(NULL),
355 _next_dirty_cards_region(NULL), _next(NULL), _pending_removal(false), 361 _next_dirty_cards_region(NULL), _next(NULL), _prev(NULL), _pending_removal(false),
356 #ifdef ASSERT 362 #ifdef ASSERT
357 _containing_set(NULL), 363 _containing_set(NULL),
358 #endif // ASSERT 364 #endif // ASSERT
359 _young_index_in_cset(-1), _surv_rate_group(NULL), _age_index(-1), 365 _young_index_in_cset(-1), _surv_rate_group(NULL), _age_index(-1),
360 _rem_set(NULL), _recorded_rs_length(0), _predicted_elapsed_time_ms(0), 366 _rem_set(NULL), _recorded_rs_length(0), _predicted_elapsed_time_ms(0),
708 assert(VerifyDuringGC, "only way to get here"); 714 assert(VerifyDuringGC, "only way to get here");
709 return; 715 return;
710 } 716 }
711 717
712 HeapRegionRemSet* hrrs = rem_set(); 718 HeapRegionRemSet* hrrs = rem_set();
713 int strong_code_roots_length = hrrs->strong_code_roots_list_length(); 719 size_t strong_code_roots_length = hrrs->strong_code_roots_list_length();
714 720
715 // if this region is empty then there should be no entries 721 // if this region is empty then there should be no entries
716 // on its strong code root list 722 // on its strong code root list
717 if (is_empty()) { 723 if (is_empty()) {
718 if (strong_code_roots_length > 0) { 724 if (strong_code_roots_length > 0) {
719 gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] is empty " 725 gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] is empty "
720 "but has "INT32_FORMAT" code root entries", 726 "but has "SIZE_FORMAT" code root entries",
721 bottom(), end(), strong_code_roots_length); 727 bottom(), end(), strong_code_roots_length);
722 *failures = true; 728 *failures = true;
723 } 729 }
724 return; 730 return;
725 } 731 }
726 732
727 if (continuesHumongous()) { 733 if (continuesHumongous()) {
728 if (strong_code_roots_length > 0) { 734 if (strong_code_roots_length > 0) {
729 gclog_or_tty->print_cr("region "HR_FORMAT" is a continuation of a humongous " 735 gclog_or_tty->print_cr("region "HR_FORMAT" is a continuation of a humongous "
730 "region but has "INT32_FORMAT" code root entries", 736 "region but has "SIZE_FORMAT" code root entries",
731 HR_FORMAT_PARAMS(this), strong_code_roots_length); 737 HR_FORMAT_PARAMS(this), strong_code_roots_length);
732 *failures = true; 738 *failures = true;
733 } 739 }
734 return; 740 return;
735 } 741 }
823 if (!_g1h->is_in_closed_subset(obj) || _g1h->is_obj_dead_cond(obj, _vo)) { 829 if (!_g1h->is_in_closed_subset(obj) || _g1h->is_obj_dead_cond(obj, _vo)) {
824 MutexLockerEx x(ParGCRareEvent_lock, 830 MutexLockerEx x(ParGCRareEvent_lock,
825 Mutex::_no_safepoint_check_flag); 831 Mutex::_no_safepoint_check_flag);
826 832
827 if (!_failures) { 833 if (!_failures) {
828 gclog_or_tty->print_cr(""); 834 gclog_or_tty->cr();
829 gclog_or_tty->print_cr("----------"); 835 gclog_or_tty->print_cr("----------");
830 } 836 }
831 if (!_g1h->is_in_closed_subset(obj)) { 837 if (!_g1h->is_in_closed_subset(obj)) {
832 HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); 838 HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
833 gclog_or_tty->print_cr("Field "PTR_FORMAT 839 gclog_or_tty->print_cr("Field "PTR_FORMAT
878 if (is_bad) { 884 if (is_bad) {
879 MutexLockerEx x(ParGCRareEvent_lock, 885 MutexLockerEx x(ParGCRareEvent_lock,
880 Mutex::_no_safepoint_check_flag); 886 Mutex::_no_safepoint_check_flag);
881 887
882 if (!_failures) { 888 if (!_failures) {
883 gclog_or_tty->print_cr(""); 889 gclog_or_tty->cr();
884 gclog_or_tty->print_cr("----------"); 890 gclog_or_tty->print_cr("----------");
885 } 891 }
886 gclog_or_tty->print_cr("Missing rem set entry:"); 892 gclog_or_tty->print_cr("Missing rem set entry:");
887 gclog_or_tty->print_cr("Field "PTR_FORMAT" " 893 gclog_or_tty->print_cr("Field "PTR_FORMAT" "
888 "of obj "PTR_FORMAT", " 894 "of obj "PTR_FORMAT", "