comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 6008:b632e80fc9dc

4988100: oop_verify_old_oop appears to be dead Summary: removed oop_verify_old_oop and allow_dirty. Also reviewed by: alexlamsl@gmail.com Reviewed-by: jmasa, jwilhelm
author brutisso
date Mon, 16 Apr 2012 08:57:18 +0200
parents 5c86f8211d1e
children 720b6a76dd9d
comparison
equal deleted inserted replaced
6007:5c86f8211d1e 6008:b632e80fc9dc
1289 1289
1290 if (VerifyBeforeGC && total_collections() >= VerifyGCStartAt) { 1290 if (VerifyBeforeGC && total_collections() >= VerifyGCStartAt) {
1291 HandleMark hm; // Discard invalid handles created during verification 1291 HandleMark hm; // Discard invalid handles created during verification
1292 gclog_or_tty->print(" VerifyBeforeGC:"); 1292 gclog_or_tty->print(" VerifyBeforeGC:");
1293 prepare_for_verify(); 1293 prepare_for_verify();
1294 Universe::verify(/* allow dirty */ true, 1294 Universe::verify(/* silent */ false,
1295 /* silent */ false,
1296 /* option */ VerifyOption_G1UsePrevMarking); 1295 /* option */ VerifyOption_G1UsePrevMarking);
1297 1296
1298 } 1297 }
1299 pre_full_gc_dump(); 1298 pre_full_gc_dump();
1300 1299
1364 1363
1365 if (VerifyAfterGC && total_collections() >= VerifyGCStartAt) { 1364 if (VerifyAfterGC && total_collections() >= VerifyGCStartAt) {
1366 HandleMark hm; // Discard invalid handles created during verification 1365 HandleMark hm; // Discard invalid handles created during verification
1367 gclog_or_tty->print(" VerifyAfterGC:"); 1366 gclog_or_tty->print(" VerifyAfterGC:");
1368 prepare_for_verify(); 1367 prepare_for_verify();
1369 Universe::verify(/* allow dirty */ false, 1368 Universe::verify(/* silent */ false,
1370 /* silent */ false,
1371 /* option */ VerifyOption_G1UsePrevMarking); 1369 /* option */ VerifyOption_G1UsePrevMarking);
1372 1370
1373 } 1371 }
1374 1372
1375 assert(!ref_processor_stw()->discovery_enabled(), "Postcondition"); 1373 assert(!ref_processor_stw()->discovery_enabled(), "Postcondition");
3034 } 3032 }
3035 }; 3033 };
3036 3034
3037 class VerifyRegionClosure: public HeapRegionClosure { 3035 class VerifyRegionClosure: public HeapRegionClosure {
3038 private: 3036 private:
3039 bool _allow_dirty;
3040 bool _par; 3037 bool _par;
3041 VerifyOption _vo; 3038 VerifyOption _vo;
3042 bool _failures; 3039 bool _failures;
3043 public: 3040 public:
3044 // _vo == UsePrevMarking -> use "prev" marking information, 3041 // _vo == UsePrevMarking -> use "prev" marking information,
3045 // _vo == UseNextMarking -> use "next" marking information, 3042 // _vo == UseNextMarking -> use "next" marking information,
3046 // _vo == UseMarkWord -> use mark word from object header. 3043 // _vo == UseMarkWord -> use mark word from object header.
3047 VerifyRegionClosure(bool allow_dirty, bool par, VerifyOption vo) 3044 VerifyRegionClosure(bool par, VerifyOption vo)
3048 : _allow_dirty(allow_dirty), 3045 : _par(par),
3049 _par(par),
3050 _vo(vo), 3046 _vo(vo),
3051 _failures(false) {} 3047 _failures(false) {}
3052 3048
3053 bool failures() { 3049 bool failures() {
3054 return _failures; 3050 return _failures;
3057 bool doHeapRegion(HeapRegion* r) { 3053 bool doHeapRegion(HeapRegion* r) {
3058 guarantee(_par || r->claim_value() == HeapRegion::InitialClaimValue, 3054 guarantee(_par || r->claim_value() == HeapRegion::InitialClaimValue,
3059 "Should be unclaimed at verify points."); 3055 "Should be unclaimed at verify points.");
3060 if (!r->continuesHumongous()) { 3056 if (!r->continuesHumongous()) {
3061 bool failures = false; 3057 bool failures = false;
3062 r->verify(_allow_dirty, _vo, &failures); 3058 r->verify(_vo, &failures);
3063 if (failures) { 3059 if (failures) {
3064 _failures = true; 3060 _failures = true;
3065 } else { 3061 } else {
3066 VerifyObjsInRegionClosure not_dead_yet_cl(r, _vo); 3062 VerifyObjsInRegionClosure not_dead_yet_cl(r, _vo);
3067 r->object_iterate(&not_dead_yet_cl); 3063 r->object_iterate(&not_dead_yet_cl);
3125 // This is the task used for parallel heap verification. 3121 // This is the task used for parallel heap verification.
3126 3122
3127 class G1ParVerifyTask: public AbstractGangTask { 3123 class G1ParVerifyTask: public AbstractGangTask {
3128 private: 3124 private:
3129 G1CollectedHeap* _g1h; 3125 G1CollectedHeap* _g1h;
3130 bool _allow_dirty;
3131 VerifyOption _vo; 3126 VerifyOption _vo;
3132 bool _failures; 3127 bool _failures;
3133 3128
3134 public: 3129 public:
3135 // _vo == UsePrevMarking -> use "prev" marking information, 3130 // _vo == UsePrevMarking -> use "prev" marking information,
3136 // _vo == UseNextMarking -> use "next" marking information, 3131 // _vo == UseNextMarking -> use "next" marking information,
3137 // _vo == UseMarkWord -> use mark word from object header. 3132 // _vo == UseMarkWord -> use mark word from object header.
3138 G1ParVerifyTask(G1CollectedHeap* g1h, bool allow_dirty, VerifyOption vo) : 3133 G1ParVerifyTask(G1CollectedHeap* g1h, VerifyOption vo) :
3139 AbstractGangTask("Parallel verify task"), 3134 AbstractGangTask("Parallel verify task"),
3140 _g1h(g1h), 3135 _g1h(g1h),
3141 _allow_dirty(allow_dirty),
3142 _vo(vo), 3136 _vo(vo),
3143 _failures(false) { } 3137 _failures(false) { }
3144 3138
3145 bool failures() { 3139 bool failures() {
3146 return _failures; 3140 return _failures;
3147 } 3141 }
3148 3142
3149 void work(uint worker_id) { 3143 void work(uint worker_id) {
3150 HandleMark hm; 3144 HandleMark hm;
3151 VerifyRegionClosure blk(_allow_dirty, true, _vo); 3145 VerifyRegionClosure blk(true, _vo);
3152 _g1h->heap_region_par_iterate_chunked(&blk, worker_id, 3146 _g1h->heap_region_par_iterate_chunked(&blk, worker_id,
3153 _g1h->workers()->active_workers(), 3147 _g1h->workers()->active_workers(),
3154 HeapRegion::ParVerifyClaimValue); 3148 HeapRegion::ParVerifyClaimValue);
3155 if (blk.failures()) { 3149 if (blk.failures()) {
3156 _failures = true; 3150 _failures = true;
3157 } 3151 }
3158 } 3152 }
3159 }; 3153 };
3160 3154
3161 void G1CollectedHeap::verify(bool allow_dirty, bool silent) { 3155 void G1CollectedHeap::verify(bool silent) {
3162 verify(allow_dirty, silent, VerifyOption_G1UsePrevMarking); 3156 verify(silent, VerifyOption_G1UsePrevMarking);
3163 } 3157 }
3164 3158
3165 void G1CollectedHeap::verify(bool allow_dirty, 3159 void G1CollectedHeap::verify(bool silent,
3166 bool silent,
3167 VerifyOption vo) { 3160 VerifyOption vo) {
3168 if (SafepointSynchronize::is_at_safepoint() || ! UseTLAB) { 3161 if (SafepointSynchronize::is_at_safepoint() || ! UseTLAB) {
3169 if (!silent) { gclog_or_tty->print("Roots (excluding permgen) "); } 3162 if (!silent) { gclog_or_tty->print("Roots (excluding permgen) "); }
3170 VerifyRootsClosure rootsCl(vo); 3163 VerifyRootsClosure rootsCl(vo);
3171 3164
3213 if (!silent) { gclog_or_tty->print("HeapRegions "); } 3206 if (!silent) { gclog_or_tty->print("HeapRegions "); }
3214 if (GCParallelVerificationEnabled && ParallelGCThreads > 1) { 3207 if (GCParallelVerificationEnabled && ParallelGCThreads > 1) {
3215 assert(check_heap_region_claim_values(HeapRegion::InitialClaimValue), 3208 assert(check_heap_region_claim_values(HeapRegion::InitialClaimValue),
3216 "sanity check"); 3209 "sanity check");
3217 3210
3218 G1ParVerifyTask task(this, allow_dirty, vo); 3211 G1ParVerifyTask task(this, vo);
3219 assert(UseDynamicNumberOfGCThreads || 3212 assert(UseDynamicNumberOfGCThreads ||
3220 workers()->active_workers() == workers()->total_workers(), 3213 workers()->active_workers() == workers()->total_workers(),
3221 "If not dynamic should be using all the workers"); 3214 "If not dynamic should be using all the workers");
3222 int n_workers = workers()->active_workers(); 3215 int n_workers = workers()->active_workers();
3223 set_par_threads(n_workers); 3216 set_par_threads(n_workers);
3235 reset_heap_region_claim_values(); 3228 reset_heap_region_claim_values();
3236 3229
3237 assert(check_heap_region_claim_values(HeapRegion::InitialClaimValue), 3230 assert(check_heap_region_claim_values(HeapRegion::InitialClaimValue),
3238 "sanity check"); 3231 "sanity check");
3239 } else { 3232 } else {
3240 VerifyRegionClosure blk(allow_dirty, false, vo); 3233 VerifyRegionClosure blk(false, vo);
3241 heap_region_iterate(&blk); 3234 heap_region_iterate(&blk);
3242 if (blk.failures()) { 3235 if (blk.failures()) {
3243 failures = true; 3236 failures = true;
3244 } 3237 }
3245 } 3238 }
3648 3641
3649 if (VerifyBeforeGC && total_collections() >= VerifyGCStartAt) { 3642 if (VerifyBeforeGC && total_collections() >= VerifyGCStartAt) {
3650 HandleMark hm; // Discard invalid handles created during verification 3643 HandleMark hm; // Discard invalid handles created during verification
3651 gclog_or_tty->print(" VerifyBeforeGC:"); 3644 gclog_or_tty->print(" VerifyBeforeGC:");
3652 prepare_for_verify(); 3645 prepare_for_verify();
3653 Universe::verify(/* allow dirty */ false, 3646 Universe::verify(/* silent */ false,
3654 /* silent */ false,
3655 /* option */ VerifyOption_G1UsePrevMarking); 3647 /* option */ VerifyOption_G1UsePrevMarking);
3656 } 3648 }
3657 3649
3658 COMPILER2_PRESENT(DerivedPointerTable::clear()); 3650 COMPILER2_PRESENT(DerivedPointerTable::clear());
3659 3651
3893 3885
3894 if (VerifyAfterGC && total_collections() >= VerifyGCStartAt) { 3886 if (VerifyAfterGC && total_collections() >= VerifyGCStartAt) {
3895 HandleMark hm; // Discard invalid handles created during verification 3887 HandleMark hm; // Discard invalid handles created during verification
3896 gclog_or_tty->print(" VerifyAfterGC:"); 3888 gclog_or_tty->print(" VerifyAfterGC:");
3897 prepare_for_verify(); 3889 prepare_for_verify();
3898 Universe::verify(/* allow dirty */ true, 3890 Universe::verify(/* silent */ false,
3899 /* silent */ false,
3900 /* option */ VerifyOption_G1UsePrevMarking); 3891 /* option */ VerifyOption_G1UsePrevMarking);
3901 } 3892 }
3902 3893
3903 assert(!ref_processor_stw()->discovery_enabled(), "Postcondition"); 3894 assert(!ref_processor_stw()->discovery_enabled(), "Postcondition");
3904 ref_processor_stw()->verify_no_references_recorded(); 3895 ref_processor_stw()->verify_no_references_recorded();